+ UserDetails details = (UserDetails) principal;
+ String ldapprefix = "";
+ String role = details.getUsername();
+ Collection<? extends GrantedAuthority> au = details.getAuthorities();
+ for (GrantedAuthority ga : au) {
+ System.out.println("role -> " + ga.getAuthority());
+ if (ga.getAuthority().equals("ROLE_LDAP_USER")) {
+ ldapprefix = "LDAP:";
+ }
+ }
+ return ldapprefix + role;
+ }