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
5aae23d8
Commit
5aae23d8
authored
Aug 01, 2017
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update OAuth Actuator sample tests to adapt to sensitivity removal
See gh-9924
parent
52536dc2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
SampleSecureOAuth2ActuatorApplicationTests.java
.../actuator/SampleSecureOAuth2ActuatorApplicationTests.java
+12
-8
No files found.
spring-boot-samples/spring-boot-sample-secure-oauth2-actuator/src/test/java/sample/secure/oauth2/actuator/SampleSecureOAuth2ActuatorApplicationTests.java
View file @
5aae23d8
...
@@ -69,20 +69,24 @@ public class SampleSecureOAuth2ActuatorApplicationTests {
...
@@ -69,20 +69,24 @@ public class SampleSecureOAuth2ActuatorApplicationTests {
}
}
@Test
@Test
public
void
healthAvailable
()
throws
Exception
{
public
void
healthSecured
()
throws
Exception
{
this
.
mvc
.
perform
(
get
(
"/application/health"
)).
andExpect
(
status
().
isOk
())
this
.
mvc
.
perform
(
get
(
"/application/health"
)).
andExpect
(
status
().
isUnauthorized
());
.
andDo
(
print
());
}
}
@Test
@Test
public
void
envSecuredWithBasic
()
throws
Exception
{
public
void
healthWithBasicAuthorization
()
throws
Exception
{
this
.
mvc
.
perform
(
get
(
"/application/env"
)).
andExpect
(
status
().
isUnauthorized
())
this
.
mvc
.
perform
(
get
(
"/application/health"
).
header
(
"Authorization"
,
.
andExpect
(
header
().
string
(
"WWW-Authenticate"
,
containsString
(
"Basic"
)))
"Basic "
+
Base64Utils
.
encodeToString
(
"user:password"
.
getBytes
())))
.
andDo
(
print
());
.
andExpect
(
status
().
isOk
());
}
@Test
public
void
envSecured
()
throws
Exception
{
this
.
mvc
.
perform
(
get
(
"/application/env"
)).
andExpect
(
status
().
isUnauthorized
());
}
}
@Test
@Test
public
void
envWith
Password
()
throws
Exception
{
public
void
envWith
BasicAuthorization
()
throws
Exception
{
this
.
mvc
.
perform
(
get
(
"/application/env"
).
header
(
"Authorization"
,
this
.
mvc
.
perform
(
get
(
"/application/env"
).
header
(
"Authorization"
,
"Basic "
+
Base64Utils
.
encodeToString
(
"user:password"
.
getBytes
())))
"Basic "
+
Base64Utils
.
encodeToString
(
"user:password"
.
getBytes
())))
.
andExpect
(
status
().
isOk
()).
andDo
(
print
());
.
andExpect
(
status
().
isOk
()).
andDo
(
print
());
...
...
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