Skip to content

Commit c86bc2f

Browse files
committed
settings finished
1 parent 3bf548f commit c86bc2f

File tree

1 file changed

+44
-9
lines changed

1 file changed

+44
-9
lines changed

readme.md

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Below are the security settings you can use for this module. Remember you must c
4040
moduleSettings = {
4141

4242
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
4444
"invalidAuthenticationEvent" : "",
4545
// Default Auhtentication Action: override or redirect when a user has not logged in
4646
"defaultAuthenticationAction" : "redirect",
@@ -49,13 +49,16 @@ cbsecurity = {
4949
// Default Authorization Action: override or redirect when a user does not have enough permissions to access something
5050
"defaultAuthorizationAction" : "redirect",
5151
// 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.
5452
"rules" : [],
5553
// The validator is an object that will validate rules and annotations and provide feedback on either authentication or authorization issues.
5654
"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
5962
"rulesModel" : "",
6063
// If source is model, then the name of the method to get the rules, we default to `getSecurityRules`
6164
"rulesModelMethod" : "getSecurityRules",
@@ -71,14 +74,46 @@ cbsecurity = {
7174
"useRegex" : true,
7275
// Force SSL for all relocations
7376
"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
7678
"autoLoadFirewall" : true,
7779
// Activate handler/action based annotation security
7880
"handlerAnnotationSecurity" : true,
7981
// 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+
};
82117

83118
}
84119
```

0 commit comments

Comments
 (0)