From 63cd32682c17bf0dcb35bb9fd2ffee51fbcac0b9 Mon Sep 17 00:00:00 2001 From: Josh Cummings Date: Mon, 12 Oct 2020 16:50:51 -0600 Subject: [PATCH] Update Test Controllers Closes gh-9121 --- .../security/config/http/MiscHttpConfigTests.java | 6 +++--- .../servlet/oauth2/resourceserver/OpaqueTokenDslTests.kt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/src/test/java/org/springframework/security/config/http/MiscHttpConfigTests.java b/config/src/test/java/org/springframework/security/config/http/MiscHttpConfigTests.java index a066387d6e..cd87b93ac6 100644 --- a/config/src/test/java/org/springframework/security/config/http/MiscHttpConfigTests.java +++ b/config/src/test/java/org/springframework/security/config/http/MiscHttpConfigTests.java @@ -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(); } diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/resourceserver/OpaqueTokenDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/resourceserver/OpaqueTokenDslTests.kt index 1d11c6d1a3..04e193dc7d 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/resourceserver/OpaqueTokenDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/resourceserver/OpaqueTokenDslTests.kt @@ -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 } }