Interface SecurityContext<P extends Principal>

Type Parameters:
P - type of principal used by the implementation, this common interface uses Java security Principal
All Known Subinterfaces:
SecurityContext

public interface SecurityContext<P extends Principal>
Security context. Can be obtained either from context, or from APIs of Helidon components.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Return true if the user is authenticated.
    boolean
    Return true if authorization was handled for current context.
    Service principal if service is authenticated.
    User principal if user is authenticated.
  • Method Details

    • isAuthenticated

      boolean isAuthenticated()
      Return true if the user is authenticated. This only cares about USER! not about service. To check if service is authenticated, use servicePrincipal() and check the resulting optional.
      Returns:
      true for authenticated user
    • isAuthorized

      boolean isAuthorized()
      Return true if authorization was handled for current context.
      Returns:
      true for authorized requests
    • userPrincipal

      Optional<P> userPrincipal()
      User principal if user is authenticated.
      Returns:
      current context user principal, or empty if none authenticated
    • servicePrincipal

      Optional<P> servicePrincipal()
      Service principal if service is authenticated.
      Returns:
      current context service principal, or empty if none authenticated