File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -69,15 +69,12 @@ component {
6969 " enableSecurityVisualizer" : false ,
7070 // JWT Settings
7171 " jwt" : {
72- // The jwt secret encoding key, defaults to getSystemEnv( "JWT_SECRET", "" )
73- " secretKey" : " " ,
74-
75- // by default it uses the authorization bearer header, but you can also pass a custom one as well.
72+ // The jwt secret encoding key to use
73+ " secretKey" : getSystemSetting ( " JWT_SECRET" , " " ),
74+ // by default it uses the authorization bearer header, but you can also pass a custom one as well or as an rc variable.
7675 " customAuthHeader" : " x-auth-token" ,
77-
7876 // The expiration in minutes for the jwt tokens
7977 " expiration" : 60 ,
80-
8178 // If true, enables refresh tokens, longer lived tokens (not implemented yet)
8279 " enableRefreshTokens" : false ,
8380 // The default expiration for refresh tokens, defaults to 30 days
Original file line number Diff line number Diff line change @@ -40,6 +40,20 @@ component accessors="true" singleton{
4040 return this ;
4141 }
4242
43+ /**
44+ * Runs after DI
45+ */
46+ function onDIComplete (){
47+ // Verify a few settings just in case
48+ if ( isNull ( variables .settings .jwt .secretKey ) || ! len ( variables .settings .jwt .secretKey ) ){
49+ throw (
50+ message = " The JWT secret key cannot be empty, please fill this out in your `config/ColdBox.cfc` under your cbsecurity settings" ,
51+ detail = " cbsecurity.jwt.secretKey" ,
52+ type = " InvalidSecretKey"
53+ )
54+ }
55+ }
56+
4357 /* ***********************************************************************************/
4458 /* ***************************** TOKEN CREATION METHODS ******************************/
4559 /* ***********************************************************************************/
You can’t perform that action at this time.
0 commit comments