春のセキュリティは初めてです。私もJSFフレームワークを使用しています。xhtml ページでは、Spring セキュリティ タグを使用しています。これは機能します:
<sec:authorize access="hasRole('ROLE_USER')">HOHO</sec:authorize>
ただし、これらは機能しません:
<sec:authentication property="name" />
<sec:authentication property="principal.name" />
<sec:authentication property="principal" />
そして、それは私にこのエラーを与えます:
/Welcome.xhtml @20,48 <sec:authentication> Tag Library supports namespace: http://www.springframework.org/security/tags, but no tag was defined for name: authentication
編集 これを springsecurity.taglib.xml に追加しようとしました:
<tag>
<tag-name>authentication</tag-name>
<handler-class>org.springframework.security.taglibs.authz.AuthenticationTag</handler-class>
</tag>
この :
<tag>
<tag-name>authentication</tag-name>
<component>
<component-type>org.springframework.security.taglibs.authz.AuthenticationTag</component-type>
</component>
</tag>
しかし、どれも私のために働いていませんでした。