Class: Security

Security

new Security()

Represents a security client for the Jira Connector

Properties:
Name Type Description
settings ISecurity
secret ISecurity.secret

to use

Source:

Methods

decrypt(data, secret) → {string}

decrypt the supplied data using an optional secret

Parameters:
Name Type Description
data string

The data to be encrypted

secret string

The secret to use (defaults to class secret)

Source:
Returns:

the decrypted data

Type
string

encrypt(data, secret) → {string}

encrypt the supplied data using an optional secret

Parameters:
Name Type Description
data string

The data to be encrypted

secret string

The secret to use (defaults to class secret)

Source:
Returns:

the encrypted data

Type
string

generateToken(data, secret) → {string}

generate a JWT using data and an optional secret

Parameters:
Name Type Description
data *

The data to be stored in the JWT

secret string

The secret to use (defaults to class secret)

Source:
Returns:

the compacted jwt

Type
string

getSessionId(token, secret) → {string}

get the decrypted sessionid from a token

Parameters:
Name Type Description
token string

The token to store

secret string

The secret to use (defaults to class secret)

Source:
Returns:

the auth string

Type
string

getToken() → {string}

get a previouly stored token

Source:
Returns:

the stored jwt

Type
string

removeToken() → {boolean}

remove a default token

Source:
Returns:

result true if a stored token was removed, false if there was no token to remove

Type
boolean

setToken(token) → {string}

set a default token only jwt tokens are allowed only tokens sealed with the same secret as the parameter or default key are allowed

Parameters:
Name Type Description
token string

The token to store

Source:
Returns:

the stored jwt

Type
string

validateToken(data, secret) → {*}

validate the supplied JWT using an optional secret

Parameters:
Name Type Description
data *

The JWT to be validated

secret string

The secret to use (defaults to class secret)

Source:
Returns:

the jwt.body property

Type
*