Slt, j'ai besoin de récupérer des données (mail,nom,prenom...) après authentification.
Je ne sais pas comment faire ça

voila le code qui permet de faire l'authentification:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
 
 
 
@Configuration 
//@Order(SecurityProperties.BASIC_AUTH_ORDER) 
public class SecurityConfig extends WebSecurityConfigurerAdapter{
 
 
 
 
         @Value("${ldap.urls}")
	private String ldapUrls;
 
	@Value("${ldap.base.dn}")
	private String ldapBaseDn;
 
	@Value("${ldap.user.dn.pattern}")
	private String ldapUserDnPattern;
 
	@Value("${ldap.enabled}")
	private String ldapEnabled;
 
 
 
        @Bean
public AuthenticationManager authenticationManagerBean() throws Exception {
    // ALTHOUGH THIS SEEMS LIKE USELESS CODE,
    // ITS REQUIRED TO PREVENT SPRING BOOT AUTO-CONFIGURATION
    return super.authenticationManagerBean();
}
 
 
 
        @Override
	protected void configure(HttpSecurity http) throws Exception {
        http
        	.authorizeRequests()
				.anyRequest().authenticated()
				.and()
			.formLogin().and().httpBasic().disable();
	}
 
    @Bean
public InetOrgPersonContextMapper userContextMapper() {
    return new InetOrgPersonContextMapper();
}
 
       @Override
	protected void configure(AuthenticationManagerBuilder auth) throws Exception {
 
             GrantedAuthoritiesMapper grantedAuthoritiesMapper = null;
 
 
			auth
				.ldapAuthentication().userDnPatterns("uid={0},ou=users")
 
				.contextSource()
					.url("ldap://localhost:10389/" + ldapBaseDn)
 
					.and()
 
                                .passwordCompare()
                    .passwordAttribute("userPassword")
                                .and()
                                .passwordEncoder(new LdapShaPasswordEncoder()).authoritiesMapper(grantedAuthoritiesMapper);
                        }
}