Class AuthCredentialStore

java.lang.Object
ai.wanaku.cli.main.support.AuthCredentialStore

public class AuthCredentialStore extends Object
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 Details

    • AuthCredentialStore

      public AuthCredentialStore()
    • AuthCredentialStore

      public AuthCredentialStore(String credentialsPath)
    • AuthCredentialStore

      public AuthCredentialStore(URI credentialsUri)
  • Method Details

    • storeApiToken

      public void storeApiToken(String token)
      Stores an API token for authentication.
      Parameters:
      token - the API token to store
    • getApiToken

      public String getApiToken()
      Retrieves the stored API token.
      Returns:
      the API token, or null if not found
    • storeRefreshToken

      public void storeRefreshToken(String refreshToken)
      Stores a refresh token for token renewal.
      Parameters:
      refreshToken - the refresh token to store
    • getRefreshToken

      public String getRefreshToken()
      Retrieves the stored refresh token.
      Returns:
      the refresh token, or null if not found
    • storeAuthMode

      public void storeAuthMode(String authMode)
      Stores the authentication mode.
      Parameters:
      authMode - the authentication mode (e.g., "token", "oauth2")
    • getAuthMode

      public String getAuthMode()
      Retrieves the authentication mode.
      Returns:
      the authentication mode, or "none" if not found
    • storeAuthServerUrl

      public void storeAuthServerUrl(String serverUrl)
      Stores the authentication server URL.
      Parameters:
      serverUrl - the authentication server URL
    • getAuthServerUrl

      public String 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

      public URI getCredentialsFile()
      Gets the credentials file URI.
      Returns:
      the URI of the credentials file