Example usage for org.springframework.security.ldap.authentication.ad ActiveDirectoryLdapAuthenticationProvider setUserDetailsContextMapper

List of usage examples for org.springframework.security.ldap.authentication.ad ActiveDirectoryLdapAuthenticationProvider setUserDetailsContextMapper

Introduction

In this page you can find the example usage for org.springframework.security.ldap.authentication.ad ActiveDirectoryLdapAuthenticationProvider setUserDetailsContextMapper.

Prototype

public void setUserDetailsContextMapper(UserDetailsContextMapper userDetailsContextMapper) 

Source Link

Document

Allows a custom strategy to be used for creating the UserDetails which will be stored as the principal in the Authentication returned by the #createSuccessfulAuthentication(org.springframework.security.authentication.UsernamePasswordAuthenticationToken,org.springframework.security.core.userdetails.UserDetails) method.

Usage

From source file:com.expedia.seiso.SeisoWebSecurityConfig.java

private void configureActiveDirectory(AuthenticationManagerBuilder auth) throws Exception {
    String domain = seisoProperties.getAdDomain();
    String url = seisoProperties.getAdUrl();
    if (domain != null) {
        ActiveDirectoryLdapAuthenticationProvider provider = new ActiveDirectoryLdapAuthenticationProvider(
                domain, url);/*from  ww w .ja v  a 2 s  .  c o  m*/
        provider.setUserDetailsContextMapper(userDetailsContextMapper());

        // Hm, this doesn't seem to have any effect, so handle the mapping in the SeisoUserDetailsContextMapper.
        //         provider.setAuthoritiesMapper(grantedAuthoritiesMapper());

        auth.authenticationProvider(provider);
    }
}