Class User
- java.lang.Object
-
- io.vertx.mutiny.ext.auth.User
-
public class User extends Object
Represents an authenticates User and contains operations to authorise the user.Please consult the documentation for a detailed explanation.
NOTE: This class has been automatically generated from theoriginal
non Mutiny-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<User>
__TYPE_ARG
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description io.vertx.core.json.JsonObject
attributes()
Authorizations
authorizations()
User
clearCache()
Deprecated.This method will be removed.boolean
containsKey(String key)
static User
create(io.vertx.core.json.JsonObject principal)
static User
create(io.vertx.core.json.JsonObject principal, io.vertx.core.json.JsonObject attributes)
boolean
equals(Object o)
boolean
expired()
boolean
expired(int leeway)
static User
fromName(String username)
static User
fromToken(String token)
<T> T
get(String key)
io.vertx.ext.auth.User
getDelegate()
<T> T
getOrDefault(String key, T defaultValue)
boolean
hasAmr(String value)
int
hashCode()
io.smallrye.mutiny.Uni<Boolean>
isAuthorized(Authorization authority)
Deprecated.io.smallrye.mutiny.Uni<Boolean>
isAuthorized(String authority)
Deprecated.Use typed alternative#isAuthorized(Authorization, Handler)
Boolean
isAuthorizedAndAwait(Authorization authority)
Deprecated.Boolean
isAuthorizedAndAwait(String authority)
Deprecated.Use typed alternative#isAuthorized(Authorization, Handler)
User
isAuthorizedAndForget(Authorization authority)
Deprecated.User
isAuthorizedAndForget(String authority)
Deprecated.Use typed alternative#isAuthorized(Authorization, Handler)
User
merge(User other)
static User
newInstance(io.vertx.ext.auth.User arg)
io.vertx.core.json.JsonObject
principal()
void
setAuthProvider(AuthProvider authProvider)
Deprecated.String
subject()
String
toString()
-
-
-
Constructor Detail
-
User
public User(io.vertx.ext.auth.User delegate)
-
User
public User(Object delegate)
-
-
Method Detail
-
getDelegate
public io.vertx.ext.auth.User getDelegate()
-
fromName
public static User fromName(String username)
- Parameters:
username
- the value for this user- Returns:
- user instance
-
fromToken
public static User fromToken(String token)
- Parameters:
token
- the value for this user- Returns:
- user instance
-
create
public static User create(io.vertx.core.json.JsonObject principal)
- Parameters:
principal
- the free form json principal- Returns:
- user instance
-
create
public static User create(io.vertx.core.json.JsonObject principal, io.vertx.core.json.JsonObject attributes)
- Parameters:
principal
- the free form json principalattributes
- the free form json attributes that further describe the principal- Returns:
- user instance
-
subject
public String subject()
- Returns:
- the subject for this user or
null
.
-
attributes
public io.vertx.core.json.JsonObject attributes()
- Returns:
- a json object with any relevant attribute.
-
expired
public boolean expired()
- Returns:
true
if expired
-
expired
public boolean expired(int leeway)
- Parameters:
leeway
- a greater than zero leeway value.- Returns:
true
if expired
-
get
public <T> T get(String key)
- Parameters:
key
- the key to look up- Returns:
- the value or null if missing
-
getOrDefault
public <T> T getOrDefault(String key, T defaultValue)
- Parameters:
key
- the key to look updefaultValue
- default value to return if missing- Returns:
- the value or null if missing
-
containsKey
public boolean containsKey(String key)
- Parameters:
key
- the key to look up- Returns:
- the value or null if missing
-
authorizations
public Authorizations authorizations()
- Returns:
- authorizations holder for the user.
-
isAuthorized
@CheckReturnValue @Deprecated public io.smallrye.mutiny.Uni<Boolean> isAuthorized(Authorization authority)
Deprecated.Is the user authorised toUnlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
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`.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
isAuthorizedAndAwait
@Deprecated public Boolean isAuthorizedAndAwait(Authorization authority)
Deprecated.Blocking variant ofisAuthorized(io.vertx.mutiny.ext.auth.authorization.Authorization)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
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`.- Returns:
- the Boolean instance produced by the operation.
-
isAuthorizedAndForget
@Deprecated public User isAuthorizedAndForget(Authorization authority)
Deprecated.Variant ofisAuthorized(io.vertx.mutiny.ext.auth.authorization.Authorization)
that ignores the result of the operation.This method subscribes on the result of
isAuthorized(io.vertx.mutiny.ext.auth.authorization.Authorization)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromisAuthorized(io.vertx.mutiny.ext.auth.authorization.Authorization)
but you don't need to compose it with other operations.- Parameters:
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`.- Returns:
- the instance of User to chain method calls.
-
isAuthorized
@CheckReturnValue @Deprecated public io.smallrye.mutiny.Uni<Boolean> isAuthorized(String authority)
Deprecated.Use typed alternative#isAuthorized(Authorization, Handler)
Is the user authorised toUnlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
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`.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
isAuthorizedAndAwait
@Deprecated public Boolean isAuthorizedAndAwait(String authority)
Deprecated.Use typed alternative#isAuthorized(Authorization, Handler)
Blocking variant ofisAuthorized(String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
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`.- Returns:
- the Boolean instance produced by the operation.
-
isAuthorizedAndForget
@Deprecated public User isAuthorizedAndForget(String authority)
Deprecated.Use typed alternative#isAuthorized(Authorization, Handler)
Variant ofisAuthorized(String)
that ignores the result of the operation.This method subscribes on the result of
isAuthorized(String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromisAuthorized(String)
but you don't need to compose it with other operations.- Parameters:
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`.- Returns:
- the instance of User to chain method calls.
-
clearCache
@Deprecated public User clearCache()
Deprecated.This method will be removed. UseAuthorizations#clear()
- Returns:
- the User to enable fluent use
-
principal
public io.vertx.core.json.JsonObject principal()
- Returns:
- JSON representation of the Principal
-
setAuthProvider
@Deprecated public void setAuthProvider(AuthProvider authProvider)
Deprecated.- Parameters:
authProvider
- the AuthProvider - this must be the same type of AuthProvider that originally created the User
-
merge
public User merge(User other)
- Parameters:
other
- the other user to merge- Returns:
- fluent self
-
hasAmr
public boolean hasAmr(String value)
- Parameters:
value
-- Returns:
true
if claim is present in the principal.
-
newInstance
public static User newInstance(io.vertx.ext.auth.User arg)
-
-