Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
67810abd
Commit
67810abd
authored
Feb 21, 2017
by
Madhura Bhave
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Match ResourceServerCondition if JWK config present
Closes gh-8350
parent
98a2ae3b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
OAuth2ResourceServerConfiguration.java
...ty/oauth2/resource/OAuth2ResourceServerConfiguration.java
+4
-0
OAuth2AutoConfigurationTests.java
...nfigure/security/oauth2/OAuth2AutoConfigurationTests.java
+10
-0
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/OAuth2ResourceServerConfiguration.java
View file @
67810abd
...
...
@@ -161,6 +161,10 @@ public class OAuth2ResourceServerConfiguration {
return
ConditionOutcome
.
match
(
message
.
foundExactly
(
"JWT resource configuration"
));
}
if
(!
resolver
.
getSubProperties
(
"jwk"
).
isEmpty
())
{
return
ConditionOutcome
.
match
(
message
.
foundExactly
(
"JWK resource configuration"
));
}
if
(
StringUtils
.
hasText
(
resolver
.
getProperty
(
"user-info-uri"
)))
{
return
ConditionOutcome
.
match
(
message
.
foundExactly
(
"user-info-uri property"
));
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java
View file @
67810abd
...
...
@@ -389,6 +389,16 @@ public class OAuth2AutoConfigurationTests {
.
isEqualTo
(
PrePostAnnotationSecurityMetadataSource
.
class
.
getName
());
}
@Test
public
void
resourceServerConditionWhenJwkConfigurationPresentShouldMatch
()
throws
Exception
{
this
.
context
=
new
AnnotationConfigEmbeddedWebApplicationContext
();
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"security.oauth2.resource.jwk.key-set-uri:http://my-auth-server/token_keys"
);
this
.
context
.
register
(
ResourceServerConfiguration
.
class
,
MinimalSecureWebApplication
.
class
);
this
.
context
.
refresh
();
assertThat
(
countBeans
(
RESOURCE_SERVER_CONFIG
)).
isEqualTo
(
1
);
}
/**
* Connect to the oauth service, get a token, and then attempt some operations using
* it.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment