public interface CredentialsRefreshService
update.secret
AMQP extension
to provide new valid credentials before the current ones
expire.
New connections are registered and implementations must perform credentials renewal when appropriate. Implementations must call a registered callback once credentials are renewed.
Modifier and Type | Method and Description |
---|---|
boolean |
isApproachingExpiration(Duration timeBeforeExpiration)
Provide a hint about whether credentials should be renewed now or not before attempting to connect.
|
String |
register(CredentialsProvider credentialsProvider,
Callable<Boolean> refreshAction)
Register a new entity that needs credentials renewal.
|
void |
unregister(CredentialsProvider credentialsProvider,
String registrationId)
Unregister the entity with the given registration ID.
|
String register(CredentialsProvider credentialsProvider, Callable<Boolean> refreshAction)
The registered callback must return true if the action was performed correctly, throw an exception if something goes wrong, and return false if it became stale and wants to be unregistered.
Implementations are free to automatically unregister an entity whose callback has failed a given number of times.
credentialsProvider
- the credentials providerrefreshAction
- the action to perform after credentials renewalvoid unregister(CredentialsProvider credentialsProvider, String registrationId)
Its state is cleaned up and its registered callback will not be called again.
credentialsProvider
- the credentials providerregistrationId
- the registration IDboolean isApproachingExpiration(Duration timeBeforeExpiration)
This can avoid a connection to use almost expired credentials if this connection is created just before credentials are refreshed in the background, but does not benefit from the refresh.
timeBeforeExpiration
- Copyright © 2022 VMware, Inc. or its affiliates.. All rights reserved.