Gets extra attributes of the user. Attributes contain any attributes related to the outcome of authenticating a user (e.g.: issued date, metadata, etc...)
Returns user's authorizations that have been previously loaded by the providers.
The User object will cache any authorities that it knows it has to avoid hitting the underlying auth provider each time. Use this method if you want to clear this cache.
Checks if a value exists on the user object. This method will perform lookups on several places before returning.
rootClaim
the look up will happen in the attributes[rootClaim]
null
Flags this user object to be expired. A User is considered expired if it contains an expiration time and the current clock time is post the expiration date.
Flags this user object to be expired. Expiration takes 3 values in account:
exp
"expiration" timestamp in seconds.iat
"issued at" in seconds.nbf
"not before" in seconds.If all of the properties are not available the user will not expire.
Implementations of this interface might relax this rule to account for a leeway to safeguard against clock drifting.
Get a value from the user object. This method will perform lookups on several places before returning a value.
rootClaim
the look up will happen in the attributes[rootClaim]
null
Get a value from the user object. This method will perform lookups on several places before returning a value.
rootClaim
the look up will happen in the attributes[rootClaim]
null
The "amr" (Authentication Methods References) returns a unique list of claims as defined and registered in the IANA "JSON Web Token Claims" registry. The values in this collection are based on RFC8176. This information can be used to filter authenticated users by their authentication mechanism.
Is the user authorised to
Is the user authorised to
Is the user authorised to
Is the user authorised to
Merge the principal and attributes of a second user into this object properties.
It is important to notice that the principal merges by replacing existing keys with the new values, while the attributes (as they represent decoded data) are accumulated at the root level.
This means that given:
userA = {
attributes: {
roles: [ 'read' ]
}
userB = {
attributes: {
roles: [ 'write' ]
}
}
}
When performing a merge of userA
with userB
, you will get:
userA.merge(userB);
// results in
{
attributes: {
roles: [ 'read', 'write' ]
}
}
Get the underlying principal for the User. What this actually returns depends on the implementation. For a simple user/password based auth, it's likely to contain a JSON object with the following structure:
{ "username", "tim" }
Set the auth provider for the User. This is typically used to reattach a detached User with an AuthProvider, e.g. after it has been deserialized.
The user subject. Usually a human representation that identifies this user.
The lookup for this information will take place in several places in the following order:
principal.username
- Usually for username/password or webauthn authenticationprincipal.userHandle
- Optional field for webauthnattributes.idToken.sub
- For OpenID Connect ID Tokensattributes.[rootClaim?]accessToken.sub
- For OpenID Connect/OAuth2 Access TokensFactory for user instances that are free form. The credentials will be added to the principal of this instance. As nothing can be said about the credentials no validation will be done.
Factory for user instances that are free form. The credentials will be added to the principal of this instance. As nothing can be said about the credentials no validation will be done.
Factory for user instances that are single string. The credentials will be added to the principal of this instance. As nothing can be said about the credentials no validation will be done.
Will create a principal with a property "username"
with the name as value.
Factory for user instances that are single string. The credentials will be added to the principal of this instance. As nothing can be said about the credentials no validation will be done.
Will create a principal with a property "access_token"
with the name as value.
Generated using TypeDoc
Represents an authenticates User and contains operations to authorise the user.
Please consult the documentation for a detailed explanation.