You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/manual/src/docs/asciidoc/_includes/servlet/preface/java-configuration.adoc
+153-2Lines changed: 153 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -597,7 +597,7 @@ More powerful than `jwkSetUri()` is `decoder()`, which will completely replace a
597
597
598
598
```java
599
599
@EnableWebSecurity
600
-
public class DirectlyConfiguredJwkSetUri extends WebSecurityConfigurerAdapter {
600
+
public class DirectlyConfiguredJwtDecoder extends WebSecurityConfigurerAdapter {
601
601
protected void configure(HttpSecurity http) {
602
602
http
603
603
.authorizeRequests()
@@ -624,6 +624,157 @@ public JwtDecoder jwtDecoder() {
624
624
}
625
625
```
626
626
627
+
[[oauth2resourceserver-jwt-decoder-algorithm]]
628
+
=== Configuring Trusted Algorithms
629
+
630
+
By default, `NimbusJwtDecoder`, and hence Resource Server, will only trust and verify tokens using `RS256`.
631
+
632
+
You can customize this via <<oauth2-resourceserver-jwt-boot-algorithm,Spring Boot>>, <<oauth2-resourceserver-jwt-decoder-builder,the NimbusJwtDecoder builder>>, or from the <<oauth2-resourceserver-jwt-decoder-jwk-response,JWK Set response>>.
633
+
634
+
[[oauth2-resourceserver-jwt-boot-algorithm]]
635
+
==== Via Spring Boot
636
+
637
+
The simplest way to set the algorithm is as a property:
Simpler than backing a Resource Server with a JWK Set endpoint is to hard-code an RSA public key.
712
+
The public key can be provided via <<oauth2resourceserver-jwt-decoder-public-key-boot,Spring Boot>> or by <<oauth2resourceserver-jwt-decoder-public-key-builder,Using a Builder>>.
0 commit comments