aboutsummaryrefslogtreecommitdiffstats
path: root/src/internal-server/config/auth.js
diff options
context:
space:
mode:
authorLibravatar Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com>2021-08-01 11:07:57 +0000
committerLibravatar GitHub <noreply@github.com>2021-08-01 16:37:57 +0530
commit419933f6505caf4c5e685f8436b1ff735185e55a (patch)
tree152dcb9d2b35d29f862cc57a605b9ae2a0f7c300 /src/internal-server/config/auth.js
parentRemoved duplicated contributors badge. (diff)
downloadferdium-app-419933f6505caf4c5e685f8436b1ff735185e55a.tar.gz
ferdium-app-419933f6505caf4c5e685f8436b1ff735185e55a.tar.zst
ferdium-app-419933f6505caf4c5e685f8436b1ff735185e55a.zip
Moved 'internal-server' into a sub-folder as opposed to a git submodule. (#1715)
* Ignored tests in 'internal-server' folder since there are none. * Linter fixes
Diffstat (limited to 'src/internal-server/config/auth.js')
-rw-r--r--src/internal-server/config/auth.js92
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')} */
2const Env = use('Env');
3
4module.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};