Class InMemoryContextCredentialService
java.lang.Object
org.a2aproject.sdk.client.transport.spi.interceptors.auth.InMemoryContextCredentialService
- All Implemented Interfaces:
CredentialService
A simple in-memory store for session-keyed credentials.
This class uses the 'sessionId' from the
ClientCallContext state to
store and retrieve credentials-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable StringgetCredential(String securitySchemeName, @Nullable ClientCallContext clientCallContext) Retrieves a credential (e.g., token) for a security scheme.voidsetCredential(String sessionId, String securitySchemeName, String credential) Method to populate the in-memory credential service.
-
Constructor Details
-
InMemoryContextCredentialService
public InMemoryContextCredentialService()
-
-
Method Details
-
getCredential
public @Nullable String getCredential(String securitySchemeName, @Nullable ClientCallContext clientCallContext) Description copied from interface:CredentialServiceRetrieves a credential (e.g., token) for a security scheme.- Specified by:
getCredentialin interfaceCredentialService- Parameters:
securitySchemeName- the name of the security schemeclientCallContext- the client call context, which may benull.- Returns:
- the credential or
nullif the credential could not be retrieved
-
setCredential
Method to populate the in-memory credential service.- Parameters:
sessionId- the session IDsecuritySchemeName- the name of the security schemecredential- the credential string
-