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 class
TokenVerifier.PublicKeyLoader.JsonWebKey
Data class used for deserializing a single JSON Web Key.static class
TokenVerifier.PublicKeyLoader.JsonWebKeySet
Data 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 int
DEFAULT_NUMBER_OF_RETRIES
private HttpTransportFactory
httpTransportFactory
-
Constructor Summary
Constructors Constructor Description PublicKeyLoader(HttpTransportFactory httpTransportFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.security.PublicKey
buildEs256PublicKey(TokenVerifier.PublicKeyLoader.JsonWebKey key)
private java.security.PublicKey
buildPublicKey(TokenVerifier.PublicKeyLoader.JsonWebKey key)
private java.security.PublicKey
buildPublicKey(java.lang.String publicPem)
private java.security.PublicKey
buildRs256PublicKey(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:
load
in 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.NoSuchAlgorithmException
java.security.spec.InvalidParameterSpecException
java.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.CertificateException
java.io.UnsupportedEncodingException
-
buildRs256PublicKey
private java.security.PublicKey buildRs256PublicKey(TokenVerifier.PublicKeyLoader.JsonWebKey key) throws java.security.NoSuchAlgorithmException, java.security.spec.InvalidKeySpecException
- Throws:
java.security.NoSuchAlgorithmException
java.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.NoSuchAlgorithmException
java.security.spec.InvalidParameterSpecException
java.security.spec.InvalidKeySpecException
-
-