Class 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 Detail

      • JWKSetParser

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

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

      • gatherHttpContentsAsync

        public Promise<JsonValue,​FailedToLoadJWKException> gatherHttpContentsAsync​(URL url)
        Uses the Client to gather HTTP information.
        Parameters:
        url - The URL from which to read the information
        Returns:
        a Promise of a JsonValue.
      • jwkSet

        public JWKSet jwkSet​(URL url)
                      throws FailedToLoadJWKException
        Deprecated.
        Use jwkSetAsync(URL) instead.
        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
      • jwkSetAsync

        public Promise<JWKSet,​FailedToLoadJWKException> jwkSetAsync​(URL url)
        Provides a JWK set as indicated by the JWKSet's URL.
        Parameters:
        url - The URL from which to gather the JWKSet
        Returns:
        a Promise of a JWKSet valid for the provider associated with this URL.
      • jwkSetToMap

        public Map<String,​Key> jwkSetToMap​(JWKSet jwkSet)
                                          throws FailedToLoadJWKException
        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