안녕하세요, 저는 스프링 부트 + 스프링 보안으로 프로젝트를 가지고 있습니다. 나는 다음과 같이 정의 사용자 정의 주석 건물입니다 :이 주석은 클래스 '방법에 적용됩니다커스텀 어노테이션에서 스프링 보안 표현 사용하기
@Retention(RUNTIME)
@Target(METHOD)
public @interface CustomAnnotation {
String condition();
String[] fields() default {};
}
합니다. 나는 "조건"매개 변수를 표현식을 평가할 부분에서 평가할 '스프링 보안 표현식'으로하고 싶습니다. 그리고 그것이 사실이라면 어떤 논리를 수행 할 것입니다. 나는 봄 보안 발현을 의미하는 경우
@Pointcut("@annotation(customAnnotation)" )
public void pointcutForCustomAnnotation(CustomAnnotation customAnnotation) {
// Do nothing.
}
@Around("pointcutForCustomAnnotation(customAnnotation)")
public Object customAspect(ProceedingJoinPoint pjp, CustomAnnotation customAnnotation) throws Throwable {
// Here should go the logic to evaluate spring security expression
String condition = customAnnotation.condition();
String[] fieldsToHide = customAnnotation.fields();
}
, 내가 @Preauthorize, @PostAuthorize, @PreFilter @PostFilter 스프링 주석에 사용되는 것을 의미 다음과 같이
가로 세로가 정의됩니다.
hasRole('ROLE_USER')
isAuthenticated()
는 어떻게 측면에서 스프링 보안 식을 계산할 수 있습니다 : 예를 들어 ? 나는 쉽게 시작하는 지점이 될 수이 작업을