public interface User
Please consult the documentation for a detailed explanation.
| Modifier and Type | Method and Description |
|---|---|
JsonObject |
attributes()
Gets extra attributes of the user.
|
default Authorizations |
authorizations()
returns user's authorizations
|
User |
clearCache()
The User object will cache any authorities that it knows it has to avoid hitting the
underlying auth provider each time.
|
static User |
create(JsonObject principal) |
static User |
create(JsonObject principal,
JsonObject attributes) |
default boolean |
expired()
Flags this user object to be expired.
|
default boolean |
expired(int leeway)
Flags this user object to be expired.
|
default Future<Boolean> |
isAuthorized(String authority)
Is the user authorised to
|
User |
isAuthorized(String authority,
Handler<AsyncResult<Boolean>> resultHandler)
Is the user authorised to
|
JsonObject |
principal()
Get the underlying principal for the User.
|
void |
setAuthProvider(AuthProvider authProvider)
Deprecated.
|
static User create(JsonObject principal)
static User create(JsonObject principal, JsonObject attributes)
JsonObject attributes()
default boolean expired()
true if expireddefault boolean expired(int leeway)
exp "expiration" timestamp in seconds.iat "issued at" in seconds.nbf "not before" in seconds.principal() do not contain a key
then attributes() 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 expireddefault Authorizations authorizations()
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.default Future<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`.AsyncResult containing the value
* `true` if the they has the authority or `false` otherwise.isAuthorized(String, Handler)User clearCache()
JsonObject principal()
{
"username", "tim"
}
@Deprecated void setAuthProvider(AuthProvider authProvider)
authProvider - the AuthProvider - this must be the same type of AuthProvider that originally created the UserCopyright © 2019 Eclipse. All rights reserved.