|
|
|
@ -17,8 +17,6 @@ |
|
|
|
package org.springframework.security.web.method.annotation; |
|
|
|
package org.springframework.security.web.method.annotation; |
|
|
|
|
|
|
|
|
|
|
|
import java.lang.annotation.Annotation; |
|
|
|
import java.lang.annotation.Annotation; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.core.MethodParameter; |
|
|
|
import org.springframework.core.MethodParameter; |
|
|
|
import org.springframework.expression.BeanResolver; |
|
|
|
import org.springframework.expression.BeanResolver; |
|
|
|
@ -98,8 +96,6 @@ public final class AuthenticationPrincipalArgumentResolver implements HandlerMet |
|
|
|
private SecurityContextHolderStrategy securityContextHolderStrategy = SecurityContextHolder |
|
|
|
private SecurityContextHolderStrategy securityContextHolderStrategy = SecurityContextHolder |
|
|
|
.getContextHolderStrategy(); |
|
|
|
.getContextHolderStrategy(); |
|
|
|
|
|
|
|
|
|
|
|
private final Map<MethodParameter, Annotation> cachedAttributes = new ConcurrentHashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ExpressionParser parser = new SpelExpressionParser(); |
|
|
|
private ExpressionParser parser = new SpelExpressionParser(); |
|
|
|
|
|
|
|
|
|
|
|
private SecurityAnnotationScanner<AuthenticationPrincipal> scanner = SecurityAnnotationScanners |
|
|
|
private SecurityAnnotationScanner<AuthenticationPrincipal> scanner = SecurityAnnotationScanners |
|
|
|
@ -179,8 +175,7 @@ public final class AuthenticationPrincipalArgumentResolver implements HandlerMet |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
private <T extends Annotation> T findMethodAnnotation(MethodParameter parameter) { |
|
|
|
private <T extends Annotation> T findMethodAnnotation(MethodParameter parameter) { |
|
|
|
return (T) this.cachedAttributes.computeIfAbsent(parameter, |
|
|
|
return (T) this.scanner.scan(parameter.getParameter()); |
|
|
|
(methodParameter) -> this.scanner.scan(methodParameter.getParameter())); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|