aboutsummaryrefslogtreecommitdiffstats
path: root/config/auth.js
diff options
context:
space:
mode:
Diffstat (limited to 'config/auth.js')
-rw-r--r--config/auth.js94
1 files changed, 94 insertions, 0 deletions
diff --git a/config/auth.js b/config/auth.js
new file mode 100644
index 0000000..c70db3f
--- /dev/null
+++ b/config/auth.js
@@ -0,0 +1,94 @@
1'use strict'
2
3/** @type {import('@adonisjs/framework/src/Env')} */
4const Env = use('Env')
5
6module.exports = {
7 /*
8 |--------------------------------------------------------------------------
9 | Authenticator
10 |--------------------------------------------------------------------------
11 |
12 | Authentication is a combination of serializer and scheme with extra
13 | config to define on how to authenticate a user.
14 |
15 | Available Schemes - basic, session, jwt, api
16 | Available Serializers - lucid, database
17 |
18 */
19 authenticator: 'jwt',
20
21 /*
22 |--------------------------------------------------------------------------
23 | Session
24 |--------------------------------------------------------------------------
25 |
26 | Session authenticator makes use of sessions to authenticate a user.
27 | Session authentication is always persistent.
28 |
29 */
30 session: {
31 serializer: 'lucid',
32 model: 'App/Models/User',
33 scheme: 'session',
34 uid: 'email',
35 password: 'password'
36 },
37
38 /*
39 |--------------------------------------------------------------------------
40 | Basic Auth
41 |--------------------------------------------------------------------------
42 |
43 | The basic auth authenticator uses basic auth header to authenticate a
44 | user.
45 |
46 | NOTE:
47 | This scheme is not persistent and users are supposed to pass
48 | login credentials on each request.
49 |
50 */
51 basic: {
52 serializer: 'lucid',
53 model: 'App/Models/User',
54 scheme: 'basic',
55 uid: 'email',
56 password: 'password'
57 },
58
59 /*
60 |--------------------------------------------------------------------------
61 | Jwt
62 |--------------------------------------------------------------------------
63 |
64 | The jwt authenticator works by passing a jwt token on each HTTP request
65 | via HTTP `Authorization` header.
66 |
67 */
68 jwt: {
69 serializer: 'lucid',
70 model: 'App/Models/User',
71 scheme: 'jwt',
72 uid: 'email',
73 password: 'password',
74 options: {
75 secret: Env.get('APP_KEY')
76 }
77 },
78
79 /*
80 |--------------------------------------------------------------------------
81 | Api
82 |--------------------------------------------------------------------------
83 |
84 | The Api scheme makes use of API personal tokens to authenticate a user.
85 |
86 */
87 api: {
88 serializer: 'lucid',
89 model: 'App/Models/User',
90 scheme: 'api',
91 uid: 'email',
92 password: 'password'
93 }
94}