Namespace: AuthService

AuthService

A service that handles login and authentication on each request
Source:

Methods

(static) authenticate(token) → {Promise.<User>}

Authenticates a user based on the signed JWT token
Parameters:
Name Type Description
token String The signed user JWT token string
Source:
Returns:
Promise that eventually authenticates and resolves the user or fails
Type
Promise.<User>

(static) authorize(authenticatedUser, userId) → {Promise.<Boolean>}

Authorizes access to a user or resource owned by a user
Parameters:
Name Type Description
authenticatedUser Object The user which is currently authenticated
Properties
Name Type Description
id string The id of the user.
userId String The user id in the path to access a resource
Source:
Returns:
Promise that eventually authorizes the user and resolves a boolean or fails
Type
Promise.<Boolean>

(static) login(credentials) → {Promise.<User>}

Login a user based on the credentials
Parameters:
Name Type Description
credentials Object The user credential object containing username and password
Properties
Name Type Description
username string The username.
password string The password.
Source:
Returns:
Promise that eventually authenticates and resolves the user with JWT or fails
Type
Promise.<User>