Fix build following Spring Security changes
This commit is contained in:
parent
8fd8a9b618
commit
7bbeeaa4d2
|
@ -28,6 +28,7 @@ import org.springframework.boot.autoconfigure.security.oauth2.resource.OAuth2Res
|
|||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.oauth2.jose.jws.SignatureAlgorithm;
|
||||
import org.springframework.security.oauth2.jwt.JwtDecoder;
|
||||
import org.springframework.security.oauth2.jwt.JwtDecoders;
|
||||
import org.springframework.security.oauth2.jwt.NimbusJwtDecoder;
|
||||
|
@ -53,7 +54,8 @@ class OAuth2ResourceServerJwtConfiguration {
|
|||
@ConditionalOnMissingBean
|
||||
public JwtDecoder jwtDecoderByJwkKeySetUri() {
|
||||
return NimbusJwtDecoder.withJwkSetUri(this.properties.getJwkSetUri())
|
||||
.jwsAlgorithm(this.properties.getJwsAlgorithm()).build();
|
||||
.jwsAlgorithm(SignatureAlgorithm.from(this.properties.getJwsAlgorithm()))
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
|
@ -102,7 +102,7 @@ public class OAuth2ResourceServerAutoConfigurationTests {
|
|||
public void autoConfigurationShouldConfigureResourceServerWithJwsAlgorithm() {
|
||||
this.contextRunner.withPropertyValues(
|
||||
"spring.security.oauth2.resourceserver.jwt.jwk-set-uri=https://jwk-set-uri.com",
|
||||
"spring.security.oauth2.resourceserver.jwt.jws-algorithm=HS512")
|
||||
"spring.security.oauth2.resourceserver.jwt.jws-algorithm=RS384")
|
||||
.run((context) -> {
|
||||
JwtDecoder jwtDecoder = context.getBean(JwtDecoder.class);
|
||||
Object processor = ReflectionTestUtils.getField(jwtDecoder,
|
||||
|
@ -110,7 +110,7 @@ public class OAuth2ResourceServerAutoConfigurationTests {
|
|||
Object keySelector = ReflectionTestUtils.getField(processor,
|
||||
"jwsKeySelector");
|
||||
assertThat(keySelector).hasFieldOrPropertyWithValue("jwsAlg",
|
||||
JWSAlgorithm.HS512);
|
||||
JWSAlgorithm.RS384);
|
||||
assertThat(getBearerTokenFilter(context)).isNotNull();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue