@@ -40,7 +40,7 @@ Below are the security settings you can use for this module. Remember you must c
40
40
moduleSettings = {
41
41
42
42
cbsecurity = {
43
- // The global invalid authentication event or URI or URL to go if an invalid authentication occurs
43
+ // The global invalid authentication event or URI or URL to go if an invalid authentication occurs
44
44
" invalidAuthenticationEvent" : " " ,
45
45
// Default Auhtentication Action: override or redirect when a user has not logged in
46
46
" defaultAuthenticationAction" : " redirect" ,
@@ -49,13 +49,16 @@ cbsecurity = {
49
49
// Default Authorization Action: override or redirect when a user does not have enough permissions to access something
50
50
" defaultAuthorizationAction" : " redirect" ,
51
51
// You can define your security rules here or externally via a source
52
- // This can also be a simple value: db, model or a filepath which determines where
53
- // The rules comes from.
54
52
" rules" : [],
55
53
// The validator is an object that will validate rules and annotations and provide feedback on either authentication or authorization issues.
56
54
" validator" : " CFValidator@cbsecurity" ,
57
-
58
- // If the rules has a value of `model` then this is the wirebox Id to use for retrieving the rules
55
+ // The WireBox ID of the authentication service to use in cbSecurity which must adhere to the cbsecurity.interfaces.IAuthService interface.
56
+ " authenticationService" : " authenticationService@cbauth" ,
57
+ // WireBox ID of the user service to use
58
+ " userService" : " " ,
59
+ // The name of the variable to use to store an authenticated user in prc scope if using a validator that supports it.
60
+ " prcUserVariable" : " oCurrentUser" ,
61
+ // If source is model, the wirebox Id to use for retrieving the rules
59
62
" rulesModel" : " " ,
60
63
// If source is model, then the name of the method to get the rules, we default to `getSecurityRules`
61
64
" rulesModelMethod" : " getSecurityRules" ,
@@ -71,14 +74,46 @@ cbsecurity = {
71
74
" useRegex" : true ,
72
75
// Force SSL for all relocations
73
76
" useSSL" : false ,
74
- // Auto load the global security firewall interceptor,
75
- // false if you want to load the interceptor manually.
77
+ // Auto load the global security firewall
76
78
" autoLoadFirewall" : true ,
77
79
// Activate handler/action based annotation security
78
80
" handlerAnnotationSecurity" : true ,
79
81
// Activate security rule visualizer, defaults to false by default
80
- " enableSecurityVisualizer" : false
81
- }
82
+ " enableSecurityVisualizer" : false ,
83
+ // JWT Settings
84
+ " jwt" : {
85
+ // The jwt secret encoding key, defaults to getSystemEnv( "JWT_SECRET", "" )
86
+ " secretKey" : " " ,
87
+
88
+ // by default it uses the authorization bearer header, but you can also pass a custom one as well.
89
+ " customAuthHeader" : " x-auth-token" ,
90
+
91
+ // The expiration in minutes for the jwt tokens
92
+ " expiration" : 60 ,
93
+
94
+ // If true, enables refresh tokens, longer lived tokens (not implemented yet)
95
+ " enableRefreshTokens" : false ,
96
+ // The default expiration for refresh tokens, defaults to 30 days
97
+ " refreshExpiration" : 43200 ,
98
+ // encryption algorithm to use, valid algorithms are: HS256, HS384, and HS512
99
+ " algorithm" : " HS512" ,
100
+ // Which claims neds to be present on the jwt token or `TokenInvalidException` upon verification and decoding
101
+ " requiredClaims" : [] ,
102
+ // The token storage settings
103
+ " tokenStorage" : {
104
+ // enable or not, default is true
105
+ " enabled" : true ,
106
+ // A cache key prefix to use when storing the tokens
107
+ " keyPrefix" : " cbjwt_" ,
108
+ // The driver to use: db, cachebox or a WireBox ID
109
+ " driver" : " cachebox" ,
110
+ // Driver specific properties
111
+ " properties" : {
112
+ " cacheName" : " default"
113
+ }
114
+ }
115
+ }
116
+ };
82
117
83
118
}
84
119
```
0 commit comments