Package ai.wanaku.cli.main.support
Class AuthCredentialStore
java.lang.Object
ai.wanaku.cli.main.support.AuthCredentialStore
A credential store specifically designed for CLI authentication.
Handles secure storage and retrieval of authentication credentials
such as API tokens, refresh tokens, and authentication configuration.
-
Constructor Summary
ConstructorsConstructorDescriptionAuthCredentialStore(String credentialsPath) AuthCredentialStore(URI credentialsUri) -
Method Summary
Modifier and TypeMethodDescriptionvoidClears all stored credentials.Retrieves the stored API token.Retrieves the authentication mode.Retrieves the authentication server URL.Gets the credentials file URI.Retrieves the stored refresh token.booleanChecks if any credentials are stored.voidstoreApiToken(String token) Stores an API token for authentication.voidstoreAuthMode(String authMode) Stores the authentication mode.voidstoreAuthServerUrl(String serverUrl) Stores the authentication server URL.voidstoreRefreshToken(String refreshToken) Stores a refresh token for token renewal.
-
Constructor Details
-
AuthCredentialStore
public AuthCredentialStore() -
AuthCredentialStore
-
AuthCredentialStore
-
-
Method Details
-
storeApiToken
Stores an API token for authentication.- Parameters:
token- the API token to store
-
getApiToken
Retrieves the stored API token.- Returns:
- the API token, or null if not found
-
storeRefreshToken
Stores a refresh token for token renewal.- Parameters:
refreshToken- the refresh token to store
-
getRefreshToken
Retrieves the stored refresh token.- Returns:
- the refresh token, or null if not found
-
storeAuthMode
Stores the authentication mode.- Parameters:
authMode- the authentication mode (e.g., "token", "oauth2")
-
getAuthMode
Retrieves the authentication mode.- Returns:
- the authentication mode, or "none" if not found
-
storeAuthServerUrl
Stores the authentication server URL.- Parameters:
serverUrl- the authentication server URL
-
getAuthServerUrl
Retrieves the authentication server URL.- Returns:
- the authentication server URL, or null if not found
-
clearCredentials
public void clearCredentials()Clears all stored credentials. -
hasCredentials
public boolean hasCredentials()Checks if any credentials are stored.- Returns:
- true if credentials exist, false otherwise
-
getCredentialsFile
Gets the credentials file URI.- Returns:
- the URI of the credentials file
-