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
9480e09c
Commit
9480e09c
authored
May 10, 2017
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upgrade to Spring Security 5.0.0.M1
Closes gh-8714
parent
8f1cf0ce
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
9 deletions
+11
-9
ResourceServerTokenServicesConfiguration.java
...h2/resource/ResourceServerTokenServicesConfiguration.java
+3
-2
OAuth2AutoConfigurationTests.java
...nfigure/security/oauth2/OAuth2AutoConfigurationTests.java
+2
-2
pom.xml
spring-boot-dependencies/pom.xml
+1
-1
HelloWebSecurityApplicationTests.java
...rc/test/java/sample/HelloWebSecurityApplicationTests.java
+5
-4
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfiguration.java
View file @
9480e09c
...
@@ -18,6 +18,7 @@ package org.springframework.boot.autoconfigure.security.oauth2.resource;
...
@@ -18,6 +18,7 @@ package org.springframework.boot.autoconfigure.security.oauth2.resource;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Base64
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -45,7 +46,6 @@ import org.springframework.http.MediaType;
...
@@ -45,7 +46,6 @@ import org.springframework.http.MediaType;
import
org.springframework.http.client.ClientHttpRequestExecution
;
import
org.springframework.http.client.ClientHttpRequestExecution
;
import
org.springframework.http.client.ClientHttpRequestInterceptor
;
import
org.springframework.http.client.ClientHttpRequestInterceptor
;
import
org.springframework.http.client.ClientHttpResponse
;
import
org.springframework.http.client.ClientHttpResponse
;
import
org.springframework.security.crypto.codec.Base64
;
import
org.springframework.security.oauth2.client.OAuth2ClientContext
;
import
org.springframework.security.oauth2.client.OAuth2ClientContext
;
import
org.springframework.security.oauth2.client.OAuth2RestOperations
;
import
org.springframework.security.oauth2.client.OAuth2RestOperations
;
import
org.springframework.security.oauth2.client.resource.OAuth2ProtectedResourceDetails
;
import
org.springframework.security.oauth2.client.resource.OAuth2ProtectedResourceDetails
;
...
@@ -298,7 +298,8 @@ public class ResourceServerTokenServicesConfiguration {
...
@@ -298,7 +298,8 @@ public class ResourceServerTokenServicesConfiguration {
String
username
=
this
.
resource
.
getClientId
();
String
username
=
this
.
resource
.
getClientId
();
String
password
=
this
.
resource
.
getClientSecret
();
String
password
=
this
.
resource
.
getClientSecret
();
if
(
username
!=
null
&&
password
!=
null
)
{
if
(
username
!=
null
&&
password
!=
null
)
{
byte
[]
token
=
Base64
.
encode
((
username
+
":"
+
password
).
getBytes
());
byte
[]
token
=
Base64
.
getEncoder
()
.
encode
((
username
+
":"
+
password
).
getBytes
());
headers
.
add
(
"Authorization"
,
"Basic "
+
new
String
(
token
));
headers
.
add
(
"Authorization"
,
"Basic "
+
new
String
(
token
));
}
}
HttpEntity
<
Void
>
request
=
new
HttpEntity
<>(
headers
);
HttpEntity
<
Void
>
request
=
new
HttpEntity
<>(
headers
);
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java
View file @
9480e09c
...
@@ -19,6 +19,7 @@ package org.springframework.boot.autoconfigure.security.oauth2;
...
@@ -19,6 +19,7 @@ package org.springframework.boot.autoconfigure.security.oauth2;
import
java.net.URI
;
import
java.net.URI
;
import
java.net.URL
;
import
java.net.URL
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Base64
;
import
java.util.List
;
import
java.util.List
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.JsonNode
;
...
@@ -72,7 +73,6 @@ import org.springframework.security.config.annotation.method.configuration.Globa
...
@@ -72,7 +73,6 @@ import org.springframework.security.config.annotation.method.configuration.Globa
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
import
org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
;
import
org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
;
import
org.springframework.security.core.authority.AuthorityUtils
;
import
org.springframework.security.core.authority.AuthorityUtils
;
import
org.springframework.security.crypto.codec.Base64
;
import
org.springframework.security.oauth2.client.OAuth2ClientContext
;
import
org.springframework.security.oauth2.client.OAuth2ClientContext
;
import
org.springframework.security.oauth2.client.OAuth2RestOperations
;
import
org.springframework.security.oauth2.client.OAuth2RestOperations
;
import
org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails
;
import
org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails
;
...
@@ -455,7 +455,7 @@ public class OAuth2AutoConfigurationTests {
...
@@ -455,7 +455,7 @@ public class OAuth2AutoConfigurationTests {
private
HttpHeaders
getHeaders
(
ClientDetails
config
)
{
private
HttpHeaders
getHeaders
(
ClientDetails
config
)
{
HttpHeaders
headers
=
new
HttpHeaders
();
HttpHeaders
headers
=
new
HttpHeaders
();
String
token
=
new
String
(
Base64
.
encode
(
String
token
=
new
String
(
Base64
.
getEncoder
().
encode
(
(
config
.
getClientId
()
+
":"
+
config
.
getClientSecret
()).
getBytes
()));
(
config
.
getClientId
()
+
":"
+
config
.
getClientSecret
()).
getBytes
()));
headers
.
set
(
"Authorization"
,
"Basic "
+
token
);
headers
.
set
(
"Authorization"
,
"Basic "
+
token
);
return
headers
;
return
headers
;
...
...
spring-boot-dependencies/pom.xml
View file @
9480e09c
...
@@ -165,7 +165,7 @@
...
@@ -165,7 +165,7 @@
<spring-plugin.version>
1.2.0.RELEASE
</spring-plugin.version>
<spring-plugin.version>
1.2.0.RELEASE
</spring-plugin.version>
<spring-restdocs.version>
1.2.1.BUILD-SNAPSHOT
</spring-restdocs.version>
<spring-restdocs.version>
1.2.1.BUILD-SNAPSHOT
</spring-restdocs.version>
<spring-retry.version>
1.2.0.RELEASE
</spring-retry.version>
<spring-retry.version>
1.2.0.RELEASE
</spring-retry.version>
<spring-security.version>
5.0.0.
BUILD-SNAPSHOT
</spring-security.version>
<spring-security.version>
5.0.0.
M1
</spring-security.version>
<spring-security-jwt.version>
1.0.7.RELEASE
</spring-security-jwt.version>
<spring-security-jwt.version>
1.0.7.RELEASE
</spring-security-jwt.version>
<spring-security-oauth.version>
2.1.0.RELEASE
</spring-security-oauth.version>
<spring-security-oauth.version>
2.1.0.RELEASE
</spring-security-oauth.version>
<spring-session.version>
2.0.0.BUILD-SNAPSHOT
</spring-session.version>
<spring-session.version>
2.0.0.BUILD-SNAPSHOT
</spring-session.version>
...
...
spring-boot-integration-tests/spring-boot-security-tests/spring-boot-security-test-web-helloworld/src/test/java/sample/HelloWebSecurityApplicationTests.java
View file @
9480e09c
/*
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -16,6 +16,8 @@
...
@@ -16,6 +16,8 @@
package
sample
;
package
sample
;
import
java.util.Base64
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
org.junit.Before
;
import
org.junit.Before
;
...
@@ -28,7 +30,6 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
...
@@ -28,7 +30,6 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import
org.springframework.mock.web.MockFilterChain
;
import
org.springframework.mock.web.MockFilterChain
;
import
org.springframework.mock.web.MockHttpServletRequest
;
import
org.springframework.mock.web.MockHttpServletRequest
;
import
org.springframework.mock.web.MockHttpServletResponse
;
import
org.springframework.mock.web.MockHttpServletResponse
;
import
org.springframework.security.crypto.codec.Base64
;
import
org.springframework.security.web.FilterChainProxy
;
import
org.springframework.security.web.FilterChainProxy
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
...
@@ -63,8 +64,8 @@ public class HelloWebSecurityApplicationTests {
...
@@ -63,8 +64,8 @@ public class HelloWebSecurityApplicationTests {
@Test
@Test
public
void
userAuthenticates
()
throws
Exception
{
public
void
userAuthenticates
()
throws
Exception
{
this
.
request
.
addHeader
(
"Authorization"
,
this
.
request
.
addHeader
(
"Authorization"
,
"Basic "
+
new
String
(
"Basic "
+
new
String
(
Base64
.
encode
(
"user:password"
.
getBytes
(
"UTF-8"
))));
Base64
.
getEncoder
()
.
encode
(
"user:password"
.
getBytes
(
"UTF-8"
))));
this
.
springSecurityFilterChain
.
doFilter
(
this
.
request
,
this
.
response
,
this
.
chain
);
this
.
springSecurityFilterChain
.
doFilter
(
this
.
request
,
this
.
response
,
this
.
chain
);
...
...
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