Class Credentials

Credentials class.

Manually sets credentials. Also the base class for all credential classes.

Methods

credentials:get () Gets credentials, refreshes if required.
credentials:needsRefresh () checks whether credentials have expired.
credentials:new (opts) Constructor.
credentials:refresh () updates credentials.
credentials:set (token, expireTime) Sets credentials.


Methods

credentials:get ()
Gets credentials, refreshes if required. Returns current Azure token.

When a refresh is executed, it will be done within a semaphore to prevent many simultaneous refreshes.

Returns:

    success(true) + token + expireTime or success(false) + error
credentials:needsRefresh ()
checks whether credentials have expired.

Returns:

    boolean
credentials:new (opts)
Constructor.

Parameters:

  • opts options table
    • token string only specify if you manually specify credentials (optional)
    • expireTime number or string number of seconds since epoch, or string (rfc3339). This should not be specified. Default: If any of the 3 secrets are given; 10yrs, otherwise 0 (forcing a refresh on the first call to get). (optional)

Returns:

    new Credentials object

Usage:

    local my_creds = azure:Credentials {
      token = "token",
    }
credentials:refresh ()
updates credentials. override in subclasses, should call set to set the properties.

Returns:

    success, or nil+err
credentials:set (token, expireTime)
Sets credentials. additional to Azure SDK

Parameters:

  • token
  • expireTime (optional) number (unix epoch based), or string (valid rfc 3339)

Returns:

    true
generated by LDoc 1.5.0 Last updated 2024-03-29 13:25:29