public interface CurrentIdentityAssociation
This interface should be implemented by a CDI bean that provides a means of associating the current identity with the running thread.
| Modifier and Type | Method and Description |
|---|---|
static SecurityIdentity |
current() |
io.smallrye.mutiny.Uni<SecurityIdentity> |
getDeferredIdentity()
Gets the (potentially lazy) security identity wrapped in a Uni.
|
SecurityIdentity |
getIdentity()
Gets the current identity.
|
void |
setIdentity(SecurityIdentity identity)
Sets the current security identity for the thread.
|
void |
setIdentity(io.smallrye.mutiny.Uni<SecurityIdentity> identity)
Sets the current deferred security identity for the thread.
|
void setIdentity(SecurityIdentity identity)
It is the responsibility of the implementation/runtime to clear the identity at the appropriate time.
In general this will be achieved by using a request scoped bean to manage the identity so it is scoped to the current request.
identity - The new identityvoid setIdentity(io.smallrye.mutiny.Uni<SecurityIdentity> identity)
Note that as Uni is lazy in some circumstances authentication will only be attempted if the Uni is subscribed to.
It is the responsibility of the implementation/runtime to clear the identity at the appropriate time.
In general this will be achieved by using a request scoped bean to manage the identity so it is scoped to the current request.
identity - The new identitySecurityIdentity getIdentity()
If a deferred identity has been set this may throw AuthenticationFailedException
if authentication fails when the Uni is resolved.
io.smallrye.mutiny.Uni<SecurityIdentity> getDeferredIdentity()
Note that as Uni is lazy in some circumstances authentication will not actually be attempted until the Uni is subscribed to.
If there is no logged in user the Uni will resolve to the anonymous identity.
static SecurityIdentity current()
Copyright © 2020 JBoss by Red Hat. All rights reserved.