import org.springframework.ldap.core.DirContextAdapter;
import org.springframework.ldap.core.DistinguishedName;
import org.springframework.ldap.core.LdapTemplate;
+import org.springframework.security.Authentication;
+import org.springframework.security.context.SecurityContextHolder;
import org.springframework.security.ldap.DefaultLdapUsernameToDnMapper;
import org.springframework.security.ldap.LdapAuthoritiesPopulator;
import org.springframework.security.ldap.LdapUsernameToDnMapper;
return createBasicArgeoUser(getDetails(uname));
}
+ public ArgeoUser getCurrentUser() {
+ Authentication authentication = SecurityContextHolder.getContext()
+ .getAuthentication();
+ ArgeoUser argeoUser = ArgeoUserDetails.asArgeoUser(authentication);
+ if (argeoUser.getRoles().contains(defaultRole))
+ argeoUser.getRoles().remove(defaultRole);
+ return argeoUser;
+ }
+
@SuppressWarnings("unchecked")
public List<ArgeoUser> listUsers() {
List<String> usernames = (List<String>) ldapTemplate.listBindings(
public void setUserNatureMappers(List<UserNatureMapper> userNatureMappers) {
this.userNatureMappers = userNatureMappers;
}
+
+ public String getDefaultRole() {
+ return defaultRole;
+ }
}