Represents an authenticate User and contains operations to authorise the user, using a role/permission based model.
Please consult the documentation for a detailed explanation.
Type | Name and description |
---|---|
User |
delegate |
Type | Name and description |
---|---|
User |
clearCache() The User object will cache any roles or permissions that it knows it has to avoid hitting the underlying auth provider each time. |
Object |
getDelegate() |
User |
hasPermission(String permission, Handler<AsyncResult<Boolean>> resultHandler) Does the user have the specified permission? |
Map<String, Object> |
principal() Get the underlying principal for the User. |
void |
setAuthProvider(AuthProvider authProvider) Set the auth provider for the User. |
The User object will cache any roles or permissions that it knows it has to avoid hitting the underlying auth provider each time. Use this method if you want to clear this cache.
Does the user have the specified permission?
permission
- the permissionresultHandler
- handler that will be called with an io.vertx.core.AsyncResult containing the value `true` if the they have the permission or `false` otherwise.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.
authProvider
- the AuthProvider - this must be the same type of AuthProvider that originally created the Userio.vertx:vertx-auth-common:3.1.0