SudoSOS Back-end API / internal/controllers / AuthenticationController
Class: AuthenticationController ​
The authentication controller is responsible for verifying user authentications and handing out json web tokens.
Extends ​
Constructors ​
Constructor ​
new AuthenticationController(options, tokenHandler): AuthenticationController;Creates a new authentication controller instance.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
options | BaseControllerOptions | The options passed to the base controller. |
tokenHandler | TokenHandler | The token handler for creating signed tokens. |
Returns ​
AuthenticationController
Overrides ​
Properties ​
| Property | Modifier | Type | Description | Inherited from |
|---|---|---|---|---|
roleManager | protected | RoleManager | A reference to the role manager passed in the base controller options. | BaseController.roleManager |
specification | public | SwaggerSpecification | A reference to the swagger specification passed in the base controller options. | BaseController.specification |
tokenHandler | protected | TokenHandler | Reference to the token handler of the application. | - |
Methods ​
createResetToken() ​
createResetToken(req, res): Promise<void>;POST /authentication/local/reset
Parameters ​
| Parameter | Type |
|---|---|
req | Request |
res | Response |
Returns ​
Promise<void>
204 - Creation success
Operation Id ​
resetLocal
Tags ​
authenticate - Operations of authentication controller
eanLogin() ​
eanLogin(req, res): Promise<void>;POST /authentication/ean
Parameters ​
| Parameter | Type |
|---|---|
req | Request |
res | Response |
Returns ​
Promise<void>
200 - The created json web token.
Deprecated ​
Use /authentication/ean-secure instead
Operation Id ​
eanAuthentication
Tags ​
authenticate - Operations of authentication controller
getJWTPublicKey() ​
getJWTPublicKey(req, res): Promise<void>;GET /authentication/public
Parameters ​
| Parameter | Type |
|---|---|
req | Request |
res | Response |
Returns ​
Promise<void>
200 - Public key
Operation Id ​
getJWTPublicKey
Tags ​
authenticate - Operations of authentication controller
getPolicy() ​
getPolicy(): Policy;Gets the policy defined by child classes. This policy includes all routes that the controller accepts, the authorization middleware, and the final handler function for every route.
Returns ​
The policy of this controller.
Overrides ​
getRouter() ​
getRouter(): Router;Returns ​
Router
the router used by this controller.
Inherited from ​
keyLogin() ​
keyLogin(req, res): Promise<void>;POST /authentication/key
Parameters ​
| Parameter | Type |
|---|---|
req | Request |
res | Response |
Returns ​
Promise<void>
200 - The created json web token.
Operation Id ​
keyAuthentication
Tags ​
authenticate - Operations of authentication controller
LDAPLogin() ​
LDAPLogin(req, res): Promise<void>;POST /authentication/LDAP
Parameters ​
| Parameter | Type |
|---|---|
req | Request |
res | Response |
Returns ​
Promise<void>
200 - The created json web token.
Operation Id ​
ldapAuthentication
Tags ​
authenticate - Operations of authentication controller
LocalLogin() ​
LocalLogin(req, res): Promise<void>;POST /authentication/local
Parameters ​
| Parameter | Type |
|---|---|
req | Request |
res | Response |
Returns ​
Promise<void>
200 - The created json web token.
Operation Id ​
localAuthentication
Tags ​
authenticate - Operations of authentication controller
mockLogin() ​
mockLogin(req, res): Promise<void>;POST /authentication/mock
Parameters ​
| Parameter | Type |
|---|---|
req | Request |
res | Response |
Returns ​
Promise<void>
200 - The created json web token.
Operation Id ​
mockAuthentication
Tags ​
authenticate - Operations of authentication controller
nfcLogin() ​
nfcLogin(req, res): Promise<void>;POST /authentication/nfc
Parameters ​
| Parameter | Type |
|---|---|
req | Request |
res | Response |
Returns ​
Promise<void>
200 - The created json web token.
Deprecated ​
Use /authentication/nfc-secure instead
Operation Id ​
nfcAuthentication
Tags ​
authenticate - Operations of authentication controller
PINLogin() ​
PINLogin(req, res): Promise<void>;POST /authentication/pin
Parameters ​
| Parameter | Type |
|---|---|
req | Request |
res | Response |
Returns ​
Promise<void>
200 - The created json web token.
Deprecated ​
Use /authentication/pin-secure instead
Operation Id ​
pinAuthentication
Tags ​
authenticate - Operations of authentication controller
resetLocalUsingToken() ​
resetLocalUsingToken(req, res): Promise<void>;PUT /authentication/local
Parameters ​
| Parameter | Type |
|---|---|
req | Request |
res | Response |
Returns ​
Promise<void>
204 - Successfully reset
Operation Id ​
resetLocalWithToken
Tags ​
authenticate - Operations of authentication controller
canPerformMock() ​
static canPerformMock(req): Promise<boolean>;Validates that the request is authorized by the policy.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
req | Request | The incoming request. |
Returns ​
Promise<boolean>
LDAPLoginConstructor() ​
static LDAPLoginConstructor(
roleManager,
tokenHandler,
onNewUser): (req, res) => Promise<void>;Constructor for the LDAP function to make it easily adaptable.
Parameters ​
| Parameter | Type |
|---|---|
roleManager | RoleManager |
tokenHandler | TokenHandler |
onNewUser | (ADUser) => Promise<User> |
Returns ​
(req, res): Promise<void>;Parameters ​
| Parameter | Type |
|---|---|
req | Request |
res | Response |
Returns ​
Promise<void>
PINLoginConstructor() ​
static PINLoginConstructor(
roleManager,
tokenHandler,
pin,
userId,
posId?): (req, res) => Promise<void>;Construct a login function for PIN. This was done such that it is easily adaptable.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
roleManager | RoleManager | - |
tokenHandler | TokenHandler | - |
pin | string | Provided PIN code |
userId | number | Provided User |
posId? | number | Optional POS identifier (only used by secure endpoints) |
Returns ​
(req, res): Promise<void>;Parameters ​
| Parameter | Type |
|---|---|
req | Request |
res | Response |
Returns ​
Promise<void>