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:
  • for more information
  • Constructor Details

    • AbstractSecurityIdentityAssociation

      public AbstractSecurityIdentityAssociation()
  • Method Details

    • getIdentityProviderManager

      protected abstract io.quarkus.security.identity.IdentityProviderManager getIdentityProviderManager()
      Returns the IdentityProviderManager.
      Returns:
      IdentityProviderManager
    • setIdentity

      public void setIdentity(io.quarkus.security.identity.SecurityIdentity identity)
      Sets the current SecurityIdentity, replacing any previous values set by this method or setIdentity(Uni). This method should typically be called early when the CDI request context is activated and should remain unchanged during the request.
      Specified by:
      setIdentity in interface io.quarkus.security.identity.CurrentIdentityAssociation
      Parameters:
      identity - The new identity
      See Also:
      • CurrentIdentityAssociation.setIdentity(SecurityIdentity)
    • setIdentity

      public void setIdentity(io.smallrye.mutiny.Uni<io.quarkus.security.identity.SecurityIdentity> identity)
      Sets the current deferred SecurityIdentity, replacing any previous values set by this method or setIdentity(SecurityIdentity). This method should typically be called early when the CDI request context is activated and should remain unchanged during the request.
      Specified by:
      setIdentity in interface io.quarkus.security.identity.CurrentIdentityAssociation
      Parameters:
      identity - The new identity
      See Also:
      • CurrentIdentityAssociation.setIdentity(Uni)
    • getDeferredIdentity

      public io.smallrye.mutiny.Uni<io.quarkus.security.identity.SecurityIdentity> getDeferredIdentity()
      Retrieves a deferred SecurityIdentity that is resolved when the returned Uni is 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:
      getDeferredIdentity in interface io.quarkus.security.identity.CurrentIdentityAssociation
      Returns:
      SecurityIdentity; never null
      See Also:
      • CurrentIdentityAssociation.getDeferredIdentity()
    • getIdentity

      public io.quarkus.security.identity.SecurityIdentity getIdentity()
      Specified by:
      getIdentity in interface io.quarkus.security.identity.CurrentIdentityAssociation