Class CachingCredentialsResolver
java.lang.Object
com.northconcepts.datapipeline.security.CachingCredentialsResolver
- All Implemented Interfaces:
CredentialsResolver
A
CredentialsResolver decorator that caches its delegate's credentials, re-fetching when:
- the cached credentials report expiry within
getExpirySkewMilliseconds()(seeCredentials.isExpired(long)), - the optional time-to-live has elapsed, or
refresh()is called.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCaches the delegate's credentials until they expire orrefresh()is called.CachingCredentialsResolver(CredentialsResolver resolver, long timeToLiveMilliseconds) Caches the delegate's credentials for at mosttimeToLiveMilliseconds(zero for no time-to-live). -
Method Summary
Modifier and TypeMethodDescriptionResolves and returns the current credentials.longReturns how long before the credentials' reported expiry they are considered stale (defaults toDEFAULT_EXPIRY_SKEW_MILLISECONDS).longReturns the maximum time cached credentials are reused before being re-fetched, in milliseconds (zero for no time-to-live); they are re-fetched sooner once they report expiry withingetExpirySkewMilliseconds().booleanIndicates if this resolver can return different credentials over time.voidrefresh()Forces a re-fetch on the next call toCredentialsResolver.getCredentials().setExpirySkewMilliseconds(long expirySkewMilliseconds) Sets how long before the credentials' reported expiry they are considered stale.toString()
-
Field Details
-
DEFAULT_EXPIRY_SKEW_MILLISECONDS
public static final long DEFAULT_EXPIRY_SKEW_MILLISECONDS- See Also:
-
-
Constructor Details
-
CachingCredentialsResolver
Caches the delegate's credentials until they expire orrefresh()is called. -
CachingCredentialsResolver
Caches the delegate's credentials for at mosttimeToLiveMilliseconds(zero for no time-to-live).
-
-
Method Details
-
getTimeToLiveMilliseconds
public long getTimeToLiveMilliseconds()Returns the maximum time cached credentials are reused before being re-fetched, in milliseconds (zero for no time-to-live); they are re-fetched sooner once they report expiry withingetExpirySkewMilliseconds(). -
getExpirySkewMilliseconds
public long getExpirySkewMilliseconds()Returns how long before the credentials' reported expiry they are considered stale (defaults toDEFAULT_EXPIRY_SKEW_MILLISECONDS). -
setExpirySkewMilliseconds
Sets how long before the credentials' reported expiry they are considered stale. Defaults toDEFAULT_EXPIRY_SKEW_MILLISECONDS. -
getCredentials
Description copied from interface:CredentialsResolverResolves and returns the current credentials. Must not returnnull.- Specified by:
getCredentialsin interfaceCredentialsResolver
-
refresh
public void refresh()Description copied from interface:CredentialsResolverForces a re-fetch on the next call toCredentialsResolver.getCredentials(). The default implementation does nothing.- Specified by:
refreshin interfaceCredentialsResolver
-
isRotating
public boolean isRotating()Description copied from interface:CredentialsResolverIndicates if this resolver can return different credentials over time. The default implementation returnsfalse.- Specified by:
isRotatingin interfaceCredentialsResolver
-
toString
-