泡泡SpringSecurity3.2【授权-标签使用】

 

 


 

<%--
  Created by IntelliJ IDEA.
  User: yubaby
  Date: 2021/8/16
  Time: 22:17
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<html>
<head>
    <title>home</title>
    <link rel="Bookmark" type="image/x-icon" href="favicon.ico" />
    <link rel="icon" type="image/x-icon" href="favicon.ico" />
    <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" /> <%--主要是这个--%>
</head>
<body>
    <h1>欢迎光临home</h1>

    <security:authentication property="principal.username"/>
    <br>
    <security:authorize access="hasAnyRole('ROLE_ADMIN')">
        <a href="#">用户查询</a>
    </security:authorize>
    <br>
    <security:authorize access="hasAnyRole('ROLE_USER')">
        <a href="#">用户添加</a>
    </security:authorize>
    <br>
    <a href="#">用户更新</a><br>

</body>
</html>
View Code

 

 

 

 

 

 

posted @ 2021-08-18 19:14  yub4by  阅读(30)  评论(0)    收藏  举报