Class OAuthUtils


  • public final class OAuthUtils
    extends Object
    • Method Detail

      • withWebIdClaim

        public static Principal withWebIdClaim​(io.jsonwebtoken.Claims claims)
        Generate a Principal from a webid claim.
        Parameters:
        claims - the JWT claims
        Returns:
        a Principal, if one can be generated from a webid claim
      • withSubjectClaim

        public static Principal withSubjectClaim​(io.jsonwebtoken.Claims claims)
        Generate a Principal from a subject claim.
        Parameters:
        claims - the JWT claims
        Returns:
        a Principal, if one can be generated from standard claims
      • buildAuthenticatorWithJwk

        public static Authenticator buildAuthenticatorWithJwk​(String location)
        Build an authenticator.
        Parameters:
        location - the key location
        Returns:
        an Authenticator
      • buildRSAPublicKey

        public static Key buildRSAPublicKey​(String keyType,
                                            BigInteger modulus,
                                            BigInteger exponent)
        Build an RSA public key.
        Parameters:
        keyType - the algorithm (should be "RSA")
        modulus - the modulus
        exponent - the exponent
        Returns:
        an RSA public key, if one could be successfully generated
      • buildAuthenticatorWithSharedSecret

        public static Authenticator buildAuthenticatorWithSharedSecret​(String key)
        Build an authenticator.
        Parameters:
        key - the key
        Returns:
        an Authenticator
      • buildAuthenticatorWithTruststore

        public static Authenticator buildAuthenticatorWithTruststore​(String keystorePath,
                                                                     char[] keystorePassword,
                                                                     List<String> keyids)
        Build an authenticator.
        Parameters:
        keystorePath - the path to a keystore
        keystorePassword - the password for a keystore
        keyids - the key ids
        Returns:
        an Authenticator, or null if there was an error