File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
src/main/java/net/coderic/core/api/config Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 10
10
import org .springframework .security .config .http .SessionCreationPolicy ;
11
11
import org .springframework .security .oauth2 .jwt .JwtDecoder ;
12
12
import org .springframework .security .oauth2 .jwt .JwtDecoders ;
13
+ import org .springframework .security .oauth2 .jwt .NimbusJwtDecoder ;
13
14
import org .springframework .security .oauth2 .server .resource .authentication .JwtAuthenticationConverter ;
14
15
import org .springframework .security .web .SecurityFilterChain ;
15
16
import org .springframework .security .web .authentication .logout .HeaderWriterLogoutHandler ;
20
21
import org .springframework .web .cors .CorsConfigurationSource ;
21
22
import org .springframework .web .cors .UrlBasedCorsConfigurationSource ;
22
23
24
+ import javax .crypto .spec .SecretKeySpec ;
23
25
import java .util .Arrays ;
24
26
25
27
@ Configuration
@@ -130,4 +132,11 @@ private JwtAuthenticationConverter jwtAuthenticationConverter() {
130
132
// Configura cómo deseas mapear los claims del token JWT a roles/autorizaciones
131
133
return converter ;
132
134
}
135
+ @ Bean
136
+ public JwtDecoder jwtDecoder () {
137
+ // Clave simétrica utilizada para descifrar el token (debe coincidir con la configurada en Auth0)
138
+ String secretKey = System .getenv ("OKTA_CLIENT_SECRET" ); // Sustituye con la clave proporcionada por Auth0
139
+
140
+ return NimbusJwtDecoder .withSecretKey (new SecretKeySpec (secretKey .getBytes (), "AES" )).build ();
141
+ }
133
142
}
You can’t perform that action at this time.
0 commit comments