Search in sources :

Example 1 with SurrogateAuthenticationProperties

use of org.apereo.cas.configuration.model.support.surrogate.SurrogateAuthenticationProperties in project cas by apereo.

the class SurrogateLdapAuthenticationConfiguration method surrogateAuthenticationService.

@RefreshScope
@Bean
public SurrogateAuthenticationService surrogateAuthenticationService() {
    final SurrogateAuthenticationProperties su = casProperties.getAuthn().getSurrogate();
    LOGGER.debug("Using LDAP [{}] with baseDn [{}] to locate surrogate accounts", su.getLdap().getLdapUrl(), su.getLdap().getBaseDn());
    final ConnectionFactory factory = LdapUtils.newLdaptivePooledConnectionFactory(su.getLdap());
    return new SurrogateLdapAuthenticationService(factory, su.getLdap(), servicesManager);
}
Also used : ConnectionFactory(org.ldaptive.ConnectionFactory) SurrogateAuthenticationProperties(org.apereo.cas.configuration.model.support.surrogate.SurrogateAuthenticationProperties) SurrogateLdapAuthenticationService(org.apereo.cas.authentication.surrogate.SurrogateLdapAuthenticationService) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Bean(org.springframework.context.annotation.Bean)

Example 2 with SurrogateAuthenticationProperties

use of org.apereo.cas.configuration.model.support.surrogate.SurrogateAuthenticationProperties in project cas by apereo.

the class SurrogateAuthenticationConfiguration method grantingTicketExpirationPolicy.

@Bean
public ExpirationPolicy grantingTicketExpirationPolicy(@Qualifier("ticketGrantingTicketExpirationPolicy") final ExpirationPolicy ticketGrantingTicketExpirationPolicy) {
    final SurrogateAuthenticationProperties su = casProperties.getAuthn().getSurrogate();
    final HardTimeoutExpirationPolicy surrogatePolicy = new HardTimeoutExpirationPolicy(su.getTgt().getTimeToKillInSeconds());
    final SurrogateSessionExpirationPolicy policy = new SurrogateSessionExpirationPolicy(surrogatePolicy);
    policy.addPolicy(SurrogateSessionExpirationPolicy.PolicyTypes.SURROGATE, surrogatePolicy);
    policy.addPolicy(SurrogateSessionExpirationPolicy.PolicyTypes.DEFAULT, ticketGrantingTicketExpirationPolicy);
    return policy;
}
Also used : SurrogateAuthenticationProperties(org.apereo.cas.configuration.model.support.surrogate.SurrogateAuthenticationProperties) HardTimeoutExpirationPolicy(org.apereo.cas.ticket.support.HardTimeoutExpirationPolicy) SurrogateSessionExpirationPolicy(org.apereo.cas.ticket.support.SurrogateSessionExpirationPolicy) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 3 with SurrogateAuthenticationProperties

use of org.apereo.cas.configuration.model.support.surrogate.SurrogateAuthenticationProperties in project cas by apereo.

the class SurrogateRestAuthenticationConfiguration method surrogateAuthenticationService.

@RefreshScope
@Bean
public SurrogateAuthenticationService surrogateAuthenticationService() {
    final SurrogateAuthenticationProperties su = casProperties.getAuthn().getSurrogate();
    LOGGER.debug("Using REST endpoint [{}] with method [{}] to locate surrogate accounts", su.getRest().getUrl(), su.getRest().getMethod());
    return new SurrogateRestAuthenticationService(su.getRest(), servicesManager);
}
Also used : SurrogateAuthenticationProperties(org.apereo.cas.configuration.model.support.surrogate.SurrogateAuthenticationProperties) SurrogateRestAuthenticationService(org.apereo.cas.authentication.surrogate.SurrogateRestAuthenticationService) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Bean(org.springframework.context.annotation.Bean)

Example 4 with SurrogateAuthenticationProperties

use of org.apereo.cas.configuration.model.support.surrogate.SurrogateAuthenticationProperties in project cas by apereo.

the class SurrogateAuthenticationConfiguration method surrogateAuthenticationService.

@RefreshScope
@ConditionalOnMissingBean(name = "surrogateAuthenticationService")
@Bean
@SneakyThrows
public SurrogateAuthenticationService surrogateAuthenticationService() {
    final SurrogateAuthenticationProperties su = casProperties.getAuthn().getSurrogate();
    if (su.getJson().getLocation() != null) {
        LOGGER.debug("Using JSON resource [{}] to locate surrogate accounts", su.getJson().getLocation());
        return new JsonResourceSurrogateAuthenticationService(su.getJson().getLocation(), servicesManager);
    }
    final Map<String, Set> accounts = new LinkedHashMap<>();
    su.getSimple().getSurrogates().forEach((k, v) -> accounts.put(k, StringUtils.commaDelimitedListToSet(v)));
    LOGGER.debug("Using accounts [{}] for surrogate authentication", accounts);
    return new SimpleSurrogateAuthenticationService(accounts, servicesManager);
}
Also used : JsonResourceSurrogateAuthenticationService(org.apereo.cas.authentication.surrogate.JsonResourceSurrogateAuthenticationService) SurrogateAuthenticationProperties(org.apereo.cas.configuration.model.support.surrogate.SurrogateAuthenticationProperties) Set(java.util.Set) SimpleSurrogateAuthenticationService(org.apereo.cas.authentication.surrogate.SimpleSurrogateAuthenticationService) LinkedHashMap(java.util.LinkedHashMap) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) SneakyThrows(lombok.SneakyThrows) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

SurrogateAuthenticationProperties (org.apereo.cas.configuration.model.support.surrogate.SurrogateAuthenticationProperties)4 Bean (org.springframework.context.annotation.Bean)4 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)3 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)2 LinkedHashMap (java.util.LinkedHashMap)1 Set (java.util.Set)1 SneakyThrows (lombok.SneakyThrows)1 JsonResourceSurrogateAuthenticationService (org.apereo.cas.authentication.surrogate.JsonResourceSurrogateAuthenticationService)1 SimpleSurrogateAuthenticationService (org.apereo.cas.authentication.surrogate.SimpleSurrogateAuthenticationService)1 SurrogateLdapAuthenticationService (org.apereo.cas.authentication.surrogate.SurrogateLdapAuthenticationService)1 SurrogateRestAuthenticationService (org.apereo.cas.authentication.surrogate.SurrogateRestAuthenticationService)1 HardTimeoutExpirationPolicy (org.apereo.cas.ticket.support.HardTimeoutExpirationPolicy)1 SurrogateSessionExpirationPolicy (org.apereo.cas.ticket.support.SurrogateSessionExpirationPolicy)1 ConnectionFactory (org.ldaptive.ConnectionFactory)1