diff options
author | 2021-08-13 00:45:01 +0530 | |
---|---|---|
committer | 2021-08-13 00:45:01 +0530 | |
commit | 2d27d5e66649d4f5baf127a53ee5ae524eae3a59 (patch) | |
tree | c592ea219ac8cd987fc367f57b54034c450ab2ab /src/internal-server/config/auth.js | |
parent | Ferdi v5.6.0 (diff) | |
parent | 5.6.1-nightly.24 [skip ci] (diff) | |
download | ferdium-app-2d27d5e66649d4f5baf127a53ee5ae524eae3a59.tar.gz ferdium-app-2d27d5e66649d4f5baf127a53ee5ae524eae3a59.tar.zst ferdium-app-2d27d5e66649d4f5baf127a53ee5ae524eae3a59.zip |
chore: merge from nightly branch into release branch in prep for next beta
Diffstat (limited to 'src/internal-server/config/auth.js')
-rw-r--r-- | src/internal-server/config/auth.js | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/src/internal-server/config/auth.js b/src/internal-server/config/auth.js new file mode 100644 index 000000000..adb38126a --- /dev/null +++ b/src/internal-server/config/auth.js | |||
@@ -0,0 +1,92 @@ | |||
1 | /** @type {import('@adonisjs/framework/src/Env')} */ | ||
2 | const Env = use('Env'); | ||
3 | |||
4 | module.exports = { | ||
5 | /* | ||
6 | |-------------------------------------------------------------------------- | ||
7 | | Authenticator | ||
8 | |-------------------------------------------------------------------------- | ||
9 | | | ||
10 | | Authentication is a combination of serializer and scheme with extra | ||
11 | | config to define on how to authenticate a user. | ||
12 | | | ||
13 | | Available Schemes - basic, session, jwt, api | ||
14 | | Available Serializers - lucid, database | ||
15 | | | ||
16 | */ | ||
17 | authenticator: 'jwt', | ||
18 | |||
19 | /* | ||
20 | |-------------------------------------------------------------------------- | ||
21 | | Session | ||
22 | |-------------------------------------------------------------------------- | ||
23 | | | ||
24 | | Session authenticator makes use of sessions to authenticate a user. | ||
25 | | Session authentication is always persistent. | ||
26 | | | ||
27 | */ | ||
28 | session: { | ||
29 | serializer: 'lucid', | ||
30 | model: 'App/Models/User', | ||
31 | scheme: 'session', | ||
32 | uid: 'email', | ||
33 | password: 'password', | ||
34 | }, | ||
35 | |||
36 | /* | ||
37 | |-------------------------------------------------------------------------- | ||
38 | | Basic Auth | ||
39 | |-------------------------------------------------------------------------- | ||
40 | | | ||
41 | | The basic auth authenticator uses basic auth header to authenticate a | ||
42 | | user. | ||
43 | | | ||
44 | | NOTE: | ||
45 | | This scheme is not persistent and users are supposed to pass | ||
46 | | login credentials on each request. | ||
47 | | | ||
48 | */ | ||
49 | basic: { | ||
50 | serializer: 'lucid', | ||
51 | model: 'App/Models/User', | ||
52 | scheme: 'basic', | ||
53 | uid: 'email', | ||
54 | password: 'password', | ||
55 | }, | ||
56 | |||
57 | /* | ||
58 | |-------------------------------------------------------------------------- | ||
59 | | Jwt | ||
60 | |-------------------------------------------------------------------------- | ||
61 | | | ||
62 | | The jwt authenticator works by passing a jwt token on each HTTP request | ||
63 | | via HTTP `Authorization` header. | ||
64 | | | ||
65 | */ | ||
66 | jwt: { | ||
67 | serializer: 'lucid', | ||
68 | model: 'App/Models/User', | ||
69 | scheme: 'jwt', | ||
70 | uid: 'email', | ||
71 | password: 'password', | ||
72 | options: { | ||
73 | secret: Env.get('APP_KEY'), | ||
74 | }, | ||
75 | }, | ||
76 | |||
77 | /* | ||
78 | |-------------------------------------------------------------------------- | ||
79 | | Api | ||
80 | |-------------------------------------------------------------------------- | ||
81 | | | ||
82 | | The Api scheme makes use of API personal tokens to authenticate a user. | ||
83 | | | ||
84 | */ | ||
85 | api: { | ||
86 | serializer: 'lucid', | ||
87 | model: 'App/Models/User', | ||
88 | scheme: 'api', | ||
89 | uid: 'email', | ||
90 | password: 'password', | ||
91 | }, | ||
92 | }; | ||