ユーザーが認証されている場合のみ、JSPページにログアウトリンクを表示できません。ここで私はJSPページのこの行に持っている例外は次のとおりです。Spring Security - アプリケーションコンテキストで可視のWebSecurityExpressionHandlerインスタンスが見つかりませんでした。
<sec:authorize access="isAuthenticated()">
例外:
Stacktrace:
....
root cause
javax.servlet.jsp.JspException: No visible WebSecurityExpressionHandler instance could be found in the application context. There must be at least one in order to support expressions in JSP 'authorize' tags.
org.springframework.security.taglibs.authz.AuthorizeTag.getExpressionHandler(AuthorizeTag.java:100)
org.springframework.security.taglibs.authz.AuthorizeTag.authorizeUsingAccessExpression(AuthorizeTag.java:58)
ここでは、私のアプリケーション・コンテキストのsecurity.xmlです:
<http auto-config='true' >
<intercept-url pattern="/user/**" access="ROLE_User" />
<logout logout-success-url="/hello.htm" />
</http>
<beans:bean id="daoAuthenticationProvider"
class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
<beans:property name="userDetailsService" ref="userDetailsService" />
</beans:bean>
<beans:bean id="authenticationManager"
class="org.springframework.security.authentication.ProviderManager">
<beans:property name="providers">
<beans:list>
<beans:ref local="daoAuthenticationProvider" />
</beans:list>
</beans:property>
</beans:bean>
<authentication-manager>
<authentication-provider user-service-ref="userDetailsService">
<password-encoder hash="plaintext" />
</authentication-provider>
</authentication-manager>
私は理解してhttpタグでuse-expression = "true"を使用することができますが、これはintercept-urlタグとjavaコードで式を使用する必要があることを意味します。回避策はありますか?
関連のない観察。あなたの設定の 'daoAuthenticationProvider'と' authenticationManager'は使用されていません。 –