mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-03-09 06:50:05 +00:00
Update Test Controllers
Closes gh-9121
This commit is contained in:
parent
01855fcce2
commit
b1a3aef4f8
@ -802,18 +802,18 @@ public class MiscHttpConfigTests {
|
||||
static class AuthenticationController {
|
||||
|
||||
@GetMapping("/password")
|
||||
String password(@AuthenticationPrincipal Authentication authentication) {
|
||||
String password(Authentication authentication) {
|
||||
return (String) authentication.getCredentials();
|
||||
}
|
||||
|
||||
@GetMapping("/roles")
|
||||
String roles(@AuthenticationPrincipal Authentication authentication) {
|
||||
String roles(Authentication authentication) {
|
||||
return authentication.getAuthorities().stream().map(GrantedAuthority::getAuthority)
|
||||
.collect(Collectors.joining(","));
|
||||
}
|
||||
|
||||
@GetMapping("/details")
|
||||
String details(@AuthenticationPrincipal Authentication authentication) {
|
||||
String details(Authentication authentication) {
|
||||
return authentication.getDetails().getClass().getName();
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ class OpaqueTokenDslTests {
|
||||
@RestController
|
||||
class AuthenticationController {
|
||||
@GetMapping("/authenticated")
|
||||
fun authenticated(@AuthenticationPrincipal authentication: Authentication): String {
|
||||
fun authenticated(authentication: Authentication): String {
|
||||
return authentication.name
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user