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() |
int |
hashCode() |
User |
isAuthorized(Authorization authority)
Deprecated.
|
User |
isAuthorized(Authorization authority,
Handler<AsyncResult<Boolean>> resultHandler)
Deprecated.
|
User |
isAuthorized(String authority)
Deprecated.
|
User |
isAuthorized(String authority,
Handler<AsyncResult<Boolean>> resultHandler)
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 |
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 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 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 User isAuthorized(Authorization authority, Handler<AsyncResult<Boolean>> resultHandler)
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`.resultHandler
- handler that will be called with an AsyncResult
containing the value `true` if the they has the authority or `false` otherwise.@Deprecated public User 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 User isAuthorized(String authority, Handler<AsyncResult<Boolean>> resultHandler)
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`.resultHandler
- handler that will be called with an AsyncResult
containing the value `true` if the they has the authority or `false` otherwise.@Deprecated public User 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 mergeCopyright © 2022 Eclipse. All rights reserved.