AWSWebCore class implements AWS-based operations for Lemoncloud authentication logic

Implements

Constructors

Properties

config: WebCoreConfig<"aws">

The configuration for the AWS WebCore.

tokenStorage: AWSStorageService

Methods

  • Builds AWS credentials using the cached credentials from storage.

    Returns Promise<void>

    • A promise that resolves when the credentials are built.
  • Private

    Retrieves the current AWS credentials.

    Parameters

    Returns Promise<void>

    • The AWS credentials.
  • Builds AWS credentials using the cached credentials from storage.

    Returns Promise<Credentials>

    • The AWS credentials.
  • Builds AWS credentials using an OAuth token.

    Parameters

    Returns Promise<Credentials>

    • The AWS credentials.
  • Changes the user site and returns new AWS credentials.

    Parameters

    • changeSiteBody: ChangeSiteBody

      The body containing site change details.

    • Optional url: string

      Optional URL for the OAuth endpoint.

    Returns Promise<Credentials>

    • A promise that resolves to AWS credentials.

    Throws

    Will throw an error if changeSiteBody, changeSiteBody.siteId, or changeSiteBody.userId are not provided.

    Example

    const changeSiteBody = { siteId: 'newSiteId', userId: 'userId123' };
    const credentials = await changeUserSite(changeSiteBody);
  • Private

    Builds AWS credentials using an OAuth token.

    Parameters

    Returns void

    • A promise that resolves when the credentials are built.
  • Retrieves the AWS credentials.

    Returns Promise<Credentials>

    • The AWS credentials or null if no cached token exists.
  • Private

    Retrieves the current AWS credentials.

    Returns Promise<Credentials>

    • The AWS credentials.
  • Retrieves the saved tokens from the storage.

    Returns Promise<{
        [key: string]: string;
    }>

    • The saved tokens.
  • Checks if there is a cached token and refreshes it if needed. If the token should be refreshed, it refreshes the token and updates the AWS credentials. If the token is still valid, it uses the cached credentials to build AWS credentials.

    Returns Promise<AWSWebCoreState>

    • A promise that resolves to a string indicating the action taken.

    Throws

    • Throws an error if there is no cached token.
  • Refreshes the cached token.

    Parameters

    • Optional domain: string = ''

      The domain for the refresh request.

    • Optional url: string = ''

      The request url for refresh token

    Returns Promise<Credentials>

    • The AWS credentials or null if refresh fails.
  • Refreshes the cached token new version

    Parameters

    • Optional domain: string = ''

      The domain for the refresh request.

    • Optional url: string = ''

      The request url for refresh token

    Returns Promise<Credentials>

    • The AWS credentials or null if refresh fails.
  • Executes a HTTP request without Credentials.

    Type Parameters

    • T

    Parameters

    • method: string

      The HTTP method.

    • url: string

      The request URL.

    • Optional params: Params = {}

      The request parameters.

    • Optional body: Body

      The request body.

    • Optional config: AxiosRequestConfig<any>

      Additional Axios request configuration.

    Returns Promise<HttpResponse<T>>

    • The Axios response.
  • Saves the KMS (Key Management Service) details to storage.

    Parameters

    Returns Promise<void>

    • A promise that resolves when the KMS details are saved.
  • Executes a signed HTTP request.

    Type Parameters

    • T

    Parameters

    • method: string

      The HTTP method.

    • url: string

      The request URL.

    • Optional params: Params = {}

      The request parameters.

    • Optional body: Body

      The request body.

    • Optional config: AxiosRequestConfig<any>

      Additional Axios request configuration.

    Returns Promise<HttpResponse<T>>

    • The Axios response.