org.springframework.security.ldap.userdetails.InetOrgPersonContextMapper Java Examples

The following examples show how to use org.springframework.security.ldap.userdetails.InetOrgPersonContextMapper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SecurityConfig.java    From Spring-Security-Third-Edition with MIT License 6 votes vote down vote up
/**
     * Configure AuthenticationManager with inMemory credentials.
     *
     * NOTE:
     * Due to a known limitation with JavaConfig:
     * <a href="https://jira.spring.io/browse/SPR-13779">
     *     https://jira.spring.io/browse/SPR-13779</a>
     *
     * We cannot use the following to expose a {@link UserDetailsManager}
     * <pre>
     *     http.authorizeRequests()
     * </pre>
     *
     * In order to expose {@link UserDetailsManager} as a bean, we must create  @Bean
     *
     * @see {@link super.userDetailsService()}
     * @see {@link com.packtpub.springsecurity.service.DefaultCalendarService}
     *
     * @param auth       AuthenticationManagerBuilder
     * @throws Exception Authentication exception
     */
    @Override
    public void configure(final AuthenticationManagerBuilder auth) throws Exception {
        auth
                .ldapAuthentication()
                .userSearchBase("")
                .userSearchFilter("(uid={0})")
                .groupSearchBase("ou=Groups")
                .groupSearchFilter("(uniqueMember={0})")
                .userDetailsContextMapper(new InetOrgPersonContextMapper())
                .contextSource(contextSource())
//                .contextSource()
//                    .managerDn("uid=admin,ou=system")
//                    .managerPassword("secret")
//                    .url("ldap://localhost:33389/dc=jbcpcalendar,dc=com")
//                    .root("dc=jbcpcalendar,dc=com")
//                    .ldif("classpath:/ldif/calendar.ldif")
//                .and()
                    .passwordCompare()
                    // Supports {SHA} and {SSHA}
                    .passwordEncoder(new LdapShaPasswordEncoder())
                    .passwordAttribute("userPassword")
        ;
    }
 
Example #2
Source File: SecurityConfig.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
    auth
            .ldapAuthentication()
            .userSearchBase("")
            .userSearchFilter("(uid={0})")
            .groupSearchBase("ou=Groups")
            .groupSearchFilter("(uniqueMember={0})")
            .userDetailsContextMapper(new InetOrgPersonContextMapper())
            .contextSource(contextSource())
            .passwordCompare()
                .passwordAttribute("telephoneNumber")
    ;
}
 
Example #3
Source File: SecurityConfig.java    From egeria with Apache License 2.0 4 votes vote down vote up
@Bean
public InetOrgPersonContextMapper userContextMapper() {
    return new InetOrgPersonContextMapper();
}
 
Example #4
Source File: SecurityConfig.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
@Bean
public UserDetailsContextMapper userDetailsContextMapper(){
    return new InetOrgPersonContextMapper();
}
 
Example #5
Source File: SecurityConfig.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
@Bean
public UserDetailsContextMapper userDetailsContextMapper(){
    return new InetOrgPersonContextMapper();
}
 
Example #6
Source File: SecurityConfig.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
@Bean
public UserDetailsContextMapper userDetailsContextMapper(){
    return new InetOrgPersonContextMapper();
}
 
Example #7
Source File: SecurityConfig.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
@Bean
public UserDetailsContextMapper userDetailsContextMapper(){
    return new InetOrgPersonContextMapper();
}
 
Example #8
Source File: SecurityConfig.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
/**
 * Configure AuthenticationManager with inMemory credentials.
 *
 * NOTE:
 * Due to a known limitation with JavaConfig:
 * <a href="https://jira.spring.io/browse/SPR-13779">
 *     https://jira.spring.io/browse/SPR-13779</a>
 *
 * We cannot use the following to expose a {@link UserDetailsManager}
 * <pre>
 *     http.authorizeRequests()
 * </pre>
 *
 * In order to expose {@link UserDetailsManager} as a bean, we must create  @Bean
 *
 * @see {@link super.userDetailsService()}
 * @see {@link com.packtpub.springsecurity.service.DefaultCalendarService}
 *
 * @param auth       AuthenticationManagerBuilder
 * @throws Exception Authentication exception
 */
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
    auth
            .ldapAuthentication()
            .userSearchBase("")
            .userSearchFilter("(uid={0})")
            .groupSearchBase("ou=Groups")
            .groupSearchFilter("(uniqueMember={0})")
            .userDetailsContextMapper(new InetOrgPersonContextMapper())
            .contextSource(contextSource())
            .passwordCompare()
                // Supports {SHA} and {SSHA}
                .passwordEncoder(new LdapShaPasswordEncoder())
                .passwordAttribute("userPassword")
    ;
}
 
Example #9
Source File: SecurityConfig.java    From Spring-Security-Third-Edition with MIT License 3 votes vote down vote up
/**
 * Configure AuthenticationManager with inMemory credentials.
 *
 * NOTE:
 * Due to a known limitation with JavaConfig:
 * <a href="https://jira.spring.io/browse/SPR-13779">
 *     https://jira.spring.io/browse/SPR-13779</a>
 *
 * We cannot use the following to expose a {@link UserDetailsManager}
 * <pre>
 *     http.authorizeRequests()
 * </pre>
 *
 * In order to expose {@link UserDetailsManager} as a bean, we must create  @Bean
 *
 * @see {@link super.userDetailsService()}
 * @see {@link com.packtpub.springsecurity.service.DefaultCalendarService}
 *
 * @param auth       AuthenticationManagerBuilder
 * @throws Exception Authentication exception
 */
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
    auth
            .ldapAuthentication()
            .userSearchFilter("(uid={0})")
            .groupSearchBase("ou=Groups")
            .userDetailsContextMapper(new InetOrgPersonContextMapper())
            .contextSource(contextSource())
    ;
}
 
Example #10
Source File: SecurityConfig.java    From Spring-Security-Third-Edition with MIT License 3 votes vote down vote up
/**
 * Configure AuthenticationManager with inMemory credentials.
 *
 * NOTE:
 * Due to a known limitation with JavaConfig:
 * <a href="https://jira.spring.io/browse/SPR-13779">
 *     https://jira.spring.io/browse/SPR-13779</a>
 *
 * We cannot use the following to expose a {@link UserDetailsManager}
 * <pre>
 *     http.authorizeRequests()
 * </pre>
 *
 * In order to expose {@link UserDetailsManager} as a bean, we must create  @Bean
 *
 * @see {@link super.userDetailsService()}
 * @see {@link com.packtpub.springsecurity.service.DefaultCalendarService}
 *
 * @param auth       AuthenticationManagerBuilder
 * @throws Exception Authentication exception
 */
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
    auth
            .ldapAuthentication()
            .userSearchBase("")
            .userSearchFilter("(uid={0})")
            .groupSearchBase("ou=Groups")
            .groupSearchFilter("(uniqueMember={0})")
            .userDetailsContextMapper(new InetOrgPersonContextMapper())
            .contextSource(contextSource())
            .passwordCompare()
                .passwordAttribute("telephoneNumber")
    ;
}