2

我是春季安全的新手。我也使用 JSF 框架。在 xhtml 页面中,我使用弹簧安全标签。这个有效:

<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>

但他们都没有为我工作。

4

0 回答 0