下载了运行项目后,访问路径: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. 给JSON中put的value=null时,这对key=value会被隐藏掉。

    当我们在JSON里像这样json.put("key",null);put值进去的话,这个键值对就会被隐藏掉例如下面的例子: <pre name="code" ...

  2. fish shell 下gopath的设置问题

    GOPATH可以设置多个工程目录,linux下用冒号分隔(必须用冒号,fish shell的空格分割会出错),windows下用分号分隔,但是go get 只会下载pkg到第一个目录,但是编译的时候会 ...

  3. 关hashMap跟hashTable的区别

    1.HashMap和Hashtable都实现了Map接口 2.HashMap是非synchronized,而Hashtable是synchronized 3.HashTable使用Enumeratio ...

  4. [django]django的orm查询

    实体 实体 出版社 category 作者 tag 书 文章 先学习一下基础的增删查改 django orm增删改查: https://www.cnblogs.com/iiiiiher/article ...

  5. Andrew Ng-ML-第八章-正则化

    1.过度拟合overfitting 过度拟合,因为有太多的特征+过少的训练数据,学习到的假设可能很适应训练集,但是不能泛化到新的样例.即泛化generalize能力差. 解决办法: 1.手动/使用选择 ...

  6. iOS 网易彩票-4设置模块一

    概述 基本上,每一款APP都有相应的设置模块.怎么设置才能更灵活和通用呢,这也是大家一直思考的.下面说说在网易彩票中,设置模块的设置思想. 基本上有三种方案: static cell(呆板,完全没有动 ...

  7. 将Mongo装为Windows的服务

    PHP的mongo扩展: 首先 下载一个PHP的mongo扩展, 地址:http://download.csdn.net/detail/qq_36387589/9819259 然后修改php.ini. ...

  8. php深入学习

    关于PHP程序员解决问题的能力 http://rango.swoole.com/archives/340 深入理解PHP内核 by xuhong大牛 http://www.php-internals. ...

  9. apache源码安装

    1.apr和apr-util,下载地址: http://apr.apache.org/download.cgi yum install gcc yum install libtool yum inst ...

  10. centos6更改密码

    创建新用户 创建一个用户名为:zhangbiao [root@localhost ~]# adduser zhangbiao 为这个用户初始化密码,linux会判断密码复杂度,不过可以强行忽略: [r ...