@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()).append(": "); sb.append("Principal: ").append(this.getPrincipal()).append("; "); sb.append("Credentials: [PROTECTED]; "); sb.append("Authenticated: ").append(this.isAuthenticated()).append("; "); sb.append("Details: ").append(this.getDetails()).append("; "); if (!authorities.isEmpty()) { sb.append("Granted Authorities: "); int i = 0; for (GrantedAuthority authority : authorities) { if (i++ > 0) { sb.append(", "); } sb.append(authority); } } else { sb.append("Not granted any authorities"); } return sb.toString(); } }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()).append(": "); sb.append("Principal: ").append(this.getPrincipal()).append("; "); sb.append("Credentials: [PROTECTED]; "); sb.append("Authenticated: ").append(this.isAuthenticated()).append("; "); sb.append("Details: ").append(this.getDetails()).append("; "); if (!authorities.isEmpty()) { sb.append("Granted Authorities: "); int i = 0; for (GrantedAuthority authority : authorities) { if (i++ > 0) { sb.append(", "); } sb.append(authority); } } else { sb.append("Not granted any authorities"); } return sb.toString(); } }
@Override public int hashCode() { int code = 31; for (GrantedAuthority authority : authorities) { code ^= authority.hashCode(); } if (this.getPrincipal() != null) { code ^= this.getPrincipal().hashCode(); } if (this.getCredentials() != null) { code ^= this.getCredentials().hashCode(); } if (this.getDetails() != null) { code ^= this.getDetails().hashCode(); } if (this.isAuthenticated()) { code ^= -37; } return code; }
@Override public int hashCode() { int code = 31; for (GrantedAuthority authority : authorities) { code ^= authority.hashCode(); } if (this.getPrincipal() != null) { code ^= this.getPrincipal().hashCode(); } if (this.getCredentials() != null) { code ^= this.getCredentials().hashCode(); } if (this.getDetails() != null) { code ^= this.getDetails().hashCode(); } if (this.isAuthenticated()) { code ^= -37; } return code; }
return this.isAuthenticated() == test.isAuthenticated();
return this.isAuthenticated() == test.isAuthenticated();
/** * @throws IllegalArgumentException when trying to authenticate a previously unauthenticated token */ @Override public void setAuthenticated(final boolean isAuthenticated) throws IllegalArgumentException { if (!isAuthenticated) { super.setAuthenticated(false); } else if (!super.isAuthenticated()) { throw new IllegalArgumentException( "Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead"); } }
/** * @throws IllegalArgumentException when trying to authenticate a previously unauthenticated token */ @Override public void setAuthenticated(final boolean isAuthenticated) throws IllegalArgumentException { if (!isAuthenticated) { super.setAuthenticated(false); } else if (!super.isAuthenticated()) { throw new IllegalArgumentException( "Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead"); } }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()).append(": "); sb.append("Principal: ").append(this.getPrincipal()).append("; "); sb.append("Credentials: [PROTECTED]; "); sb.append("Authenticated: ").append(this.isAuthenticated()).append("; "); sb.append("Details: ").append(this.getDetails()).append("; "); if (!authorities.isEmpty()) { sb.append("Granted Authorities: "); int i = 0; for (GrantedAuthority authority: authorities) { if (i++ > 0) { sb.append(", "); } sb.append(authority); } } else { sb.append("Not granted any authorities"); } return sb.toString(); } }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()).append(": "); sb.append("Principal: ").append(this.getPrincipal()).append("; "); sb.append("Credentials: [PROTECTED]; "); sb.append("Authenticated: ").append(this.isAuthenticated()).append("; "); sb.append("Details: ").append(this.getDetails()).append("; "); if (!authorities.isEmpty()) { sb.append("Granted Authorities: "); int i = 0; for (GrantedAuthority authority : authorities) { if (i++ > 0) { sb.append(", "); } sb.append(authority); } } else { sb.append("Not granted any authorities"); } return sb.toString(); } }
@Override public int hashCode() { int code = 31; for (GrantedAuthority authority : authorities) { code ^= authority.hashCode(); } if (this.getPrincipal() != null) { code ^= this.getPrincipal().hashCode(); } if (this.getCredentials() != null) { code ^= this.getCredentials().hashCode(); } if (this.getDetails() != null) { code ^= this.getDetails().hashCode(); } if (this.isAuthenticated()) { code ^= -37; } return code; }
@Override public int hashCode() { int code = 31; for (GrantedAuthority authority : authorities) { code ^= authority.hashCode(); } if (this.getPrincipal() != null) { code ^= this.getPrincipal().hashCode(); } if (this.getCredentials() != null) { code ^= this.getCredentials().hashCode(); } if (this.getDetails() != null) { code ^= this.getDetails().hashCode(); } if (this.isAuthenticated()) { code ^= -37; } return code; }
return this.isAuthenticated() == test.isAuthenticated();
return this.isAuthenticated() == test.isAuthenticated();