package org.argeo.security.core; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.argeo.security.ArgeoUser; import org.argeo.security.UserNature; import org.springframework.security.GrantedAuthority; import org.springframework.security.userdetails.User; public class ArgeoUserDetails extends User implements ArgeoUser { private static final long serialVersionUID = 1L; private final List userInfos; private final List roles; public ArgeoUserDetails(String username, List userInfos, String password, GrantedAuthority[] authorities) throws IllegalArgumentException { super(username, password, true, true, true, true, authorities); this.userInfos = Collections.unmodifiableList(userInfos); // Roles List roles = new ArrayList(); for (GrantedAuthority authority : getAuthorities()) { roles.add(authority.getAuthority()); } this.roles = Collections.unmodifiableList(roles); } public List getUserNatures() { return userInfos; } public List getRoles() { return roles; } }