mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-03 17:22:13 +00:00
Update Test Controllers
Closes gh-9121
This commit is contained in:
parent
21f7187f40
commit
0462c42290
@ -822,19 +822,19 @@ public class MiscHttpConfigTests {
|
|||||||
@RestController
|
@RestController
|
||||||
static class AuthenticationController {
|
static class AuthenticationController {
|
||||||
@GetMapping("/password")
|
@GetMapping("/password")
|
||||||
public String password(@AuthenticationPrincipal Authentication authentication) {
|
public String password(Authentication authentication) {
|
||||||
return (String) authentication.getCredentials();
|
return (String) authentication.getCredentials();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/roles")
|
@GetMapping("/roles")
|
||||||
public String roles(@AuthenticationPrincipal Authentication authentication) {
|
public String roles(Authentication authentication) {
|
||||||
return authentication.getAuthorities().stream()
|
return authentication.getAuthorities().stream()
|
||||||
.map(GrantedAuthority::getAuthority)
|
.map(GrantedAuthority::getAuthority)
|
||||||
.collect(Collectors.joining(","));
|
.collect(Collectors.joining(","));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/details")
|
@GetMapping("/details")
|
||||||
public String details(@AuthenticationPrincipal Authentication authentication) {
|
public String details(Authentication authentication) {
|
||||||
return authentication.getDetails().getClass().getName();
|
return authentication.getDetails().getClass().getName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user