Polish "Configure signature algorithm when using public key jwt decoder"

See gh-20523
This commit is contained in:
Stephane Nicoll
2020-03-23 11:17:22 +01:00
parent 69e33d6e62
commit 08a89b6288
2 changed files with 12 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -190,6 +190,16 @@ class OAuth2ResourceServerAutoConfigurationTests {
.hasMessageContaining("Public key location does not exist"));
}
@Test
void autoConfigurationShouldFailIfAlgorithmIsInvalid() {
this.contextRunner
.withPropertyValues(
"spring.security.oauth2.resourceserver.jwt.public-key-location=classpath:public-key-location",
"spring.security.oauth2.resourceserver.jwt.jws-algorithm=NOT_VALID")
.run((context) -> assertThat(context).hasFailed().getFailure()
.hasMessageContaining("signatureAlgorithm cannot be null"));
}
@Test
void autoConfigurationWhenSetUriKeyLocationAndIssuerUriPresentShouldUseSetUri() {
this.contextRunner