File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change 3030builder . Services . Configure < JwtOptions > ( builder . Configuration . GetSection ( "Jwt" ) ) ;
3131var jwt = builder . Configuration . GetSection ( "Jwt" ) . Get < JwtOptions > ( ) ! ;
3232
33+ var keyBase64 = builder . Configuration [ "Jwt:KeyBase64" ] ! ;
34+ var keyPlain = Encoding . UTF8 . GetString ( Convert . FromBase64String ( keyBase64 ) ) ;
35+
3336builder . Services . AddAuthentication ( JwtBearerDefaults . AuthenticationScheme )
3437 . AddJwtBearer ( opt =>
3538 {
4043 ValidateIssuerSigningKey = true ,
4144 ValidIssuer = jwt . Issuer ,
4245 ValidAudience = jwt . Audience ,
43- IssuerSigningKey = new SymmetricSecurityKey ( Encoding . UTF8 . GetBytes ( jwt . Key ) ) ,
46+ IssuerSigningKey = new SymmetricSecurityKey ( Encoding . UTF8 . GetBytes ( keyPlain ) ) ,
4447 ClockSkew = TimeSpan . Zero
4548 } ;
4649 } ) ;
Original file line number Diff line number Diff line change 2727 "Jwt" : {
2828 "Issuer" : " PermsApi" ,
2929 "Audience" : " PermsApiAudience" ,
30- "Key " : " very_long_dev_key_change_in_prod_1234567890 " ,
30+ "KeyBase64 " : " dmVyeV9sb25nX2Rldl9rZXlfY2hhbmdlX2luX3Byb2RfMTIzNDU2Nzg5MA== " ,
3131 "ExpiresMinutes" : 60
3232 }
3333
You can’t perform that action at this time.
0 commit comments