*/
package org.argeo.security;
-import org.springframework.security.GrantedAuthority;
-import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
+import java.util.Collection;
+
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.GrantedAuthority;
/** Credentials required for the authentication to a node. */
public class NodeAuthenticationToken extends
/** Authenticated constructor */
public NodeAuthenticationToken(NodeAuthenticationToken sat,
- GrantedAuthority[] authorities) {
+ Collection<? extends GrantedAuthority> authorities) {
super(sat.getPrincipal(), sat.getCredentials(), authorities);
this.url = sat.getUrl();
}
public Boolean isRemote() {
return url != null;
}
+
+ public String toString() {
+ String username = getName();
+ StringBuilder buf = new StringBuilder("groups=");
+ for (GrantedAuthority ga : getAuthorities()) {
+ if (!ga.getAuthority().equals(username)) {
+ buf.append(ga.getAuthority());
+ buf.append(',');
+ }
+ }
+ buf.deleteCharAt(buf.length() - 1);
+ return "uid=" + getName() + " " + buf.toString();
+ }
}