Search in sources :

Example 1 with RememberMeDelegatingExpirationPolicy

use of org.apereo.cas.ticket.expiration.RememberMeDelegatingExpirationPolicy in project cas by apereo.

the class TicketGrantingTicketExpirationPolicyBuilderTests method verifyRememberMe.

@Test
public void verifyRememberMe() {
    val props = new CasConfigurationProperties();
    props.getTicket().getTgt().getRememberMe().setEnabled(true);
    val builder = new TicketGrantingTicketExpirationPolicyBuilder(props);
    assertTrue(builder.buildTicketExpirationPolicy() instanceof RememberMeDelegatingExpirationPolicy);
    assertNotNull(builder.getTicketType());
    assertNotNull(builder.toString());
    assertNotNull(builder.getCasProperties());
}
Also used : lombok.val(lombok.val) CasConfigurationProperties(org.apereo.cas.configuration.CasConfigurationProperties) RememberMeDelegatingExpirationPolicy(org.apereo.cas.ticket.expiration.RememberMeDelegatingExpirationPolicy) Test(org.junit.jupiter.api.Test)

Example 2 with RememberMeDelegatingExpirationPolicy

use of org.apereo.cas.ticket.expiration.RememberMeDelegatingExpirationPolicy in project cas by apereo.

the class TicketGrantingTicketExpirationPolicyBuilder method toRememberMeTicketExpirationPolicy.

/**
 * To remember-me ticket expiration policy.
 *
 * @return the expiration policy
 */
public ExpirationPolicy toRememberMeTicketExpirationPolicy() {
    val tgt = casProperties.getTicket().getTgt();
    LOGGER.debug("Remember me expiration policy is being configured based on hard timeout of [{}] seconds", tgt.getRememberMe().getTimeToKillInSeconds());
    val rememberMePolicy = new HardTimeoutExpirationPolicy(tgt.getRememberMe().getTimeToKillInSeconds());
    val p = new RememberMeDelegatingExpirationPolicy();
    p.addPolicy(RememberMeDelegatingExpirationPolicy.POLICY_NAME_REMEMBER_ME, rememberMePolicy);
    p.addPolicy(RememberMeDelegatingExpirationPolicy.POLICY_NAME_DEFAULT, toTicketGrantingTicketExpirationPolicy());
    return p;
}
Also used : lombok.val(lombok.val) HardTimeoutExpirationPolicy(org.apereo.cas.ticket.expiration.HardTimeoutExpirationPolicy) RememberMeDelegatingExpirationPolicy(org.apereo.cas.ticket.expiration.RememberMeDelegatingExpirationPolicy)

Aggregations

lombok.val (lombok.val)2 RememberMeDelegatingExpirationPolicy (org.apereo.cas.ticket.expiration.RememberMeDelegatingExpirationPolicy)2 CasConfigurationProperties (org.apereo.cas.configuration.CasConfigurationProperties)1 HardTimeoutExpirationPolicy (org.apereo.cas.ticket.expiration.HardTimeoutExpirationPolicy)1 Test (org.junit.jupiter.api.Test)1