Search in sources :

Example 6 with CasSimpleMultifactorAuthenticationTicketFactory

use of org.apereo.cas.mfa.simple.ticket.CasSimpleMultifactorAuthenticationTicketFactory in project cas by apereo.

the class CasSimpleMultifactorAuthenticationTicketFactoryTests method verifyCustomExpirationPolicy.

@Test
public void verifyCustomExpirationPolicy() {
    val factory = (CasSimpleMultifactorAuthenticationTicketFactory) this.ticketFactory.get(CasSimpleMultifactorAuthenticationTicket.class);
    val ticket = factory.create(RegisteredServiceTestUtils.getService("example"), CollectionUtils.wrap(ExpirationPolicy.class.getName(), HardTimeoutExpirationPolicy.builder().timeToKillInSeconds(60).build()));
    assertNotNull(ticket);
    assertEquals(60, ticket.getExpirationPolicy().getTimeToLive());
}
Also used : lombok.val(lombok.val) CasSimpleMultifactorAuthenticationTicket(org.apereo.cas.mfa.simple.ticket.CasSimpleMultifactorAuthenticationTicket) CasSimpleMultifactorAuthenticationTicketFactory(org.apereo.cas.mfa.simple.ticket.CasSimpleMultifactorAuthenticationTicketFactory) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

lombok.val (lombok.val)6 CasSimpleMultifactorAuthenticationTicket (org.apereo.cas.mfa.simple.ticket.CasSimpleMultifactorAuthenticationTicket)6 CasSimpleMultifactorAuthenticationTicketFactory (org.apereo.cas.mfa.simple.ticket.CasSimpleMultifactorAuthenticationTicketFactory)6 Test (org.junit.jupiter.api.Test)5 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)5 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)3 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)3 MockServletContext (org.springframework.mock.web.MockServletContext)3 ServletExternalContext (org.springframework.webflow.context.servlet.ServletExternalContext)3 MockRequestContext (org.springframework.webflow.test.MockRequestContext)3 Map (java.util.Map)1 Optional (java.util.Optional)1 RequiredArgsConstructor (lombok.RequiredArgsConstructor)1 Slf4j (lombok.extern.slf4j.Slf4j)1 StringUtils (org.apache.commons.lang3.StringUtils)1 CentralAuthenticationService (org.apereo.cas.CentralAuthenticationService)1 UsernamePasswordCredential (org.apereo.cas.authentication.credential.UsernamePasswordCredential)1 Principal (org.apereo.cas.authentication.principal.Principal)1 BucketConsumer (org.apereo.cas.bucket4j.consumer.BucketConsumer)1 CasSimpleMultifactorAuthenticationProperties (org.apereo.cas.configuration.model.support.mfa.simple.CasSimpleMultifactorAuthenticationProperties)1