Skip to content
This repository was archived by the owner on Apr 17, 2018. It is now read-only.

Commit 8198ef4

Browse files
committed
feat(config:auth): add configuration file for auth
1 parent 857ab8d commit 8198ef4

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

config/auth.js

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
'use strict'
2+
3+
module.exports = {
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| Authenticator
8+
|--------------------------------------------------------------------------
9+
|
10+
| Authenticator is a combination of HTTP Authentication scheme and the
11+
| serializer to be used for retrieving users. Below is the default
12+
| authenticator to be used for every request.
13+
|
14+
| Available Schemes - basic, session, jwt, api
15+
| Available Serializers - Lucid, Database
16+
|
17+
*/
18+
authenticator: 'session',
19+
20+
/*
21+
|--------------------------------------------------------------------------
22+
| Session Authenticator
23+
|--------------------------------------------------------------------------
24+
|
25+
| Session authenticator will make use of sessions to maintain the login
26+
| state for a given user.
27+
|
28+
*/
29+
session: {
30+
serializer: 'Lucid',
31+
model: 'App/Model/User',
32+
scheme: 'session',
33+
uid: 'email',
34+
password: 'password'
35+
},
36+
37+
/*
38+
|--------------------------------------------------------------------------
39+
| Basic Auth Authenticator
40+
|--------------------------------------------------------------------------
41+
|
42+
| Basic Authentication works on Http Basic auth header.
43+
|
44+
*/
45+
basicAuth: {
46+
serializer: 'Lucid',
47+
model: 'App/Model/User',
48+
scheme: 'basic',
49+
uid: 'email',
50+
password: 'password'
51+
},
52+
53+
/*
54+
|--------------------------------------------------------------------------
55+
| JWT Authenticator
56+
|--------------------------------------------------------------------------
57+
|
58+
| Jwt authentication works with a payload sent with every request under
59+
| Http Authorization header.
60+
|
61+
*/
62+
jwt: {
63+
serializer: 'Lucid',
64+
model: 'App/Model/User',
65+
scheme: 'jwt',
66+
secret: '@ref=app.appKey'
67+
},
68+
69+
/*
70+
|--------------------------------------------------------------------------
71+
| API Authenticator
72+
|--------------------------------------------------------------------------
73+
|
74+
| Api authenticator authenticates are requests based on Authorization
75+
| header.
76+
|
77+
| Make sure to define relationships on User and Token model as defined
78+
| in documentation
79+
|
80+
*/
81+
api: {
82+
serializer: 'Lucid',
83+
model: 'App/Model/Token',
84+
scheme: 'api'
85+
}
86+
87+
}

0 commit comments

Comments
 (0)