@Beta public class GooglePublicKeysManager extends Object
Beta
The public keys are loaded from the public certificates endpoint at
getPublicCertsEncodedUrl()
and cached in this instance. Therefore, for maximum efficiency,
applications should use a single globally-shared instance of the GooglePublicKeysManager
.
Modifier and Type | Class and Description |
---|---|
static class |
GooglePublicKeysManager.Builder
|
Modifier | Constructor and Description |
---|---|
protected |
GooglePublicKeysManager(GooglePublicKeysManager.Builder builder) |
|
GooglePublicKeysManager(com.google.api.client.http.HttpTransport transport,
com.google.api.client.json.JsonFactory jsonFactory) |
Modifier and Type | Method and Description |
---|---|
com.google.api.client.util.Clock |
getClock()
Returns the clock.
|
long |
getExpirationTimeMilliseconds()
Returns the expiration time in milliseconds to be used with
Clock.currentTimeMillis()
or 0 for none. |
com.google.api.client.json.JsonFactory |
getJsonFactory()
Returns the JSON factory.
|
String |
getPublicCertsEncodedUrl()
Returns the public certificates encoded URL.
|
List<PublicKey> |
getPublicKeys()
Returns an unmodifiable view of the public keys.
|
com.google.api.client.http.HttpTransport |
getTransport()
Returns the HTTP transport.
|
GooglePublicKeysManager |
refresh()
Forces a refresh of the public certificates downloaded from
getPublicCertsEncodedUrl() . |
public GooglePublicKeysManager(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory)
transport
- HTTP transportjsonFactory
- JSON factoryprotected GooglePublicKeysManager(GooglePublicKeysManager.Builder builder)
builder
- builderpublic final com.google.api.client.http.HttpTransport getTransport()
public final com.google.api.client.json.JsonFactory getJsonFactory()
public final String getPublicCertsEncodedUrl()
public final com.google.api.client.util.Clock getClock()
public final List<PublicKey> getPublicKeys() throws GeneralSecurityException, IOException
For efficiency, an in-memory cache of the public keys is used here. If this method is called
for the first time, or the certificates have expired since last time it has been called (or are
within 5 minutes of expiring), refresh()
will be called before returning the value.
GeneralSecurityException
IOException
public final long getExpirationTimeMilliseconds()
Clock.currentTimeMillis()
or 0
for none.public GooglePublicKeysManager refresh() throws GeneralSecurityException, IOException
getPublicCertsEncodedUrl()
.
This method is automatically called from getPublicKeys()
if the public keys have not
yet been initialized or if the expiration time is very close, so normally this doesn't need to
be called. Only call this method to explicitly force the public keys to be updated.
GeneralSecurityException
IOException
Copyright © 2010–2019 Google. All rights reserved.