Class: TokenStorage

util.TokenStorage(origin, token, temporaryopt)

new TokenStorage(origin, token, temporaryopt)

Parameters:
Name Type Attributes Description
origin string

The origin where the token belongs to

token string

The initial token

temporary boolean <optional>

If the token should be saved temporary or permanently

Source:

Members

(static) GLOBAL :util.TokenStorageFactory

Type:
Source:

(static) WEB_STORAGE :util.TokenStorageFactory

Type:
Source:

temporary :boolean

Indicates if the token should keep temporary only or should be persisted for later sessions

Type:
  • boolean
Source:

token

Get the stored token

Source:

tokenData

The actual stored token

Source:

Methods

(static) parse(token) → {Object}

Parse a token string in its components

Parameters:
Name Type Description
token string

The token string to parse, time values are returned as timestamps

Source:
Returns:
Type
Object

(abstract, protected) _saveToken(origin, token, temporary) → {void}

Use the underlying storage implementation to save the token

Parameters:
Name Type Description
origin string

The origin where the token belongs to

token string

The initial token

temporary boolean

If the token should be saved temporary or permanently

Deprecated:
  • Use TokenStorage#saveToken instead
Source:
Returns:
Type
void

(abstract, protected) saveToken(origin, token, temporary) → {void}

Use the underlying storage implementation to save the token

Parameters:
Name Type Description
origin string

The origin where the token belongs to

token string

The initial token

temporary boolean

If the token should be saved temporary or permanently

Source:
Returns:
Type
void

signPath(resource) → {string}

Derives a resource token from the stored origin token and signs the resource with the generated resource token

Parameters:
Name Type Description
resource string

The resource which will be accessible with the returned token

Source:
Returns:

A resource token which can only be used to access the specified resource

Type
string

update(token) → {void}

Update the token for the givin origin, the operation may be asynchronous

Parameters:
Name Type Description
token String

The token to store or null to remove the token

Source:
Returns:
Type
void