Module org.elasticsearch.xcore
Interface CloudCredentialManager
- All Known Implementing Classes:
CloudCredentialManager.Noop
public interface CloudCredentialManager
Cloud credential management for runtime handling (read and write of the active
ThreadContext)
and persistence (decoding a PersistedCloudCredential envelope into a usable
CloudCredential).-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classNo-op default used when no real implementation is loaded. -
Method Summary
Modifier and TypeMethodDescriptionextractCloudManagedCredential(ThreadContext threadContext) Extracts the caller's cloud credential fromthreadContext.booleanhasCloudManagedCredential(ThreadContext threadContext) Checks if there is a cloud credential in the thread context.voidinjectCloudManagedCredential(ThreadContext threadContext, CloudCredential credential) Injects aCloudCredentialintothreadContextso downstream actions can authenticate with it.default CloudCredentialResolverresolverOf(CloudCredential credential) Returns a resolver backed by an in-memory credential.resolverOf(PersistedCloudCredential persisted) Returns a resolver backed by a persisted credential.default ClientwrapClient(Client delegate, CloudCredential credential) Wraps client and injects the cloud credential viaresolverOf(CloudCredential).wrapClient(Client delegate, CloudCredentialResolver resolver) Returns a cloud-credentials-awareClient.default ClientwrapClient(Client delegate, PersistedCloudCredential persisted) Wraps client and injects the cloud credential viaresolverOf(PersistedCloudCredential).
-
Method Details
-
hasCloudManagedCredential
Checks if there is a cloud credential in the thread context. -
extractCloudManagedCredential
Extracts the caller's cloud credential fromthreadContext.Precondition:
hasCloudManagedCredential(ThreadContext)must returntrue; otherwise the call fails with an unchecked exception.- Returns:
- the caller's cloud credential
-
injectCloudManagedCredential
Injects aCloudCredentialintothreadContextso downstream actions can authenticate with it. -
resolverOf
Returns a resolver backed by an in-memory credential. -
resolverOf
Returns a resolver backed by a persisted credential. -
wrapClient
Returns a cloud-credentials-awareClient. On everyexecute(...)the implementation obtains aCloudCredentialfromresolver, injects it into the activeThreadContextviainjectCloudManagedCredential(org.elasticsearch.common.util.concurrent.ThreadContext, org.elasticsearch.xpack.core.security.cloud.CloudCredential), and dispatches todelegateunder that isolated context.The credential or persisted envelope captured by
resolvermust remain open for the lifetime of the returned client. -
wrapClient
Wraps client and injects the cloud credential viaresolverOf(CloudCredential). Returnsdelegatewhencredentialis null. -
wrapClient
Wraps client and injects the cloud credential viaresolverOf(PersistedCloudCredential). Returnsdelegatewhenpersistedis null.
-