Search in sources :

Example 1 with LdapAuthorizationProperties

use of org.apereo.cas.configuration.model.support.ldap.LdapAuthorizationProperties in project cas by apereo.

the class CasWebApplicationSecurityConfiguration method isLdapAuthorizationActive.

private boolean isLdapAuthorizationActive() {
    final AdminPagesSecurityProperties.Ldap ldap = casProperties.getAdminPagesSecurity().getLdap();
    final LdapAuthorizationProperties authZ = ldap.getLdapAuthz();
    return StringUtils.isNotBlank(ldap.getBaseDn()) && StringUtils.isNotBlank(ldap.getLdapUrl()) && StringUtils.isNotBlank(ldap.getUserFilter()) && (StringUtils.isNotBlank(authZ.getRoleAttribute()) || StringUtils.isNotBlank(authZ.getGroupAttribute()));
}
Also used : LdapAuthorizationProperties(org.apereo.cas.configuration.model.support.ldap.LdapAuthorizationProperties) AdminPagesSecurityProperties(org.apereo.cas.configuration.model.core.web.security.AdminPagesSecurityProperties)

Example 2 with LdapAuthorizationProperties

use of org.apereo.cas.configuration.model.support.ldap.LdapAuthorizationProperties in project cas by apereo.

the class CasManagementLdapAuthorizationConfiguration method authorizationGenerator.

@RefreshScope
@Bean
public AuthorizationGenerator authorizationGenerator() {
    final LdapAuthorizationProperties ldapAuthz = casProperties.getMgmt().getLdap().getLdapAuthz();
    final ConnectionFactory connectionFactory = Beans.newLdaptivePooledConnectionFactory(casProperties.getMgmt().getLdap());
    if (StringUtils.isNotBlank(ldapAuthz.getGroupFilter()) && StringUtils.isNotBlank(ldapAuthz.getGroupAttribute())) {
        return new LdapUserGroupsToRolesAuthorizationGenerator(connectionFactory, ldapAuthorizationGeneratorUserSearchExecutor(), ldapAuthz.isAllowMultipleResults(), ldapAuthz.getGroupAttribute(), ldapAuthz.getGroupPrefix(), ldapAuthorizationGeneratorGroupSearchExecutor());
    }
    return new LdapUserAttributesToRolesAuthorizationGenerator(connectionFactory, ldapAuthorizationGeneratorUserSearchExecutor(), ldapAuthz.isAllowMultipleResults(), ldapAuthz.getRoleAttribute(), ldapAuthz.getRolePrefix());
}
Also used : LdapUserAttributesToRolesAuthorizationGenerator(org.apereo.cas.authorization.LdapUserAttributesToRolesAuthorizationGenerator) LdapAuthorizationProperties(org.apereo.cas.configuration.model.support.ldap.LdapAuthorizationProperties) ConnectionFactory(org.ldaptive.ConnectionFactory) LdapUserGroupsToRolesAuthorizationGenerator(org.apereo.cas.authorization.LdapUserGroupsToRolesAuthorizationGenerator) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Bean(org.springframework.context.annotation.Bean)

Example 3 with LdapAuthorizationProperties

use of org.apereo.cas.configuration.model.support.ldap.LdapAuthorizationProperties in project cas by apereo.

the class CasLdapUserDetailsManagerConfigurer method build.

private AuthorizationGenerator<CommonProfile> build() {
    final LdapAuthorizationProperties ldapAuthz = adminPagesSecurityProperties.getLdap().getLdapAuthz();
    final ConnectionFactory connectionFactory = Beans.newLdaptivePooledConnectionFactory(adminPagesSecurityProperties.getLdap());
    if (isGroupBasedAuthorization()) {
        LOGGER.debug("Handling LDAP authorization based on groups");
        return new LdapUserGroupsToRolesAuthorizationGenerator(connectionFactory, ldapAuthorizationGeneratorUserSearchExecutor(), ldapAuthz.isAllowMultipleResults(), ldapAuthz.getGroupAttribute(), ldapAuthz.getGroupPrefix(), ldapAuthorizationGeneratorGroupSearchExecutor());
    }
    LOGGER.debug("Handling LDAP authorization based on attributes and roles");
    return new LdapUserAttributesToRolesAuthorizationGenerator(connectionFactory, ldapAuthorizationGeneratorUserSearchExecutor(), ldapAuthz.isAllowMultipleResults(), ldapAuthz.getRoleAttribute(), ldapAuthz.getRolePrefix());
}
Also used : LdapUserAttributesToRolesAuthorizationGenerator(org.apereo.cas.authorization.LdapUserAttributesToRolesAuthorizationGenerator) LdapAuthorizationProperties(org.apereo.cas.configuration.model.support.ldap.LdapAuthorizationProperties) ConnectionFactory(org.ldaptive.ConnectionFactory) LdapUserGroupsToRolesAuthorizationGenerator(org.apereo.cas.authorization.LdapUserGroupsToRolesAuthorizationGenerator)

Aggregations

LdapAuthorizationProperties (org.apereo.cas.configuration.model.support.ldap.LdapAuthorizationProperties)3 LdapUserAttributesToRolesAuthorizationGenerator (org.apereo.cas.authorization.LdapUserAttributesToRolesAuthorizationGenerator)2 LdapUserGroupsToRolesAuthorizationGenerator (org.apereo.cas.authorization.LdapUserGroupsToRolesAuthorizationGenerator)2 ConnectionFactory (org.ldaptive.ConnectionFactory)2 AdminPagesSecurityProperties (org.apereo.cas.configuration.model.core.web.security.AdminPagesSecurityProperties)1 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)1 Bean (org.springframework.context.annotation.Bean)1