Class JWKSetParser

java.lang.Object
org.forgerock.json.jose.jwk.JWKSetParser

public class JWKSetParser extends Object
Provides methods to gather a JWKSet from a URL and return a map of key ids to keys as dictated by that JWKS.
  • Constructor Details

    • JWKSetParser

      public JWKSetParser(int readTimeout, int connTimeout)
      Constructor allowing the configuration of the read and connection timeouts used by the HTTP client for this parser.
      Parameters:
      readTimeout - read timeout in ms
      connTimeout - connection timeout in ms
    • JWKSetParser

      public JWKSetParser(SimpleHTTPClient simpleHTTPClient)
      Alternative constructor allowing the calling class to pass in an already-configured SimpleHTTPClient.
      Parameters:
      simpleHTTPClient - SimpleHTTPClient used to gather HTTP information
    • JWKSetParser

      public JWKSetParser(SimpleHTTPClient simpleHTTPClient, JWKLookup jwkLookup)
      Alternative constructor allowing the calling class to pass in an already-configured SimpleHTTPClient.
      Parameters:
      simpleHTTPClient - SimpleHTTPClient used to gather HTTP information
      jwkLookup - to convert the jwk into a real key
  • Method Details

    • generateMapFromJWK

      Provides a Map of KeyId:Keys as indicated by the JWKSet's URL.
      Parameters:
      url - The URL from which to gather the JWKSet
      Returns:
      a map of currently valid KeyId:Keys for the provider associated with this URL
      Throws:
      FailedToLoadJWKException - If there are problems connecting to or parsing the response
    • jwkSet

      Provides a jwks set as indicated by the JWKSet's URL.
      Parameters:
      url - The URL from which to gather the JWKSet
      Returns:
      a jwks set valid for the provider associated with this URL
      Throws:
      FailedToLoadJWKException - If there are problems connecting to or parsing the response
    • jwkSetToMap

      Converts a supplied JWKSet into a map of key:values, where the keys are the keyIds and the values are verification keys.
      Parameters:
      jwkSet - The JWKSet to convert
      Returns:
      A map of key ids to their respective keys
      Throws:
      FailedToLoadJWKException - If there are issues parsing the JWKSet's contents