Skip to content

Commit 5aae23d

Browse files
committed
Update OAuth Actuator sample tests to adapt to sensitivity removal
See spring-projectsgh-9924
1 parent 52536dc commit 5aae23d

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

spring-boot-samples/spring-boot-sample-secure-oauth2-actuator/src/test/java/sample/secure/oauth2/actuator/SampleSecureOAuth2ActuatorApplicationTests.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,24 @@ public void homePageSecuredByDefault() throws Exception {
6969
}
7070

7171
@Test
72-
public void healthAvailable() throws Exception {
73-
this.mvc.perform(get("/application/health")).andExpect(status().isOk())
74-
.andDo(print());
72+
public void healthSecured() throws Exception {
73+
this.mvc.perform(get("/application/health")).andExpect(status().isUnauthorized());
7574
}
7675

7776
@Test
78-
public void envSecuredWithBasic() throws Exception {
79-
this.mvc.perform(get("/application/env")).andExpect(status().isUnauthorized())
80-
.andExpect(header().string("WWW-Authenticate", containsString("Basic")))
81-
.andDo(print());
77+
public void healthWithBasicAuthorization() throws Exception {
78+
this.mvc.perform(get("/application/health").header("Authorization",
79+
"Basic " + Base64Utils.encodeToString("user:password".getBytes())))
80+
.andExpect(status().isOk());
81+
}
82+
83+
@Test
84+
public void envSecured() throws Exception {
85+
this.mvc.perform(get("/application/env")).andExpect(status().isUnauthorized());
8286
}
8387

8488
@Test
85-
public void envWithPassword() throws Exception {
89+
public void envWithBasicAuthorization() throws Exception {
8690
this.mvc.perform(get("/application/env").header("Authorization",
8791
"Basic " + Base64Utils.encodeToString("user:password".getBytes())))
8892
.andExpect(status().isOk()).andDo(print());

0 commit comments

Comments
 (0)