Interface Session

All Known Implementing Classes:
AccessGrantSession, OpenIdSession

public interface Session
An interface for working with session objects.
  • Method Details

    • getId

      String getId()
      Retrieve the identifier associated with this session.
      Returns:
      a session identifier
    • getPrincipal

      Optional<URI> getPrincipal()
      Retrieve the principal associated with this session.

      Typically, this will be a WebID or other globally unique value

      Returns:
      the principal identifier, if present
    • supportedSchemes

      Set<String> supportedSchemes()
      Retrieve the authentication schemes supported by this session.
      Returns:
      the scheme identifiers
    • getCredential

      Optional<Credential> getCredential(URI name, URI uri)
      Retrieve a credential from this session.
      Parameters:
      name - the credential name
      uri - the request URI
      Returns:
      the credential, if present
    • fromCache

      Optional<Credential> fromCache(Request request)
      Retrieve an access token for a request from a cache.
      Parameters:
      request - the HTTP request
      Returns:
      the access token, if present
    • generateProof

      Optional<String> generateProof(String jkt, Request request)
      Generate a proof for a request.
      Parameters:
      jkt - the JSON Key thumbprint for the proof key
      request - the request
      Returns:
      a proof token
    • selectThumbprint

      Optional<String> selectThumbprint(Collection<String> algorithms)
      Select the thumbprint from a set of candidate algorithms.
      Parameters:
      algorithms - the supported algorithms
      Returns:
      the keypair thumbprint
    • reset

      void reset()
      Reset the session state, clearing any internal caches.
    • authenticate

      CompletionStage<Optional<Credential>> authenticate(Authenticator authenticator, Request request, Set<String> algorithms)
      Fetch an authentication token from session values.
      Parameters:
      authenticator - the authenticator in use
      request - the HTTP request
      algorithms - the supported DPoP algorithms
      Returns:
      the next stage of completion, containing an access token, if present
    • anonymous

      static Session anonymous()
      Create a new anonymous session.
      Returns:
      the session
      Implementation Note:
      This Session does not keep a cache of access tokens.