Record Class UserToken
java.lang.Object
java.lang.Record
org.alfresco.repo.security.authentication.identityservice.UserToken
- All Implemented Interfaces:
Serializable
public record UserToken(String normalizedUsername, String tokenString)
extends Record
implements Serializable
Result of a successful user authentication against the Identity Service.
Carries the normalized principal name (the canonical user identifier resolved by the IdP, which may differ from the credentials supplied by the caller) and the access-token string returned by the IdP. The token is exposed so that components (e.g., a caching UserTokenProvider) can re-validate it locally without contacting the IdP again.
Bearer-credential handling: tokenString() returns a bearer credential. Callers MUST NOT log, persist, or replicate it across processes. toString() is deliberately overridden to omit the token (the record-default would echo every component) so that accidental logger.debug(token) calls cannot leak the credential.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thenormalizedUsernamerecord component.Returns the value of thetokenStringrecord component.toString()Overrides the record-generatedtoString()to suppress the bearer token.
-
Constructor Details
-
UserToken
Creates an instance of aUserTokenrecord class.- Parameters:
normalizedUsername- the value for thenormalizedUsernamerecord componenttokenString- the value for thetokenStringrecord component
-
-
Method Details
-
toString
Overrides the record-generatedtoString()to suppress the bearer token. Only the principal name is exposed so accidental log/print statements cannot leak the credential. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
normalizedUsername
Returns the value of thenormalizedUsernamerecord component.- Returns:
- the value of the
normalizedUsernamerecord component
-
tokenString
Returns the value of thetokenStringrecord component.- Returns:
- the value of the
tokenStringrecord component
-