Example usage for org.springframework.security.ldap.authentication BindAuthenticator setUserAttributes

List of usage examples for org.springframework.security.ldap.authentication BindAuthenticator setUserAttributes

Introduction

In this page you can find the example usage for org.springframework.security.ldap.authentication BindAuthenticator setUserAttributes.

Prototype

public void setUserAttributes(String[] userAttributes) 

Source Link

Document

Sets the user attributes which will be retrieved from the directory.

Usage

From source file:org.osiam.configuration.LdapAuthentication.java

@Bean
public LdapAuthenticator bindAuthenticator() {
    BindAuthenticator bindAuthenticator = new BindAuthenticator(contextSource());
    bindAuthenticator.setUserDnPatterns(dnPatterns);
    bindAuthenticator
            .setUserAttributes(Iterables.toArray(ldapToScimAttributeMapping().ldapAttributes(), String.class));
    return bindAuthenticator;
}

From source file:org.osiam.auth.configuration.LdapConfiguration.java

@Bean
public OsiamLdapAuthenticationProvider createLdapAuthProvider() {
    if (isLdapConfigured) {

        createLdapToScimAttributeMapping();

        DefaultSpringSecurityContextSource contextSource = createLdapContextSource();

        BindAuthenticator bindAuthenticator = new BindAuthenticator(contextSource);
        bindAuthenticator.setUserDnPatterns(dnPatterns);
        bindAuthenticator.setUserAttributes(attributes);

        OsiamLdapUserContextMapper mapper = new OsiamLdapUserContextMapper(scimLdapAttributes);
        DefaultLdapAuthoritiesPopulator authoritiesPopulator = new DefaultLdapAuthoritiesPopulator(
                contextSource, groupSearchBase);

        OsiamLdapAuthenticationProvider provider = new OsiamLdapAuthenticationProvider(bindAuthenticator,
                authoritiesPopulator, mapper);

        authenticationManager.getProviders().add(provider);

        return provider;
    }/* w w  w .j a v a 2 s .c  om*/
    return null;
}