Package com.google.auth.oauth2
Class TokenVerifier.PublicKeyLoader
- java.lang.Object
-
- com.google.common.cache.CacheLoader<java.lang.String,java.util.Map<java.lang.String,java.security.PublicKey>>
-
- com.google.auth.oauth2.TokenVerifier.PublicKeyLoader
-
- Enclosing class:
- TokenVerifier
static class TokenVerifier.PublicKeyLoader extends com.google.common.cache.CacheLoader<java.lang.String,java.util.Map<java.lang.String,java.security.PublicKey>>Custom CacheLoader for mapping certificate urls to the contained public keys.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTokenVerifier.PublicKeyLoader.JsonWebKeyData class used for deserializing a single JSON Web Key.static classTokenVerifier.PublicKeyLoader.JsonWebKeySetData class used for deserializing a JSON Web Key Set (JWKS) from an external HTTP request.
-
Field Summary
Fields Modifier and Type Field Description private static intDEFAULT_NUMBER_OF_RETRIESprivate HttpTransportFactoryhttpTransportFactory
-
Constructor Summary
Constructors Constructor Description PublicKeyLoader(HttpTransportFactory httpTransportFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.security.PublicKeybuildEs256PublicKey(TokenVerifier.PublicKeyLoader.JsonWebKey key)private java.security.PublicKeybuildPublicKey(TokenVerifier.PublicKeyLoader.JsonWebKey key)private java.security.PublicKeybuildPublicKey(java.lang.String publicPem)private java.security.PublicKeybuildRs256PublicKey(TokenVerifier.PublicKeyLoader.JsonWebKey key)java.util.Map<java.lang.String,java.security.PublicKey>load(java.lang.String certificateUrl)
-
-
-
Field Detail
-
DEFAULT_NUMBER_OF_RETRIES
private static final int DEFAULT_NUMBER_OF_RETRIES
- See Also:
- Constant Field Values
-
httpTransportFactory
private final HttpTransportFactory httpTransportFactory
-
-
Constructor Detail
-
PublicKeyLoader
PublicKeyLoader(HttpTransportFactory httpTransportFactory)
-
-
Method Detail
-
load
public java.util.Map<java.lang.String,java.security.PublicKey> load(java.lang.String certificateUrl) throws java.lang.Exception- Specified by:
loadin classcom.google.common.cache.CacheLoader<java.lang.String,java.util.Map<java.lang.String,java.security.PublicKey>>- Throws:
java.lang.Exception
-
buildPublicKey
private java.security.PublicKey buildPublicKey(TokenVerifier.PublicKeyLoader.JsonWebKey key) throws java.security.NoSuchAlgorithmException, java.security.spec.InvalidParameterSpecException, java.security.spec.InvalidKeySpecException
- Throws:
java.security.NoSuchAlgorithmExceptionjava.security.spec.InvalidParameterSpecExceptionjava.security.spec.InvalidKeySpecException
-
buildPublicKey
private java.security.PublicKey buildPublicKey(java.lang.String publicPem) throws java.security.cert.CertificateException, java.io.UnsupportedEncodingException- Throws:
java.security.cert.CertificateExceptionjava.io.UnsupportedEncodingException
-
buildRs256PublicKey
private java.security.PublicKey buildRs256PublicKey(TokenVerifier.PublicKeyLoader.JsonWebKey key) throws java.security.NoSuchAlgorithmException, java.security.spec.InvalidKeySpecException
- Throws:
java.security.NoSuchAlgorithmExceptionjava.security.spec.InvalidKeySpecException
-
buildEs256PublicKey
private java.security.PublicKey buildEs256PublicKey(TokenVerifier.PublicKeyLoader.JsonWebKey key) throws java.security.NoSuchAlgorithmException, java.security.spec.InvalidParameterSpecException, java.security.spec.InvalidKeySpecException
- Throws:
java.security.NoSuchAlgorithmExceptionjava.security.spec.InvalidParameterSpecExceptionjava.security.spec.InvalidKeySpecException
-
-