Interface JwksHandler

All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
JdkJwksHandler

public interface JwksHandler extends Closeable
Class for easily providing a JWKS endpoint.

The TokenBuilder was created (along with the JwksHandler to provide a simple way to test the JWT Validator.

The two can also be used to provide a simple OpenID Discovery server (which is why they are not in the test classes). An OpenID server created using TokenBuilder and JwksHandler is not fully featured, but will suffice in some circumstances.

Author:
jtalbut
  • Method Summary

    Modifier and Type
    Method
    Description
    Return the base URL that the JwksHandler is listening on.
    void
    setKeyCache(com.google.common.cache.Cache<String,AlgorithmAndKeyPair> keyCache)
    Set the key cache that the JwksHandler should use.
    void
    Start listening.

    Methods inherited from interface java.io.Closeable

    close
  • Method Details

    • getBaseUrl

      String getBaseUrl()
      Return the base URL that the JwksHandler is listening on. This value may be used directly as the issuer claim in a token.
      Returns:
      the base URL that the JwksHandler is listening on.
    • setKeyCache

      void setKeyCache(com.google.common.cache.Cache<String,AlgorithmAndKeyPair> keyCache)
      Set the key cache that the JwksHandler should use. In production use this method should be called once, in a test environment it may be called repeatedly. A JwksHandler must only access the keyCache (or anything derived from it) whilst serving an HTTP request. Between requests the JwkHandler may only hold a reference to the keyCache.
      Parameters:
      keyCache - the key cache that the JwksHandler should use.
    • start

      void start()
      Start listening.