Class JwkBuilder

java.lang.Object
uk.co.spudsoft.jwtvalidatorvertx.JwkBuilder
Direct Known Subclasses:
ECJwkBuilder, EdECJwkBuilder, RSAJwkBuilder

public abstract class JwkBuilder extends Object
The JwkBuilder class is an SPI for containing the algorithm-specific conversions from Token to JWK or from JSON to JWK.
Author:
jtalbut
  • Field Details

  • Constructor Details

    • JwkBuilder

      protected JwkBuilder()
      Protected constructor used by subclasses.
  • Method Details

    • get

      public static JwkBuilder get(PublicKey publicKey)
      Get the appropriate builder for the given public key.
      Parameters:
      publicKey - The public key whose builder is being sought.
      Returns:
      A JwkBuilder able to work with the given public key.
      Throws:
      IllegalArgumentException - if now builder can be found for the provided key.
    • canHandleKey

      public abstract boolean canHandleKey(PublicKey key)
      Return true if the builder can create a JWK by generating JSON for the given PublicKey.
      Parameters:
      key - The key that that this builder is being asked about.
      Returns:
      true if the builder can create a JWK by generating JSON for the given PublicKey.
    • toJson

      public abstract io.vertx.core.json.JsonObject toJson(String kid, String algorithm, PublicKey publicKey) throws InvalidParameterSpecException, NoSuchAlgorithmException
      Convert the given public key into a valid JWK JSON representation.
      Parameters:
      kid - The ID for the key.
      algorithm - The algorithm to be used with the key.
      publicKey - The public key.
      Returns:
      The JWK representation of the key,
      Throws:
      InvalidParameterSpecException - if the security subsystem does so.
      NoSuchAlgorithmException - if the security subsystem does so.