|
30 | 30 | import org.springframework.security.oauth2.jwt.JwtDecoder;
|
31 | 31 | import org.springframework.security.oauth2.jwt.NimbusJwtDecoder;
|
32 | 32 | import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationProvider;
|
33 |
| -import org.springframework.security.oauth2.server.resource.authentication.OAuth2IntrospectionAuthenticationProvider; |
| 33 | +import org.springframework.security.oauth2.server.resource.authentication.JwtBearerTokenAuthenticationConverter; |
| 34 | +import org.springframework.security.oauth2.server.resource.authentication.OpaqueTokenAuthenticationProvider; |
34 | 35 | import org.springframework.security.oauth2.server.resource.introspection.NimbusOpaqueTokenIntrospector;
|
35 | 36 | import org.springframework.security.oauth2.server.resource.introspection.OpaqueTokenIntrospector;
|
36 | 37 |
|
@@ -84,13 +85,15 @@ AuthenticationManagerResolver<HttpServletRequest> multitenantAuthenticationManag
|
84 | 85 |
|
85 | 86 | AuthenticationManager jwt() {
|
86 | 87 | JwtDecoder jwtDecoder = NimbusJwtDecoder.withJwkSetUri(this.jwkSetUri).build();
|
87 |
| - return new JwtAuthenticationProvider(jwtDecoder)::authenticate; |
| 88 | + JwtAuthenticationProvider authenticationProvider = new JwtAuthenticationProvider(jwtDecoder); |
| 89 | + authenticationProvider.setJwtAuthenticationConverter(new JwtBearerTokenAuthenticationConverter()); |
| 90 | + return authenticationProvider::authenticate; |
88 | 91 | }
|
89 | 92 |
|
90 | 93 | AuthenticationManager opaque() {
|
91 | 94 | OpaqueTokenIntrospector introspectionClient =
|
92 | 95 | new NimbusOpaqueTokenIntrospector(this.introspectionUri,
|
93 | 96 | this.introspectionClientId, this.introspectionClientSecret);
|
94 |
| - return new OAuth2IntrospectionAuthenticationProvider(introspectionClient)::authenticate; |
| 97 | + return new OpaqueTokenAuthenticationProvider(introspectionClient)::authenticate; |
95 | 98 | }
|
96 | 99 | }
|
0 commit comments