Update Test Controllers

Closes gh-9121
This commit is contained in:
Josh Cummings 2020-10-12 16:50:51 -06:00
parent 3d9e5d4bc3
commit 63cd32682c
No known key found for this signature in database
GPG Key ID: 49EF60DD7FF83443
2 changed files with 4 additions and 4 deletions

View File

@ -802,18 +802,18 @@ public class MiscHttpConfigTests {
static class AuthenticationController { static class AuthenticationController {
@GetMapping("/password") @GetMapping("/password")
String password(@AuthenticationPrincipal Authentication authentication) { String password(Authentication authentication) {
return (String) authentication.getCredentials(); return (String) authentication.getCredentials();
} }
@GetMapping("/roles") @GetMapping("/roles")
String roles(@AuthenticationPrincipal Authentication authentication) { String roles(Authentication authentication) {
return authentication.getAuthorities().stream().map(GrantedAuthority::getAuthority) return authentication.getAuthorities().stream().map(GrantedAuthority::getAuthority)
.collect(Collectors.joining(",")); .collect(Collectors.joining(","));
} }
@GetMapping("/details") @GetMapping("/details")
String details(@AuthenticationPrincipal Authentication authentication) { String details(Authentication authentication) {
return authentication.getDetails().getClass().getName(); return authentication.getDetails().getClass().getName();
} }

View File

@ -176,7 +176,7 @@ class OpaqueTokenDslTests {
@RestController @RestController
class AuthenticationController { class AuthenticationController {
@GetMapping("/authenticated") @GetMapping("/authenticated")
fun authenticated(@AuthenticationPrincipal authentication: Authentication): String { fun authenticated(authentication: Authentication): String {
return authentication.name return authentication.name
} }
} }