下载了运行项目后,访问路径: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. 【Python练习】文件引用用户名密码登录系统

    一.通过txt文件引入用户名密码 1 #coding=utf-8 from selenium import webdriver #from selenium.common.exceptions imp ...

  2. android studio 自定义控件

    第一种方式: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:andro ...

  3. MySQL多线程备份工具:mydumper

    MySQL多线程备份工具:mydumper http://www.orczhou.com/index.php/2011/12/how-to-split-mysqldump-file/ Mydumper ...

  4. keepalived的log

    vrrp_script chk_http_port { script "</dev/tcp/127.0.0.1/8088" interval 1 weight -2 } ke ...

  5. vuex使用

    1.装包:npm install vuex -S 2.引入:import Vuex from 'vuex'      //这些都是写在man.js中 3.加载到Vue中:Vue.use(Vuex) 4 ...

  6. ssm后台开发及发布

    本文详细讲解一下后台的创建及发布过程,包括踩过的坑 1:首先创建war包形式的maven工程 File>new>Maven project>Create a simple proje ...

  7. break continue练习

    break :跳出 1.当break单独存在时,下面不要定义其他语句,因为执行不到. 2.如果出现了循环嵌套,break响应跳出指定的循环,可以通过标号来完成 例如: continue:要么是swit ...

  8. Ember.js学习教程 -- 目录

    写在前面的话: 公司的新项目需要用到Ember.js,版本为v1.13.0.由于网上关于Ember的资料非常少,所以只有硬着头皮看官网的Guides,为了加深印象和方便以后查阅就用自己拙劣的英语水平把 ...

  9. 用户用户组管理:用户管理命令-passwd

    passwd直接回车就是给root设密码.或加root. 普通用户只能改自己的密码.改时直接敲passwd,回车.否则报错. 因为只有root可以在passwd后加用户名.其实最常见的就是不加选项. ...

  10. Input消除自动记忆功能

    在html里就可以直接清除了<input type="text" autocomplete="off"> input 的autocomplete属性 ...