Auth
Direct Subclass:
Authenticator/passport strategy wrapper abstraction.
I.e. it is the parent class of all auth classes.
Constructor Summary
Public Constructor | ||
public |
constructor(method: string, options: object) |
Member Summary
Public Members | ||
public |
Additional settings given to passport.authenticate. |
|
public |
Custom fields |
|
public |
Default error message to return instead of actual errors (security). |
|
public |
Default roles new registered users should assume. |
|
public |
description: * This is a standard descriptor of this authentication mechanism that is publicly shared. |
|
public |
method: * Authentication method name. |
|
public |
users: CachedCollection Users collection. |
Method Summary
Public Methods | ||
public |
async createProfileFromCredential(id: *, extra: {}): * helper method that creates a profile object from a credential address |
|
public |
createUserFromProfile(profile: Profile): User Helper method that creates an User object from a Profile |
|
public |
Helper method that finds an user based on a credential. |
|
public |
generateId(): * |
|
public |
handleUserLoginByProfile(username: string, profile: Profile, done: Function, req: Request) Helper method for SSO type logins. |
|
public abstract |
Must be overridden to provide implementation of said authentication method. |
|
public |
Helper method that produces a middleware to handle successful logged in case. |
Public Constructors
Public Members
public authenticateOptions: * source
Additional settings given to passport.authenticate.
Not directly configurable.
public defaultErrorMsg: string source
Default error message to return instead of actual errors (security).
public description: * source
This is a standard descriptor of this authentication mechanism that is publicly shared. Clients should use this to figure out how to use a login auth from outside.
Not directly configurable.
public method: * source
Authentication method name. E.g. 'email' for Email based authentication. This is used as an unique id for various things.
public users: CachedCollection source
Users collection.
Note: various things all assume that a CachedCollection is being used.
Public Methods
public async createProfileFromCredential(id: *, extra: {}): * source
helper method that creates a profile object from a credential address
Params:
Name | Type | Attribute | Description |
id | * | ||
extra | {} |
|
Return:
* |
public createUserFromProfile(profile: Profile): User source
Helper method that creates an User object from a Profile
Params:
Name | Type | Attribute | Description |
profile | Profile |
Return:
User |
public findUser(value: string): User | false source
Helper method that finds an user based on a credential.
A credential is something like an email address or a facebook user id.
This is something that uniquely identifies an account.
Params:
Name | Type | Attribute | Description |
value | string |
Return:
User | false |
public handleUserLoginByProfile(username: string, profile: Profile, done: Function, req: Request) source
Helper method for SSO type logins.
This method finds existing or creates new accounts basen on profile information returned from oauth partner.
public abstract install(app: ExpressApplication, prefix: string, passport: Passport) source
Must be overridden to provide implementation of said authentication method.
Params:
Name | Type | Attribute | Description |
app | ExpressApplication | express application |
|
prefix | string | all route prefix |
|
passport | Passport | passport class |