Modifier and Type | Field and Description |
---|---|
static io.vertx.lang.rx.TypeArg<User> |
__TYPE_ARG |
Constructor and Description |
---|
User(Object delegate) |
User(User delegate) |
Modifier and Type | Method and Description |
---|---|
JsonObject |
attributes()
Gets extra attributes of the user.
|
Authorizations |
authorizations()
Returns user's authorizations that have been previously loaded by the providers.
|
User |
clearCache()
Deprecated.
|
boolean |
containsKey(String key)
Checks if a value exists on the user object.
|
static User |
create(JsonObject principal)
Factory for user instances that are free form.
|
static User |
create(JsonObject principal,
JsonObject attributes)
Factory for user instances that are free form.
|
boolean |
equals(Object o) |
boolean |
expired()
Flags this user object to be expired.
|
boolean |
expired(int leeway)
Flags this user object to be expired.
|
static User |
fromName(String username)
Factory for user instances that are single string.
|
static User |
fromToken(String token)
Factory for user instances that are single string.
|
<T> T |
get(String key)
Get a value from the user object.
|
User |
getDelegate() |
<T> T |
getOrDefault(String key,
T defaultValue)
Get a value from the user object.
|
boolean |
hasAmr(String value)
The "amr" (Authentication Methods References) returns a unique list of claims as defined and
registered in the IANA "JSON Web Token Claims" registry.
|
int |
hashCode() |
Single<Boolean> |
isAuthorized(Authorization authority)
Deprecated.
|
Single<Boolean> |
isAuthorized(String authority)
Deprecated.
|
User |
merge(User other)
Merge the principal and attributes of a second user into this object properties.
|
static User |
newInstance(User arg) |
JsonObject |
principal()
Get the underlying principal for the User.
|
Single<Boolean> |
rxIsAuthorized(Authorization authority)
Deprecated.
|
Single<Boolean> |
rxIsAuthorized(String authority)
Deprecated.
|
void |
setAuthProvider(AuthProvider authProvider)
Deprecated.
|
String |
subject()
The user subject.
|
String |
toString() |
public static final io.vertx.lang.rx.TypeArg<User> __TYPE_ARG
public User getDelegate()
public static User fromName(String username)
"username"
with the name as value.username
- the value for this userpublic static User fromToken(String token)
"access_token"
with the name as value.token
- the value for this userpublic static User create(JsonObject principal)
principal
- the free form json principalpublic static User create(JsonObject principal, JsonObject attributes)
principal
- the free form json principalattributes
- the free form json attributes that further describe the principalpublic String subject()
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 Tokensnull
.public JsonObject attributes()
public boolean expired()
true
if expiredpublic boolean expired(int leeway)
exp
"expiration" timestamp in seconds.iat
"issued at" in seconds.nbf
"not before" in seconds.attributes()
do not contain a key
then principal()
properties are checked.
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.
leeway
- a greater than zero leeway value.true
if expiredpublic <T> T get(String key)
rootClaim
the look up will happen in the attributes[rootClaim]
attributes()
principal()
null
key
- the key to look uppublic <T> T getOrDefault(String key, T defaultValue)
rootClaim
the look up will happen in the attributes[rootClaim]
attributes()
principal()
null
key
- the key to look updefaultValue
- default value to return if missingpublic boolean containsKey(String key)
rootClaim
the look up will happen in the attributes[rootClaim]
attributes()
principal()
null
key
- the key to look uppublic Authorizations authorizations()
@Deprecated public Single<Boolean> isAuthorized(Authorization authority)
authority
- the authority - what this really means is determined by the specific implementation. It might represent a permission to access a resource e.g. `printers:printer34` or it might represent authority to a role in a roles based model, e.g. `role:admin`.@Deprecated public Single<Boolean> rxIsAuthorized(Authorization authority)
authority
- the authority - what this really means is determined by the specific implementation. It might represent a permission to access a resource e.g. `printers:printer34` or it might represent authority to a role in a roles based model, e.g. `role:admin`.@Deprecated public Single<Boolean> isAuthorized(String authority)
authority
- the authority - what this really means is determined by the specific implementation. It might represent a permission to access a resource e.g. `printers:printer34` or it might represent authority to a role in a roles based model, e.g. `role:admin`.@Deprecated public Single<Boolean> rxIsAuthorized(String authority)
authority
- the authority - what this really means is determined by the specific implementation. It might represent a permission to access a resource e.g. `printers:printer34` or it might represent authority to a role in a roles based model, e.g. `role:admin`.@Deprecated public User clearCache()
public JsonObject principal()
{ "username", "tim" }
@Deprecated public void setAuthProvider(AuthProvider authProvider)
authProvider
- the AuthProvider - this must be the same type of AuthProvider that originally created the Userpublic User merge(User other)
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' ]
}
}
other
- the other user to mergepublic boolean hasAmr(String value)
value
- true
if claim is present in the principal.Copyright © 2024 Eclipse. All rights reserved.