1.7.1 • Published 1 month ago

@universal-packages/express-controllers-authentication v1.7.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

Express Controllers Authentication

npm version Testing codecov

universal-authentication implementation on top of universal-express-controllers

Install

npm install @universal-packages/express-controllers-authentication

npm install @universal-packages/express-controllers-parameters
npm install @universal-packages/express-controllers
npm install express

Global methods

initialize(options: Object, [authenticatableClass: AuthenticatableClass])

Initialize the authentication api and the authentication controller to prepare routing configuration before the ExpressControllers runs. The authentication controller is loaded automatically by ExpressControllers.

import { initialize } from '@universal-packages/express-controllers-authentication'
import { ExpressControllers } from '@universal-packages/express-controllers'
import User from './User'

await initialize({ secret: 'my-secret' }, User)

const app = new ExpressControllers({ port: 3000 })
await app.prepare()
await app.run()

Now all authentication actions are available to access on path authentication/<action>

Options

initialize takes the same options as Authentication.

Additionally takes the following ones:

  • rootPath String default: /authentication You can set the root of all authentication routes, ex: /auth/<action>
  • routes
    • connectProvider
      • enable Boolean default: true Enables the controller to expose this action
      • path String default: connect-provider Enables the customization of the route for this action
      • method HTTPVerb default: PATCH Lets customize the method to access this action
    • continueWithProvider
      • enable Boolean default: true Enables the controller to expose this action
      • path String default: continue-with-provider Enables the customization of the route for this action
      • method HTTPVerb default: POST Lets customize the method to access this action
    • invite
      • enable Boolean default: true Enables the controller to expose this action
      • path String default: invite Enables the customization of the route for this action
      • method HTTPVerb default: PUT Lets customize the method to access this action
    • logIn
      • enable Boolean default: true Enables the controller to expose this action
      • path String default: log-in Enables the customization of the route for this action
      • method HTTPVerb default: POST Lets customize the method to access this action
    • logOut
      • enable Boolean default: true Enables the controller to expose this action
      • path String default: log-in Enables the customization of the route for this action
      • method HTTPVerb default: DELETE Lets customize the method to access this action
    • me
      • enable Boolean default: true Enables the controller to expose this action
      • path String default: log-in Enables the customization of the route for this action
      • method HTTPVerb default: GET Lets customize the method to access this action
    • requestConfirmation
      • enable Boolean default: true Enables the controller to expose this action
      • path String default: request-confirmation Enables the customization of the route for this action
      • method HTTPVerb default: PUT Lets customize the method to access this action
    • requestCorroboration
      • enable Boolean default: true Enables the controller to expose this action
      • path String default: request-corroboration Enables the customization of the route for this action
      • method HTTPVerb default: PUT Lets customize the method to access this action
    • requestMultiFactor
      • enable Boolean default: true Enables the controller to expose this action
      • path String default: request-multi-factor Enables the customization of the route for this action
      • method HTTPVerb default: PUT Lets customize the method to access this action
    • requestPasswordReset
      • enable Boolean default: true Enables the controller to expose this action
      • path String default: request-password-reset Enables the customization of the route for this action
      • method HTTPVerb default: PUT Lets customize the method to access this action
    • requestUnlock
      • enable Boolean default: true Enables the controller to expose this action
      • path String default: request-multi-factor Enables the customization of the route for this action
      • method HTTPVerb default: PUT Lets customize the method to access this action
    • sessions
      • enable Boolean default: true Enables the controller to expose this action
      • path String default: log-in Enables the customization of the route for this action
      • method HTTPVerb default: GET Lets customize the method to access this action
    • signUp
      • enable Boolean default: true Enables the controller to expose this action
      • path String default: sign-up Enables the customization of the route for this action
      • method HTTPVerb default: POST Lets customize the method to access this action
    • updateAuthenticatable
      • enable Boolean default: true Enables the controller to expose this action
      • path String default: update-authenticatable Enables the customization of the route for this action
      • method HTTPVerb default: PATCH Lets customize the method to access this action
    • updateCredential
      • enable Boolean default: true Enables the controller to expose this action
      • path String default: update-credential Enables the customization of the route for this action
      • method HTTPVerb default: PATCH Lets customize the method to access this action
    • updateSessionDeviceId
      • enable Boolean default: true Enables the controller to expose this action
      • path String Enables the customization of the route for this action
      • method HTTPVerb default: PATCH Lets customize the method to access this action
    • verifyConfirmation
      • enable Boolean default: true Enables the controller to expose this action
      • path String default: verify-confirmation Enables the customization of the route for this action
      • method HTTPVerb default: PUT Lets customize the method to access this action
    • verifyCorroboration
      • enable Boolean default: true Enables the controller to expose this action
      • path String default: verify-corroboration Enables the customization of the route for this action
      • method HTTPVerb default: PUT Lets customize the method to access this action
    • verifyMultiFactor
      • enable Boolean default: true Enables the controller to expose this action
      • path String default: verify-multi-factor Enables the customization of the route for this action
      • method HTTPVerb default: PUT Lets customize the method to access this action
    • verifyPasswordReset
      • enable Boolean default: true Enables the controller to expose this action
      • path String default: verify-password-reset Enables the customization of the route for this action
      • method HTTPVerb default: PUT Lets customize the method to access this action
    • verifyUnlock
      • enable Boolean default: true Enables the controller to expose this action
      • path String default: verify-unlock Enables the customization of the route for this action
      • method HTTPVerb default: PUT Lets customize the method to access this action

Typescript

This library is developed in TypeScript and shipped fully typed.

Contributing

The development of this library happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving this library.

License

MIT licensed.

1.7.1

1 month ago

1.7.0

1 month ago

1.6.28

2 months ago

1.6.27

2 months ago

1.6.29

2 months ago

1.6.31

2 months ago

1.6.30

2 months ago

1.6.33

2 months ago

1.6.32

2 months ago

1.6.35

2 months ago

1.6.34

2 months ago

1.6.24

2 months ago

1.6.23

2 months ago

1.6.26

2 months ago

1.6.25

2 months ago

1.6.20

3 months ago

1.6.22

3 months ago

1.6.21

3 months ago

1.6.19

3 months ago

1.6.18

3 months ago

1.6.17

4 months ago

1.6.9

8 months ago

1.6.11

7 months ago

1.6.8

8 months ago

1.6.10

7 months ago

1.6.13

7 months ago

1.6.12

7 months ago

1.6.15

7 months ago

1.6.14

7 months ago

1.6.16

7 months ago

1.6.4

11 months ago

1.6.3

11 months ago

1.6.2

11 months ago

1.6.1

12 months ago

1.6.0

12 months ago

1.5.0

12 months ago

1.6.7

11 months ago

1.6.6

11 months ago

1.6.5

11 months ago

1.2.0

1 year ago

1.4.0

12 months ago

1.3.1

1 year ago

1.2.2

1 year ago

1.3.0

1 year ago

1.2.1

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.0.2

1 year ago

1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago