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
e4b8e174
Commit
e4b8e174
authored
Apr 20, 2014
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test case for gh-699
parent
35931556
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
SampleMethodSecurityApplicationTests.java
...ample/ui/method/SampleMethodSecurityApplicationTests.java
+16
-0
No files found.
spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/ui/method/SampleMethodSecurityApplicationTests.java
View file @
e4b8e174
...
...
@@ -20,6 +20,7 @@ import java.util.Arrays;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -108,6 +109,21 @@ public class SampleMethodSecurityApplicationTests {
.
getBody
().
contains
(
"Access denied"
));
}
@Test
public
void
testManagementProtected
()
throws
Exception
{
ResponseEntity
<
String
>
entity
=
new
TestRestTemplate
()
.
getForEntity
(
"http://localhost:"
+
port
+
"/beans"
,
String
.
class
);
assertEquals
(
HttpStatus
.
UNAUTHORIZED
,
entity
.
getStatusCode
());
}
@Test
@Ignore
(
"https://github.com/spring-projects/spring-boot/issues/699"
)
public
void
testManagementAuthorizedAccess
()
throws
Exception
{
ResponseEntity
<
String
>
entity
=
new
TestRestTemplate
(
"user"
,
"user"
)
.
getForEntity
(
"http://localhost:"
+
port
+
"/beans"
,
String
.
class
);
assertEquals
(
HttpStatus
.
OK
,
entity
.
getStatusCode
());
}
private
void
getCsrf
(
MultiValueMap
<
String
,
String
>
form
,
HttpHeaders
headers
)
{
ResponseEntity
<
String
>
page
=
new
TestRestTemplate
().
getForEntity
(
"http://localhost:"
+
port
+
"/login"
,
String
.
class
);
...
...
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