Package io.quarkus.security.spi.runtime
Class AbstractSecurityIdentityAssociation
java.lang.Object
io.quarkus.security.spi.runtime.AbstractSecurityIdentityAssociation
- All Implemented Interfaces:
io.quarkus.security.identity.CurrentIdentityAssociation
public abstract class AbstractSecurityIdentityAssociation
extends Object
implements io.quarkus.security.identity.CurrentIdentityAssociation
Base class for Quarkus built-in
CurrentIdentityAssociation implementations to prevent code duplication.
Implementations must be RequestScoped to ensure thread safety.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionio.smallrye.mutiny.Uni<io.quarkus.security.identity.SecurityIdentity> Retrieves a deferredSecurityIdentitythat is resolved when the returnedUniis subscribed.io.quarkus.security.identity.SecurityIdentityprotected abstract io.quarkus.security.identity.IdentityProviderManagerReturns theIdentityProviderManager.voidsetIdentity(io.quarkus.security.identity.SecurityIdentity identity) Sets the currentSecurityIdentity, replacing any previous values set by this method orsetIdentity(Uni).voidsetIdentity(io.smallrye.mutiny.Uni<io.quarkus.security.identity.SecurityIdentity> identity) Sets the current deferredSecurityIdentity, replacing any previous values set by this method orsetIdentity(SecurityIdentity).
-
Constructor Details
-
AbstractSecurityIdentityAssociation
public AbstractSecurityIdentityAssociation()
-
-
Method Details
-
getIdentityProviderManager
protected abstract io.quarkus.security.identity.IdentityProviderManager getIdentityProviderManager()Returns theIdentityProviderManager.- Returns:
IdentityProviderManager
-
setIdentity
public void setIdentity(io.quarkus.security.identity.SecurityIdentity identity) Sets the currentSecurityIdentity, replacing any previous values set by this method orsetIdentity(Uni). This method should typically be called early when the CDI request context is activated and should remain unchanged during the request.- Specified by:
setIdentityin interfaceio.quarkus.security.identity.CurrentIdentityAssociation- Parameters:
identity- The new identity- See Also:
-
setIdentity
public void setIdentity(io.smallrye.mutiny.Uni<io.quarkus.security.identity.SecurityIdentity> identity) Sets the current deferredSecurityIdentity, replacing any previous values set by this method orsetIdentity(SecurityIdentity). This method should typically be called early when the CDI request context is activated and should remain unchanged during the request.- Specified by:
setIdentityin interfaceio.quarkus.security.identity.CurrentIdentityAssociation- Parameters:
identity- The new identity- See Also:
-
getDeferredIdentity
public io.smallrye.mutiny.Uni<io.quarkus.security.identity.SecurityIdentity> getDeferredIdentity()Retrieves a deferredSecurityIdentitythat is resolved when the returnedUniis subscribed. Subscribing may trigger authentication if the user is not already authenticated. Quarkus Security memoizes this deferred identity, meaning authentication typically occurs only once per CDI request context. Subsequent subscriptions are cheap.- Specified by:
getDeferredIdentityin interfaceio.quarkus.security.identity.CurrentIdentityAssociation- Returns:
SecurityIdentity; never null- See Also:
-
getIdentity
public io.quarkus.security.identity.SecurityIdentity getIdentity()- Specified by:
getIdentityin interfaceio.quarkus.security.identity.CurrentIdentityAssociation
-