当前位置: 首页>>代码示例>>Java>>正文


Java Beans.newLdaptivePooledConnectionFactory方法代码示例

本文整理汇总了Java中org.apereo.cas.configuration.support.Beans.newLdaptivePooledConnectionFactory方法的典型用法代码示例。如果您正苦于以下问题:Java Beans.newLdaptivePooledConnectionFactory方法的具体用法?Java Beans.newLdaptivePooledConnectionFactory怎么用?Java Beans.newLdaptivePooledConnectionFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apereo.cas.configuration.support.Beans的用法示例。


在下文中一共展示了Beans.newLdaptivePooledConnectionFactory方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: authorizationGenerator

import org.apereo.cas.configuration.support.Beans; //导入方法依赖的package包/类
@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());
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:21,代码来源:CasManagementLdapAuthorizationConfiguration.java

示例2: build

import org.apereo.cas.configuration.support.Beans; //导入方法依赖的package包/类
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());
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:21,代码来源:CasLdapUserDetailsManagerConfigurer.java

示例3: ldapSpnegoClientAction

import org.apereo.cas.configuration.support.Beans; //导入方法依赖的package包/类
@Lazy
@Bean
@RefreshScope
public Action ldapSpnegoClientAction() {
    final SpnegoProperties spnegoProperties = casProperties.getAuthn().getSpnego();
    final ConnectionFactory connectionFactory = Beans.newLdaptivePooledConnectionFactory(spnegoProperties.getLdap());
    final SearchFilter filter = Beans.newLdaptiveSearchFilter(spnegoProperties.getLdap().getSearchFilter(),
            "host", Collections.emptyList());

    final SearchRequest searchRequest = Beans.newLdaptiveSearchRequest(spnegoProperties.getLdap().getBaseDn(), filter);
    return new LdapSpnegoKnownClientSystemsFilterAction(spnegoProperties.getIpsToCheckPattern(), 
            spnegoProperties.getAlternativeRemoteHostAttribute(),
            spnegoProperties.getDnsTimeout(), 
            connectionFactory, 
            searchRequest, 
            spnegoProperties.getSpnegoAttributeName());
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:18,代码来源:SpnegoWebflowActionsConfiguration.java

示例4: surrogateAuthenticationService

import org.apereo.cas.configuration.support.Beans; //导入方法依赖的package包/类
@RefreshScope
@ConditionalOnMissingBean(name = "surrogateAuthenticationService")
@Bean
public SurrogateAuthenticationService surrogateAuthenticationService() {
    try {
        final SurrogateAuthenticationProperties su = casProperties.getAuthn().getSurrogate();
        if (su.getJson().getConfig().getLocation() != null) {
            LOGGER.debug("Using JSON resource [{}] to locate surrogate accounts", su.getJson().getConfig().getLocation());
            return new JsonResourceSurrogateAuthenticationService(su.getJson().getConfig().getLocation());
        }
        if (StringUtils.hasText(su.getLdap().getLdapUrl()) && StringUtils.hasText(su.getLdap().getSearchFilter())
                && StringUtils.hasText(su.getLdap().getBaseDn()) && StringUtils.hasText(su.getLdap().getMemberAttributeName())) {
            LOGGER.debug("Using LDAP [{}] with baseDn [{}] to locate surrogate accounts",
                    su.getLdap().getLdapUrl(), su.getLdap().getBaseDn());
            final ConnectionFactory factory = Beans.newLdaptivePooledConnectionFactory(su.getLdap());
            return new LdapSurrogateUsernamePasswordService(factory, su.getLdap());
        }

        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);
    } catch (final Exception e) {
        throw new BeanCreationException(e.getMessage(), e);
    }
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:27,代码来源:SurrogateAuthenticationConfiguration.java

示例5: acceptableUsagePolicyRepository

import org.apereo.cas.configuration.support.Beans; //导入方法依赖的package包/类
@RefreshScope
@Bean
public AcceptableUsagePolicyRepository acceptableUsagePolicyRepository() {
    final AcceptableUsagePolicyProperties.Ldap ldap = casProperties.getAcceptableUsagePolicy().getLdap();
    final ConnectionFactory connectionFactory = Beans.newLdaptivePooledConnectionFactory(ldap);
    final LdapAcceptableUsagePolicyRepository r = new LdapAcceptableUsagePolicyRepository(ticketRegistrySupport, 
            connectionFactory, ldap.getUserFilter(), ldap.getBaseDn());
    r.setAupAttributeName(casProperties.getAcceptableUsagePolicy().getAupAttributeName());
    return r;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:11,代码来源:CasSupportActionsAcceptableUsagePolicyLdapConfiguration.java

示例6: serviceRegistryDao

import org.apereo.cas.configuration.support.Beans; //导入方法依赖的package包/类
@Bean
@RefreshScope
@Autowired
public ServiceRegistryDao serviceRegistryDao(@Qualifier("ldapServiceRegistryMapper") final LdapRegisteredServiceMapper mapper) {
    final LdapServiceRegistryProperties ldap = casProperties.getServiceRegistry().getLdap();
    final ConnectionFactory connectionFactory = Beans.newLdaptivePooledConnectionFactory(ldap);

    return new LdapServiceRegistryDao(connectionFactory, ldap.getBaseDn(), mapper, ldap);
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:10,代码来源:LdapServiceRegistryConfiguration.java

示例7: pooledLdapConnectionFactoryMonitor

import org.apereo.cas.configuration.support.Beans; //导入方法依赖的package包/类
@Autowired
@Bean
public Monitor pooledLdapConnectionFactoryMonitor(@Qualifier("pooledConnectionFactoryMonitorExecutorService") final ExecutorService executor) {
    final MonitorProperties.Ldap ldap = casProperties.getMonitor().getLdap();
    final PooledConnectionFactory connectionFactory = Beans.newLdaptivePooledConnectionFactory(ldap);
    return new PooledLdapConnectionFactoryMonitor(executor, Long.valueOf(ldap.getMaxWait()).intValue(), connectionFactory, new SearchValidator());
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:8,代码来源:LdapMonitorConfiguration.java

示例8: findEmail

import org.apereo.cas.configuration.support.Beans; //导入方法依赖的package包/类
@Override
public String findEmail(final String username) {
    try {
        final PasswordManagementProperties.Ldap ldap = passwordManagementProperties.getLdap();
        final SearchFilter filter = Beans.newLdaptiveSearchFilter(ldap.getUserFilter(),
                Beans.LDAP_SEARCH_FILTER_DEFAULT_PARAM_NAME,
                Arrays.asList(username));
        LOGGER.debug("Constructed LDAP filter [{}] to locate account email", filter);

        final ConnectionFactory factory = Beans.newLdaptivePooledConnectionFactory(ldap);
        final Response<SearchResult> response = LdapUtils.executeSearchOperation(factory, ldap.getBaseDn(), filter);
        LOGGER.debug("LDAP response to locate account email is [{}]", response);

        if (LdapUtils.containsResultEntry(response)) {
            final LdapEntry entry = response.getResult().getEntry();
            LOGGER.debug("Found LDAP entry [{}] to use for the account email", entry);

            final String attributeName = passwordManagementProperties.getReset().getEmailAttribute();
            final LdapAttribute attr = entry.getAttribute(attributeName);
            if (attr != null) {
                final String email = attr.getStringValue();
                LOGGER.debug("Found email address [{}] for user [{}]. Validating...", email, username);
                if (EmailValidator.getInstance().isValid(email)) {
                    LOGGER.debug("Email address [{}] matches a valid email address", email);
                    return email;
                }
                LOGGER.error("Email [{}] is not a valid address", email);
            } else {
                LOGGER.error("Could not locate an LDAP attribute [{}] for [{}] and base DN [{}]",
                        attributeName, filter.format(), ldap.getBaseDn());
            }
            return null;
        }
        LOGGER.error("Could not locate an LDAP entry for [{}] and base DN [{}]", filter.format(), ldap.getBaseDn());
    } catch (final Exception e) {
        LOGGER.error(e.getMessage(), e);
    }
    return null;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:40,代码来源:LdapPasswordManagementService.java

示例9: change

import org.apereo.cas.configuration.support.Beans; //导入方法依赖的package包/类
@Audit(action = "CHANGE_PASSWORD",
        actionResolverName = "CHANGE_PASSWORD_ACTION_RESOLVER",
        resourceResolverName = "CHANGE_PASSWORD_RESOURCE_RESOLVER")
@Override
public boolean change(final Credential credential, final PasswordChangeBean bean) {
    Assert.notNull(credential, "Credential cannot be null");
    Assert.notNull(bean, "PasswordChangeBean cannot be null");

    try {
        final PasswordManagementProperties.Ldap ldap = passwordManagementProperties.getLdap();
        final UsernamePasswordCredential c = (UsernamePasswordCredential) credential;

        final SearchFilter filter = Beans.newLdaptiveSearchFilter(ldap.getUserFilter(),
                Beans.LDAP_SEARCH_FILTER_DEFAULT_PARAM_NAME,
                Arrays.asList(c.getId()));
        LOGGER.debug("Constructed LDAP filter [{}] to update account password", filter);

        final ConnectionFactory factory = Beans.newLdaptivePooledConnectionFactory(ldap);
        final Response<SearchResult> response = LdapUtils.executeSearchOperation(factory, ldap.getBaseDn(), filter);
        LOGGER.debug("LDAP response to update password is [{}]", response);

        if (LdapUtils.containsResultEntry(response)) {
            final String dn = response.getResult().getEntry().getDn();
            LOGGER.debug("Updating account password for [{}]", dn);
            if (LdapUtils.executePasswordModifyOperation(dn, factory, c.getPassword(), bean.getPassword(),
                    passwordManagementProperties.getLdap().getType())) {
                LOGGER.debug("Successfully updated the account password for [{}]", dn);
                return true;
            }
            LOGGER.error("Could not update the LDAP entry's password for [{}] and base DN [{}]", filter.format(), ldap.getBaseDn());
        } else {
            LOGGER.error("Could not locate an LDAP entry for [{}] and base DN [{}]", filter.format(), ldap.getBaseDn());
        }
    } catch (final Exception e) {
        LOGGER.error(e.getMessage(), e);
    }
    return false;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:39,代码来源:LdapPasswordManagementService.java

示例10: getSecurityQuestions

import org.apereo.cas.configuration.support.Beans; //导入方法依赖的package包/类
@Override
public Map<String, String> getSecurityQuestions(final String username) {
    final Map<String, String> set = new LinkedHashMap<>();
    try {
        final PasswordManagementProperties.Ldap ldap = passwordManagementProperties.getLdap();
        final SearchFilter filter = Beans.newLdaptiveSearchFilter(ldap.getUserFilter(),
                Beans.LDAP_SEARCH_FILTER_DEFAULT_PARAM_NAME,
                Arrays.asList(username));
        LOGGER.debug("Constructed LDAP filter [{}] to locate security questions", filter);

        final ConnectionFactory factory = Beans.newLdaptivePooledConnectionFactory(ldap);
        final Response<SearchResult> response = LdapUtils.executeSearchOperation(factory, ldap.getBaseDn(), filter);
        LOGGER.debug("LDAP response for security questions [{}]", response);

        if (LdapUtils.containsResultEntry(response)) {
            final LdapEntry entry = response.getResult().getEntry();
            LOGGER.debug("Located LDAP entry [{}] in the response", entry);
            final Map<String, String> qs = passwordManagementProperties.getLdap().getSecurityQuestionsAttributes();
            LOGGER.debug("Security question attributes are defined to be [{}]", qs);

            qs.forEach((k, v) -> {
                final LdapAttribute q = entry.getAttribute(k);
                final LdapAttribute a = entry.getAttribute(v);
                if (q != null && a != null && StringUtils.isNotBlank(q.getStringValue())
                        && StringUtils.isNotBlank(a.getStringValue())) {
                    LOGGER.debug("Added security question [{}]", q.getStringValue());
                    set.put(q.getStringValue(), a.getStringValue());
                }
            });
        } else {
            LOGGER.debug("LDAP response did not contain a result for security questions");
        }
    } catch (final Exception e) {
        LOGGER.error(e.getMessage(), e);
    }
    return set;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:38,代码来源:LdapPasswordManagementService.java


注:本文中的org.apereo.cas.configuration.support.Beans.newLdaptivePooledConnectionFactory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。