1- export default {
2- authStrategies : [ ] ,
1+ export const defaultOptions = {
2+ authStrategies : [ ] as string [ ] ,
33 jwtOptions : {
44 header : { typ : 'access' } , // by default is an access token but can be any type
55 audience : 'https://yourdomain.com' , // The resource server where the token is processed
@@ -8,3 +8,108 @@ export default {
88 expiresIn : '1d'
99 }
1010} ;
11+
12+ export const authenticationSettingsSchema = {
13+ type : 'object' ,
14+ required : [ 'secret' , 'entity' , 'authStrategies' ] ,
15+ properties : {
16+ secret : {
17+ type : 'string' ,
18+ description : 'The JWT signing secret'
19+ } ,
20+ entity : {
21+ oneOf : [ {
22+ type : 'null'
23+ } , {
24+ type : 'string'
25+ } ] ,
26+ description : 'The name of the authentication entity (e.g. user)'
27+ } ,
28+ entityId : {
29+ type : 'string' ,
30+ description : 'The name of the authentication entity id property'
31+ } ,
32+ service : {
33+ type : 'string' ,
34+ description : 'The path of the entity service'
35+ } ,
36+ authStrategies : {
37+ type : 'array' ,
38+ items : { type : 'string' } ,
39+ description : 'A list of authentication strategy names that are allowed to create JWT access tokens'
40+ } ,
41+ parseStrategies : {
42+ type : 'array' ,
43+ items : { type : 'string' } ,
44+ description : 'A list of authentication strategy names that should parse HTTP headers for authentication information (defaults to `authStrategies`)'
45+ } ,
46+ jwtOptions : {
47+ type : 'object'
48+ } ,
49+ jwt : {
50+ type : 'object' ,
51+ properties : {
52+ header : {
53+ type : 'string' ,
54+ default : 'Authorization' ,
55+ description : 'The HTTP header containing the JWT'
56+ } ,
57+ schemes : {
58+ type : 'array' ,
59+ items : { type : 'string' } ,
60+ description : 'An array of schemes to support'
61+ }
62+ }
63+ } ,
64+ local : {
65+ type : 'object' ,
66+ required : [ 'usernameField' , 'passwordField' ] ,
67+ properties : {
68+ usernameField : {
69+ type : 'string' ,
70+ description : 'Name of the username field (e.g. `email`)'
71+ } ,
72+ passwordField : {
73+ type : 'string' ,
74+ description : 'Name of the password field (e.g. `password`)'
75+ } ,
76+ hashSize : {
77+ type : 'number' ,
78+ description : 'The BCrypt salt length'
79+ } ,
80+ errorMessage : {
81+ type : 'string' ,
82+ default : 'Invalid login' ,
83+ description : 'The error message to return on errors'
84+ } ,
85+ entityUsernameField : {
86+ type : 'string' ,
87+ description : 'Name of the username field on the entity if authentication request data and entity field names are different'
88+ } ,
89+ entityPasswordField : {
90+ type : 'string' ,
91+ description : 'Name of the password field on the entity if authentication request data and entity field names are different'
92+ }
93+ }
94+ } ,
95+ oauth : {
96+ type : 'object' ,
97+ properties : {
98+ redirect : {
99+ type : 'string'
100+ } ,
101+ origins : {
102+ type : 'array' ,
103+ items : { type : 'string' }
104+ } ,
105+ defaults : {
106+ type : 'object' ,
107+ properties : {
108+ key : { type : 'string' } ,
109+ secret : { type : 'string' }
110+ }
111+ }
112+ }
113+ }
114+ }
115+ } as const ;
0 commit comments