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
e0b55d36
Commit
e0b55d36
authored
Dec 07, 2018
by
Madhura Bhave
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.1.x'
parents
d3e5c568
f13697b2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
2 deletions
+24
-2
ReactiveOAuth2ResourceServerAutoConfiguration.java
...active/ReactiveOAuth2ResourceServerAutoConfiguration.java
+3
-1
OAuth2ResourceServerAutoConfiguration.java
...source/servlet/OAuth2ResourceServerAutoConfiguration.java
+2
-1
ReactiveOAuth2ResourceServerAutoConfigurationTests.java
...e/ReactiveOAuth2ResourceServerAutoConfigurationTests.java
+10
-0
OAuth2ResourceServerAutoConfigurationTests.java
...e/servlet/OAuth2ResourceServerAutoConfigurationTests.java
+9
-0
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerAutoConfiguration.java
View file @
e0b55d36
...
@@ -25,6 +25,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
...
@@ -25,6 +25,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity
;
import
org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity
;
import
org.springframework.security.oauth2.jwt.JwtDecoder
;
import
org.springframework.security.oauth2.server.resource.BearerTokenAuthenticationToken
;
import
org.springframework.security.oauth2.server.resource.BearerTokenAuthenticationToken
;
/**
/**
...
@@ -37,7 +38,8 @@ import org.springframework.security.oauth2.server.resource.BearerTokenAuthentica
...
@@ -37,7 +38,8 @@ import org.springframework.security.oauth2.server.resource.BearerTokenAuthentica
@Configuration
@Configuration
@AutoConfigureBefore
(
ReactiveSecurityAutoConfiguration
.
class
)
@AutoConfigureBefore
(
ReactiveSecurityAutoConfiguration
.
class
)
@EnableConfigurationProperties
(
OAuth2ResourceServerProperties
.
class
)
@EnableConfigurationProperties
(
OAuth2ResourceServerProperties
.
class
)
@ConditionalOnClass
({
EnableWebFluxSecurity
.
class
,
BearerTokenAuthenticationToken
.
class
})
@ConditionalOnClass
({
EnableWebFluxSecurity
.
class
,
BearerTokenAuthenticationToken
.
class
,
JwtDecoder
.
class
})
@ConditionalOnWebApplication
(
type
=
ConditionalOnWebApplication
.
Type
.
REACTIVE
)
@ConditionalOnWebApplication
(
type
=
ConditionalOnWebApplication
.
Type
.
REACTIVE
)
@Import
({
ReactiveOAuth2ResourceServerJwkConfiguration
.
class
,
@Import
({
ReactiveOAuth2ResourceServerJwkConfiguration
.
class
,
ReactiveOAuth2ResourceServerWebSecurityConfiguration
.
class
})
ReactiveOAuth2ResourceServerWebSecurityConfiguration
.
class
})
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerAutoConfiguration.java
View file @
e0b55d36
...
@@ -24,6 +24,7 @@ import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfi
...
@@ -24,6 +24,7 @@ import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfi
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.security.oauth2.jwt.JwtDecoder
;
import
org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationToken
;
import
org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationToken
;
/**
/**
...
@@ -35,7 +36,7 @@ import org.springframework.security.oauth2.server.resource.authentication.JwtAut
...
@@ -35,7 +36,7 @@ import org.springframework.security.oauth2.server.resource.authentication.JwtAut
@Configuration
@Configuration
@AutoConfigureBefore
(
SecurityAutoConfiguration
.
class
)
@AutoConfigureBefore
(
SecurityAutoConfiguration
.
class
)
@EnableConfigurationProperties
(
OAuth2ResourceServerProperties
.
class
)
@EnableConfigurationProperties
(
OAuth2ResourceServerProperties
.
class
)
@ConditionalOnClass
(
JwtAuthenticationToken
.
class
)
@ConditionalOnClass
(
{
JwtAuthenticationToken
.
class
,
JwtDecoder
.
class
}
)
@ConditionalOnWebApplication
(
type
=
ConditionalOnWebApplication
.
Type
.
SERVLET
)
@ConditionalOnWebApplication
(
type
=
ConditionalOnWebApplication
.
Type
.
SERVLET
)
@Import
({
OAuth2ResourceServerJwtConfiguration
.
class
,
@Import
({
OAuth2ResourceServerJwtConfiguration
.
class
,
OAuth2ResourceServerWebSecurityConfiguration
.
class
})
OAuth2ResourceServerWebSecurityConfiguration
.
class
})
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerAutoConfigurationTests.java
View file @
e0b55d36
...
@@ -154,6 +154,16 @@ public class ReactiveOAuth2ResourceServerAutoConfigurationTests {
...
@@ -154,6 +154,16 @@ public class ReactiveOAuth2ResourceServerAutoConfigurationTests {
.
doesNotHaveBean
(
BeanIds
.
SPRING_SECURITY_FILTER_CHAIN
));
.
doesNotHaveBean
(
BeanIds
.
SPRING_SECURITY_FILTER_CHAIN
));
}
}
@Test
public
void
autoConfigurationShouldBeConditionalOnReactiveJwtDecoderClass
()
{
this
.
contextRunner
.
withPropertyValues
(
"spring.security.oauth2.resourceserver.jwt.jwk-set-uri=http://jwk-set-uri.com"
)
.
withUserConfiguration
(
JwtDecoderConfig
.
class
)
.
withClassLoader
(
new
FilteredClassLoader
(
ReactiveJwtDecoder
.
class
))
.
run
((
context
)
->
assertThat
(
context
)
.
doesNotHaveBean
(
BeanIds
.
SPRING_SECURITY_FILTER_CHAIN
));
}
@Test
@Test
public
void
autoConfigurationWhenSecurityWebFilterChainConfigPresentShouldNotAddOne
()
{
public
void
autoConfigurationWhenSecurityWebFilterChainConfigPresentShouldNotAddOne
()
{
this
.
contextRunner
.
withPropertyValues
(
this
.
contextRunner
.
withPropertyValues
(
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerAutoConfigurationTests.java
View file @
e0b55d36
...
@@ -174,6 +174,15 @@ public class OAuth2ResourceServerAutoConfigurationTests {
...
@@ -174,6 +174,15 @@ public class OAuth2ResourceServerAutoConfigurationTests {
.
run
((
context
)
->
assertThat
(
getBearerTokenFilter
(
context
)).
isNull
());
.
run
((
context
)
->
assertThat
(
getBearerTokenFilter
(
context
)).
isNull
());
}
}
@Test
public
void
autoConfigurationShouldBeConditionalOnJwtDecoderClass
()
{
this
.
contextRunner
.
withPropertyValues
(
"spring.security.oauth2.resourceserver.jwt.jwk-set-uri=http://jwk-set-uri.com"
)
.
withUserConfiguration
(
JwtDecoderConfig
.
class
)
.
withClassLoader
(
new
FilteredClassLoader
(
JwtDecoder
.
class
))
.
run
((
context
)
->
assertThat
(
getBearerTokenFilter
(
context
)).
isNull
());
}
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
private
Filter
getBearerTokenFilter
(
AssertableWebApplicationContext
context
)
{
private
Filter
getBearerTokenFilter
(
AssertableWebApplicationContext
context
)
{
FilterChainProxy
filterChain
=
(
FilterChainProxy
)
context
FilterChainProxy
filterChain
=
(
FilterChainProxy
)
context
...
...
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