下载了运行项目后,访问路径:http://localhost/shiro/login

这篇应该在进阶后面的.

shiro中的重中之重,一定要看.

基于springboot+thymeleaf+shiro做了一个demo,

在thymeleaf模板中使用shiro标签需要添加额外一个依赖:

        <!--shiro&thymeleaf-->
<dependency>
<groupId>com.github.theborakompanioni</groupId>
<artifactId>thymeleaf-extras-shiro</artifactId>
<version>2.0.0</version>
</dependency>

而在html页面中可以这样使用:

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<meta charset="UTF-8">
<title>后端首页</title>
</head>
<body> <div th:fragment="include/menu"></div> <!--获取用户信息,及退出按钮-->
<shiro:user>
欢迎<shiro:principal/>登录,<a href="/admin/doLogout">退出</a>
</shiro:user> <!--游客访问,显示登录选项-->
<shiro:guest>
<a href="/admin/login">登录</a>
</shiro:guest>
</body> </html>

通过<shiro:user> , <shiro:principal />来判定登录后的展示,如,欢迎,谁谁谁(用户名) <shiro:guest> 来展示未登录的用户,显示登录选项

[Shiro] - Shiro之SpringBoot中的使用的更多相关文章

  1. SpringBoot中Shiro缓存使用Redis、Ehcache

    在SpringBoot中Shiro缓存使用Redis.Ehcache实现的两种方式实例 SpringBoot 中配置redis作为session 缓存器. 让shiro引用 本文是建立在你是使用这sh ...

  2. SpringBoot中Shiro使用Pac4j集成CAS认证

    SpringBoot中Shiro使用Pac4j集成CAS认证 Pac4j 简介 Pac4j与Shiro,Spring Security一样都是权限框架,并且提供了OAuth - SAML - CAS ...

  3. SpringBoot中整合Redis、Ehcache使用配置切换 并且整合到Shiro中

    在SpringBoot中Shiro缓存使用Redis.Ehcache实现的两种方式实例 SpringBoot 中配置redis作为session 缓存器. 让shiro引用 本文是建立在你是使用这sh ...

  4. shiro,基于springboot,基于前后端分离,从登录认证到鉴权,从入门到放弃

    这个demo是基于springboot项目的. 名词介绍: ShiroShiro 主要分为 安全认证 和 接口授权 两个部分,其中的核心组件为 Subject. SecurityManager. Re ...

  5. shiro:集成Springboot(六)

    1:导入相关依赖 <!--thymeleaf 模板引擎依赖包--> <dependency> <groupId>org.springframework.boot&l ...

  6. 记录一下在SpringBoot中实现简单的登录认证

    代码参考博客: https://blog.csdn.net/weixin_37891479/article/details/79527641 在做学校的课设的时候,发现了安全的问题,就不怀好意的用户有 ...

  7. SpringBoot中application.yml基本配置详情

    把原有的application.properties删掉.然后 maven -X clean install,或者通过Maven Project双击clean和install(1)端口服务配置 #端口 ...

  8. Shiro Shiro Web Support and EnvironmentLoaderListener

    Shiro Shiro Web Support 主要参考: http://shiro.apache.org/web.html 还有涛哥的 作为资源控制访问的事情,主要使用在网络后台方面,所以了解了本地 ...

  9. SpringBoot中yaml配置对象

    转载请在页首注明作者与出处 一:前言 YAML可以代替传统的xx.properties文件,但是它支持声明map,数组,list,字符串,boolean值,数值,NULL,日期,基本满足开发过程中的所 ...

  10. 如何在SpringBoot中使用JSP ?但强烈不推荐,果断改Themeleaf吧

    做WEB项目,一定都用过JSP这个大牌.Spring MVC里面也可以很方便的将JSP与一个View关联起来,使用还是非常方便的.当你从一个传统的Spring MVC项目转入一个Spring Boot ...

随机推荐

  1. PHP移动互联网开发笔记(6)——MySQL数据库基础回想

    近期看了一些架构方面的资料.可是发现基础知识都不怎么坚固,接下来的一段时间.我会定期总结基础知识. 一.数据类型   1.整型   数据类型 存储空间 说明 取值范围 TINYINT 1字节 很小的整 ...

  2. 009-java中常用的单个键值对

    1.Java 6提供AbstractMap.SimpleEntry<K,V>和AbstractMap.SimpleImmutableEntry<K,V> Map.Entry&l ...

  3. js-jquery-SweetAlert【二】配置方法

    一.配置 Argument Default value 含义   Description title null (required) 模态对话框的标题.它可以在参数对象的title参数中设置,也可以在 ...

  4. 【剑指offer】输入一个链表,输出该链表中倒数第k个结点。

    一.题目: 输入一个链表,输出该链表中倒数第k个结点. 二.思路: 用两个指针p1和p2,p2先跑k步,然后p1和p2同时跑,p2跑到头p1所在的位置就是倒数第k个节点.很简单吧?简单你也想不到,想到 ...

  5. 用lua扩展你的Nginx(整理)

    首先得声明.这不是我的原创,是在网上搜索到的一篇文章,原著是谁也搞不清楚了.按风格应该是属于章亦春的文章. 整理花了不少时间,所以就暂写成原创吧. 一. 概述 Nginx是一个高性能.支持高并发的,轻 ...

  6. POJ2488:A Knight's Journey(dfs)

    http://poj.org/problem?id=2488 Description Background The knight is getting bored of seeing the same ...

  7. POJ1258:Agri-Net(最小生成树模板题)

    http://poj.org/problem?id=1258 Description Farmer John has been elected mayor of his town! One of hi ...

  8. checkbox选择

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  9. [LeetCode] 152. Maximum Product Subarray_Medium tag: Dynamic Programming

    Given an integer array nums, find the contiguous subarray within an array (containing at least one n ...

  10. VCS中的覆盖率分析

    VCS在仿真过程中,也可以收集Coverage Metric.其中覆盖率类型有: 1)Code Coverage:包括control_flow和value两部分的coverage,line_cover ...