@@ -258,7 +258,7 @@ void endpointWhenNotUserAuthorityThenForbidden() {
258
258
@Test
259
259
void anyWhenUnauthenticatedThenUnauthorized() {
260
260
this.mvc.perform(get("/any"))
261
- .andExpect(status().isUnauthorized())
261
+ .andExpect(status().isUnauthorized());
262
262
}
263
263
----
264
264
======
@@ -387,7 +387,7 @@ void endpointWhenNotUserAuthorityThenForbidden() {
387
387
@Test
388
388
void anyWhenUnauthenticatedThenUnauthorized() {
389
389
this.mvc.perform(get("/any"))
390
- .andExpect(status().isUnauthorized())
390
+ .andExpect(status().isUnauthorized());
391
391
}
392
392
----
393
393
======
@@ -521,7 +521,7 @@ void getWhenNoReadAuthorityThenForbidden() {
521
521
@Test
522
522
void postWhenWriteAuthorityThenAuthorized() {
523
523
this.mvc.perform(post("/any").with(csrf()))
524
- .andExpect(status().isOk())
524
+ .andExpect(status().isOk());
525
525
}
526
526
527
527
@WithMockUser(authorities="read")
@@ -737,7 +737,7 @@ SecurityFilterChain web(HttpSecurity http) throws Exception {
737
737
.dispatcherTypeMatchers(FORWARD, ERROR).permitAll() // <2>
738
738
.requestMatchers("/static/**", "/signup", "/about").permitAll() // <3>
739
739
.requestMatchers("/admin/**").hasRole("ADMIN") // <4>
740
- .requestMatchers("/db/**").access(allOf(hasAuthority('db' ), hasRole(' ADMIN' ))) // <5>
740
+ .requestMatchers("/db/**").access(allOf(hasAuthority("db" ), hasRole(" ADMIN" ))) // <5>
741
741
.anyRequest().denyAll() // <6>
742
742
);
743
743
@@ -805,7 +805,7 @@ Xml::
805
805
</http>
806
806
----
807
807
======
808
- <1> We specified a URL patters that any user can access.
808
+ <1> We specified a URL pattern that any user can access.
809
809
Specifically, any user can access a request if the URL starts with "/static/".
810
810
<2> Any URL that starts with "/admin/" will be restricted to users who have the role "ROLE_ADMIN".
811
811
You will notice that since we are invoking the `hasRole` method we do not need to specify the "ROLE_" prefix.
0 commit comments