瀏覽代碼

Update Test Controllers

Closes gh-9121
Josh Cummings 4 年之前
父節點
當前提交
93c37e6b15

+ 3 - 3
config/src/test/java/org/springframework/security/config/http/MiscHttpConfigTests.java

@@ -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();
 		}
 		}
 	}
 	}

+ 1 - 1
config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/resourceserver/OpaqueTokenDslTests.kt

@@ -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
         }
         }
     }
     }