Package org.trellisldp.oauth
Class OAuthUtils
- java.lang.Object
-
- org.trellisldp.oauth.OAuthUtils
-
public final class OAuthUtils extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static AuthenticatorbuildAuthenticatorWithJwk(String location)Build an authenticator.static AuthenticatorbuildAuthenticatorWithSharedSecret(String key)Build an authenticator.static AuthenticatorbuildAuthenticatorWithTruststore(String keystorePath, char[] keystorePassword, List<String> keyids)Build an authenticator.static KeybuildRSAPublicKey(String keyType, BigInteger modulus, BigInteger exponent)Build an RSA public key.static PrincipalwithSubjectClaim(io.jsonwebtoken.Claims claims)Generate a Principal from a subject claim.static PrincipalwithWebIdClaim(io.jsonwebtoken.Claims claims)Generate a Principal from a webid claim.
-
-
-
Field Detail
-
WEBID
public static final String WEBID
- See Also:
- Constant Field Values
-
WEBSITE
public static final String WEBSITE
- See Also:
- Constant Field Values
-
-
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 modulusexponent- 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 keystorekeystorePassword- the password for a keystorekeyids- the key ids- Returns:
- an Authenticator, or null if there was an error
-
-