스프링 보안 4.2.3을 구현했다. JSF-2.2 웹 응용 프로그램에서 작동하고 그것은 지금까지 잘 작동합니다. 이제 스프링 보안의 authorize 태그에서 jsf bean 메소드에 액세스하는 데 문제가 있습니다.Spring 보안 권한 부여 태그로 관리되는 JSF beans에 접근하기
이 내가 항목 데이터에 따라 일부 행에 액세스를 거부 할 필요가 내 XHTML 데이터 테이블 : 단지 테스트 여기
<p:dataTable var="item" value="#{itemService.items}">
<p:column headerText="Id">
<h:outputText value="#{item.id}" />
</p:column>
<p:column headerText="Name">
<h:outputText value="#{item.name}" />
</p:column>
<p:column headerText="Security">
<sec:authorize access="#{securityService.checkAccessByItemId(item.id)}">
<h:outputLabel value="#{helloWorld.secure}"/>
</sec:authorize>
</p:column>
</p:dataTable>
그리고 내 콩 :
여기@ManagedBean(name="securityService")
@RequestScoped
public class SecurityService {
public boolean checkAccessByItemId(int id) {
if(id==5) {
return false;
} else {
return true;
}
}
}
내 태그 라이브러리. XML :이 예외를 얻고있다
<facelet-taglib>
<namespace>http://www.springframework.org/security/tags</namespace>
<tag>
<tag-name>authorize</tag-name>
<handler class>org.springframework.faces.security.FaceletsAuthorizeTagHandler</handler-class>
</tag>
</facelet-taglib>
:
org.springframework.expression.spel.SpelParseException: Expression [#{securityService.checkAccessByItemId(item.id)}] @1: EL1043E: Unexpected token. Expected 'identifier' but was 'lcurly({)'
at org.springframework.expression.spel.standard.InternalSpelExpressionParser.raiseInternalException(InternalSpelExpressionParser.java:1006)
누구든지 해결책을 알고 있습니까?
스프링 EL이 매개 변수화 된 메소드 호출을 지원하는지 확인 했습니까? – Kukeltje
매개 변수없이 메소드를 호출하면 동일한 오류가 발생합니다. – Timster
이제 오류를 올바르게 읽고 (스프링 보안 문서를 확인했습니다 !!!) EL을 사용할 수 있습니까? https://docs.spring.io/spring-security/site/docs/4.2.x/reference/html/taglibs.html#taglibs-authorize – Kukeltje