文章目录

  • Shiro概述
    • 主要特征
    • shiro如何工作
  • 官方快速开始代码分析
  • Springboot整合Shiro
    • 导入依赖
    • 创建配置类ShiroConfig
    • 创建Realm
    • 创建控制器
    • 创建静态页面
    • 配置过滤器
    • 配置Realm认证方法
  • Shiro整合Mybatis
  • 实现Realm从数据库中查找用户信息
  • Shiro授权操作
  • Shiro整合Thymeleaf
  • 退出登录操作

Shiro概述

主要特征

img

Shiro提供了如上图所示的特性,其中主要特性(其开发团队称之为应用安全的四大基石)如下:

  • Authentication - 身份认证 (与登陆相关,确定用户是谁)
  • Authorization - 确认权限 (确定用户能访问什么)
  • Session Management - 会话管理
  • Cryptography - 数据加密

shiro如何工作

img

应用代码的交互对象是 “Subject”,该对象代表了当前 “用户”,而所有用户的安全操作都会交给 SecurityManager 来管理,而管理过程中会从 Realm 中获取用户对应的角色和权限,可以把 Realm 堪称是安全数据源

使用最简单的 Shiro 应用:

  • 通过 Subject 来进行认证和授权,而 Subject 又委托给了 SecurityManager 进行管理
  • 我们需要给 SecurityManager 注入 Realm 以便其获取用户和权限进行判断
  • (也即,Shiro 不提供用户和权限的维护,需要由开发者自行通过 Realm 注入)

内部详细流程

在这里插入图片描述

三个核心组件:Subject, SecurityManager 和 Realms

  • Subject:即“当前操作用户”,它仅仅意味着“当前跟软件交互的东西”
  • SecurityManager:它是Shiro框架的核心,Shiro通过SecurityManager来管理内部组件实例,并通过它来提供安全管理的各种服务
  • Authenticator:负责 Subject 认证,是一个扩展点,可以自定义实现;可以使用认证策略(Authentication Strategy),即什么情况下算用户认证通过了
  • Authorizer:授权器、即访问控制器,用来决定主体是否有权限进行相应的操作;即控制着用户能访问应用中的哪些功能
  • SessionManager:管理 Session 生命周期的组件;会话管理,即用户登录后就是一次会话,在没有退出之前,它的所有信息都在会话中;
  • Realm:充当了Shiro与应用安全数据间的“桥梁”或者“连接器”。也就是说,当对用户执行认证(登录)和授权(访问控制)验证时,Shiro会从应用配置的Realm中查找用户及其权限信息。Realm实质上是一个安全相关的DAO:它封装了数据源的连接细节,并在需要时将相关数据提供给Shiro。当配置Shiro时,你必须至少指定一个Realm,用于认证和(或)授权。配置多个Realm是可以的,但是至少需要一个
  • CacheManager:缓存控制器,来管理如用户、角色、权限等的缓存的;因为这些数据基本上很少改变,放到缓存中后可以提高访问的性能
  • Cryptography:密码模块,Shiro 提高了一些常见的加密组件用于如密码加密/解密

官方快速开始代码分析

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.*;
import org.apache.shiro.ini.IniSecurityManagerFactory;
import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.lang.util.Factory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;public class Quickstart {private static final transient Logger log = LoggerFactory.getLogger(Quickstart.class);public static void main(String[] args) {// The easiest way to create a Shiro SecurityManager with configured// realms, users, roles and permissions is to use the simple INI config.// We'll do that by using a factory that can ingest a .ini file and// return a SecurityManager instance:// Use the shiro.ini file at the root of the classpath// (file: and url: prefixes load from files and urls respectively):Factory<SecurityManager> factory = new IniSecurityManagerFactory("classpath:shiro.ini");SecurityManager securityManager = factory.getInstance();// for this simple example quickstart, make the SecurityManager// accessible as a JVM singleton.  Most applications wouldn't do this// and instead rely on their container configuration or web.xml for// webapps.  That is outside the scope of this simple quickstart, so// we'll just do the bare minimum so you can continue to get a feel// for things.SecurityUtils.setSecurityManager(securityManager);// Now that a simple Shiro environment is set up, let's see what you can do:// get the currently executing user:// 获取当前的用户对象Subject currentUser = SecurityUtils.getSubject();// Do some stuff with a Session (no need for a web or EJB container!!!)// 通过当前用户获得SessionSession session = currentUser.getSession();session.setAttribute("someKey", "aValue");String value = (String) session.getAttribute("someKey");if (value.equals("aValue")) {log.info("Retrieved the correct value! [" + value + "]");}// let's login the current user so we can check against roles and permissions:// 判断当前用户是否被认证if (!currentUser.isAuthenticated()) {// 通过用户名和密码生成tokenUsernamePasswordToken token = new UsernamePasswordToken("lonestarr", "vespa");// 设置RememberMetoken.setRememberMe(true);try {// 执行登录currentUser.login(token);} catch (UnknownAccountException uae) {log.info("There is no user with username of " + token.getPrincipal());} catch (IncorrectCredentialsException ice) {log.info("Password for account " + token.getPrincipal() + " was incorrect!");} catch (LockedAccountException lae) {log.info("The account for username " + token.getPrincipal() + " is locked.  " +"Please contact your administrator to unlock it.");}// ... catch more exceptions here (maybe custom ones specific to your application?catch (AuthenticationException ae) {//unexpected condition?  error?}}//say who they are://print their identifying principal (in this case, a username):log.info("User [" + currentUser.getPrincipal() + "] logged in successfully.");//test a role:if (currentUser.hasRole("schwartz")) {log.info("May the Schwartz be with you!");} else {log.info("Hello, mere mortal.");}//test a typed permission (not instance-level)if (currentUser.isPermitted("lightsaber:wield")) {log.info("You may use a lightsaber ring.  Use it wisely.");} else {log.info("Sorry, lightsaber rings are for schwartz masters only.");}//a (very powerful) Instance Level permission:if (currentUser.isPermitted("winnebago:drive:eagle5")) {log.info("You are permitted to 'drive' the winnebago with license plate (id) 'eagle5'.  " +"Here are the keys - have fun!");} else {log.info("Sorry, you aren't allowed to drive the 'eagle5' winnebago!");}//all done - log out!currentUser.logout();System.exit(0);}
}

shiro.ini

# =============================================================================
# Quickstart INI Realm configuration
#
# For those that might not understand the references in this file, the
# definitions are all based on the classic Mel Brooks' film "Spaceballs". ;)
# =============================================================================# -----------------------------------------------------------------------------
# Users and their assigned roles
#
# Each line conforms to the format defined in the
# org.apache.shiro.realm.text.TextConfigurationRealm#setUserDefinitions JavaDoc
# -----------------------------------------------------------------------------
[users]
# user 'root' with password 'secret' and the 'admin' role
root = secret, admin
# user 'guest' with the password 'guest' and the 'guest' role
guest = guest, guest
# user 'presidentskroob' with password '12345' ("That's the same combination on
# my luggage!!!" ;)), and role 'president'
presidentskroob = 12345, president
# user 'darkhelmet' with password 'ludicrousspeed' and roles 'darklord' and 'schwartz'
darkhelmet = ludicrousspeed, darklord, schwartz
# user 'lonestarr' with password 'vespa' and roles 'goodguy' and 'schwartz'
lonestarr = vespa, goodguy, schwartz# -----------------------------------------------------------------------------
# Roles with assigned permissions
# 
# Each line conforms to the format defined in the
# org.apache.shiro.realm.text.TextConfigurationRealm#setRoleDefinitions JavaDoc
# -----------------------------------------------------------------------------
[roles]
# 'admin' role has all permissions, indicated by the wildcard '*'
admin = *
# The 'schwartz' role can do anything (*) with any lightsaber:
schwartz = lightsaber:*
# The 'goodguy' role is allowed to 'drive' (action) the winnebago (type) with
# license plate 'eagle5' (instance specific id)
goodguy = winnebago:drive:eagle5

总结核心代码

// 获取当前的用户对象
Subject currentUser = SecurityUtils.getSubject();// 通过当前用户获得Session
Session session = currentUser.getSession();// 判断当前用户是否被认证
currentUser.isAuthenticated// 获取当前用户认证
currentUser.getPrincipal()// 获取当前用户被认证的角色
currentUser.hasRole("schwartz")// 获取用户的权限
currentUser.isPermitted("lightsaber:wield")// 执行退出
currentUser.logout();

Springboot整合Shiro

导入依赖

<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.apache.shiro</groupId><artifactId>shiro-spring</artifactId><version>1.5.1</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-thymeleaf</artifactId><version>2.2.5.RELEASE</version></dependency>

创建配置类ShiroConfig

package com.jason.shiro.config;import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;/*** @authot jason_yan* @date 2020/6/17-11:10*/
@Configuration
public class ShirConfig {// 3、ShiroFilterFactoryBean@Beanpublic ShiroFilterFactoryBean getShiroFilterFactoryBean(@Qualifier("securityManager") DefaultWebSecurityManager securityManager){ShiroFilterFactoryBean filterFactoryBean = new ShiroFilterFactoryBean();// 关联 securityManagerfilterFactoryBean.setSecurityManager(securityManager);return filterFactoryBean;}// 2、DefaultWebSecurityManager@Bean(name="securityManager")public DefaultWebSecurityManager getDefaultWebSecurityManager(@Qualifier("userRealm") UserRealm userRealm){DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();// 关联UserRealmsecurityManager.setRealm(userRealm);return securityManager;}// 1、创建 realm 对象@Beanpublic UserRealm userRealm(){return new UserRealm();}
}

创建Realm

继承于 AuthorizingRealm

package com.jason.shiro.config;import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;/*** @authot jason_yan* @date 2020/6/17-11:17*/
public class UserRealm extends AuthorizingRealm {// 授权操作@Overrideprotected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {System.out.println("执行了授权AuthorizationInfo");return null;}// 认证操作@Overrideprotected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException {System.out.println("执行了认证AuthenticationInfo");return null;}
}

创建控制器

package com.jason.shiro.controller;import com.sun.org.apache.xpath.internal.operations.Mod;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;/*** @authot jason_yan* @date 2020/6/17-10:55*/
@Controller
public class IndexController {@GetMapping({"/index","/"})public String toIndex(Model model){model.addAttribute("msg","hello shiro");return "index";}@GetMapping("/add")public String toAdd(){return "add";}@GetMapping("/update")public String toUpdate(){return "update";}
}

创建静态页面

add和update页面 略(页面内容随便写)

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head><meta charset="UTF-8"><title>Title</title>
</head>
<body><h1>首页</h1><p th:text="${msg}"></p><a th:href="@{/add}">add something</a><a th:href="@{/update}">update something</a>
</body>
</html>

配置过滤器

// 3、ShiroFilterFactoryBean
@Bean
public ShiroFilterFactoryBean getShiroFilterFactoryBean(@Qualifier("securityManager") DefaultWebSecurityManager securityManager){ShiroFilterFactoryBean filterFactoryBean = new ShiroFilterFactoryBean();// 关联安全管理器filterFactoryBean.setSecurityManager(securityManager);// 配置过滤器/*** 配置哪些页面需要受保护.  以及访问这些页面需要的权限.*  1). anon 可以被匿名访问,即不需要登录即可访问*  2). authc 必须认证(即登录)后才可能访问的页面.*  3). user 必须拥有 记住我 才能使用*  4). perms 拥有对某个资源的权限才能访问*  5). roles 拥有某个角色才能访问*  6). logout 当前用户退出登录*/Map<String,String> filterMap = new LinkedHashMap();filterMap.put("/index","anon");filterMap.put("/add","authc");filterMap.put("/update","authc");filterFactoryBean.setFilterChainDefinitionMap(filterMap);// 如果没有认证(即登录)进行登录请求filterFactoryBean.setLoginUrl("/login");return filterFactoryBean;
}

控制器实现跳转至登录页面

@GetMapping("/login")public String toLogin(){return "login";}

配置登录页面 login.html

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head><meta charset="UTF-8"><title>Title</title>
</head>
<body><h1>用户登录页面</h1><hr><form th:action="@{/do/login}"><p>username:<input type="text" name="username" placeholder="用户名"/></p><p>password:<input  type="password" name="password" placeholder="密码"/></p><p><input type="submit" value="登录"></input></p></form>
</body>
</html>

当用户没有进行登录的时候 访问 add something update something 的 时候需要进行登录,才可以访问

配置Realm认证方法

在控制器中执行登录操作

@GetMapping("/do/login")
public String login(String username, String password, Model model){// 获取已登录的用户信息Subject subject = SecurityUtils.getSubject();// 封装用户的登录数据UsernamePasswordToken token = new UsernamePasswordToken(username, password);try {// 执行登录subject.login(token);// 登陆成功返回首页 return "index";} catch (UnknownAccountException uae) {model.addAttribute("msg","用户名错误");	// 同时在登录页面login.html中 获取错误信息<p th:text="${msg}" style="color: red"></p>return "login";} catch (IncorrectCredentialsException ice) {model.addAttribute("msg","密码错误");return "login";}
}

当用户登陆信息提交后,在Realm中的doGetAuthenticationInfo()方法中对用户进行认证(查数据库匹配信息)

// 认证操作
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {System.out.println("执行了认证AuthenticationInfo");// token是从controller中传递过来的,在此处实现真正的登录操作// 在数据库中获取用户名和密码String name = "admin";String password = "111111";UsernamePasswordToken userToken = (UsernamePasswordToken) token;// 判断从前端输入的用户名与数据库中用户名是否匹配if (!userToken.getUsername().equals(name)){return null; // 自动抛出UnknownAccountException异常}// 密码认证,使用shiro的SimpleAuthenticationInfo实现SimpleAuthenticationInfo info = new SimpleAuthenticationInfo("", password, "");return info;
}

Shiro整合Mybatis

导入依赖

<dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency><groupId>log4j</groupId><artifactId>log4j</artifactId><version>1.2.17</version>
</dependency>
<dependency><groupId>com.alibaba</groupId><artifactId>druid</artifactId><version>1.1.20</version>
</dependency><dependency><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter</artifactId><version>2.1.3</version>
</dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><optional>true</optional>
</dependency>

创建数据库db_shiro并创建用户角色表

添加用户:admin,zs,ls

CREATE TABLE `tb_user` (`id` int(11) NOT NULL AUTO_INCREMENT,`username` varchar(255) DEFAULT NULL,`password` varchar(255) DEFAULT NULL,PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

配置 application.yml 文件

spring:datasource:username: rootpassword: 123456driver-class-name: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://localhost:3306/db_shiro?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=Asia/Shanghaitype: com.alibaba.druid.pool.DruidDataSourcemybatis:mapper-locations: classpath:/mapper/*.xmltype-aliases-package: com.jason.shiro.entityfilters: stat,wall,log4j
maxPoolPrearedStatementPerConnectionSize: 20
useGlobalDataSourceStat: true
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500

创建User

package com.jason.shiro.entity;import lombok.*;/*** @authot jason_yan* @date 2020/6/17-15:13*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {private int id;private String username;private String password;
}

在resource目录下(classpath)创建mapper文件夹 并配置UserMapper.xml文件

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.jason.shiro.mapper.UserMapper" ><select id="queryUserByName" parameterType="String" resultType="User">select * from tb_user where username = #{username}</select>
</mapper>

创建Mapper接口

package com.jason.shiro.mapper;import com.jason.shiro.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;/*** @authot jason_yan* @date 2020/6/17-15:23*/@Repository
@Mapper
public interface UserMapper {public User queryUserByName(String username);
}

创建service

package com.jason.shiro.servce;import com.jason.shiro.entity.User;/*** @authot jason_yan* @date 2020/6/17-15:34*/
public interface UserService {public User queryUserByName(String username);
}

创建service实现类

package com.jason.shiro.servce.impl;import com.jason.shiro.entity.User;
import com.jason.shiro.mapper.UserMapper;
import com.jason.shiro.servce.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;/*** @authot jason_yan* @date 2020/6/17-15:35*/
@Service
public class UserServiceImpl implements UserService {@Autowiredprivate UserMapper userMapper;@Overridepublic User queryUserByName(String username) {return userMapper.queryUserByName(username);}
}

实现Realm从数据库中查找用户信息

@Autowired
UserService userService;...// 认证操作@Overrideprotected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {System.out.println("执行了认证AuthenticationInfo");// token是从controller中传递过来的,在此处实现真正的登录操作UsernamePasswordToken userToken = (UsernamePasswordToken) token;// 在数据库中获取用户名和密码User user = userService.queryUserByName(userToken.getUsername());// 判断从前端输入的用户名与数据库中用户名是否匹配if (user == null){return null; // UnknownAccountException}// 密码认证,使用shiro的SimpleAuthenticationInfo实现SimpleAuthenticationInfo info = new SimpleAuthenticationInfo("", user.getPassword(), "");return info;
}

Shiro授权操作

ShiroConfig类的getShiroFilterFactoryBean()方法中,对特定页面添加字段(权限)

针对权限匹配

@Bean
public ShiroFilterFactoryBean getShiroFilterFactoryBean(@Qualifier("securityManager") DefaultWebSecurityManager securityManager){...// 拦截部分页面filterMap.put("/index","anon");filterMap.put("/add","authc");filterMap.put("/update","authc");// 授权:指定角色的访问权限,如果没有权限的话会跳转至未授权页面filterMap.put("/add","perms[user:add]"); // 若用户含拥有"user:add"字段,则可以访问add页面filterMap.put("/update","perms[user:update]");// 若用户含拥有"user:update"字段,则可以访问update页面    filterFactoryBean.setFilterChainDefinitionMap(filterMap);// 如果没有认证(即没有登录),则进行登录请求filterFactoryBean.setLoginUrl("/login");// 设置没有权限的用户 越权后跳转的页面filterFactoryBean.setUnauthorizedUrl("/unauthc");return filterFactoryBean;
}

在控制器中设置 当用户权限不足时的跳转页面

@GetMapping("/unauthc")
public String unAuthc(){return "unauthc";
}

创建 unauthc.html 页面

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head><meta charset="UTF-8"><title>Title</title>
</head>
<body><h1>您当前权限不足以访问此功能</h1><a th:href="@{/index}">返回主页</a>
</body>
</html>

Realm的doGetAuthorizationInfo()方法中对用户添加权限addStringPermission()

package com.jason.shiro.config;import com.jason.shiro.entity.User;
import com.jason.shiro.servce.UserService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.*;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;/*** @authot jason_yan* @date 2020/6/17-11:17*/
public class UserRealm extends AuthorizingRealm {@AutowiredUserService userService;// 授权操作@Overrideprotected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {System.out.println("执行了授权AuthorizationInfo");SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();// 获取当前登录对象Subject subject = SecurityUtils.getSubject();// 得到User对象User currentUser = (User) subject.getPrincipal();if (currentUser.getUsername().equals("zs")){info.addStringPermission("user:add");return info;}else if (currentUser.getUsername().equals("ls")){info.addStringPermission("user:update");return info;}else {return null;}}// 认证操作@Overrideprotected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {...SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(user, user.getPassword(), "");return info;}
}

当zs登录时,赋予张三user:add字段,当ls登录时,赋予李四user:update字段,然后在过滤器中匹配相应的权限

对死代码进行改造:除了根据字段对用户进行授权操作外,和可以根据身份角色进行授权

在数据库 tb_user表中添加roles属性(也可以添加perms属性-其值为user:add/user:update):表名每个人对应的角色

其中 admin … user:admin、zs … user:add、ls … user:update

同时为entity包中 User对象添加属性

private String role;

改造Realm中的死代码

protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {...// 获取当前登录对象Subject subject = SecurityUtils.getSubject();// 得到User对象User currentUser = (User) subject.getPrincipal();if (currentUser != null){info.addRole(currentUser.getRole());return info;}else {return null;}...
}

在ShiroConfig中改造拦截器

@Bean
public ShiroFilterFactoryBean getShiroFilterFactoryBean(@Qualifier("securityManager") DefaultWebSecurityManager securityManager){...// 授权:指定角色的访问权限,如果没有权限的话会跳转至未授权页面filterMap.put("/add","roles[add]"); // 用户的角色认证filterMap.put("/update","roles[update]");...}

Shiro整合Thymeleaf

当张三登录时,只显示在自己权限范围内的功能页面,李四也是如此

Shiro整合Thymeleaf需要导入依赖

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

在ShiroConfig类中添加整合thymeleaf的Bean

// 整合ShiroDialect:用来整合shiro thymeleaf
@Bean
public ShiroDialect getShiroDialect(){return new ShiroDialect();
}

将当前用户登录的状态放入session中:如果有用户登录则加入session

在Realm认证(登录)操作中添加

// 认证操作
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {...// 将当前用户信息放入session中,供前端 获取用户在线状态Subject subject = SecurityUtils.getSubject();Session session = subject.getSession();session.setAttribute("loginUser",user);// 密码认证,使用shiro的SimpleAuthenticationInfo实现SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(user, user.getPassword(), "");return info;
}

修改 index.html 主页

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"xmlns:shiro="http://www.thymeleaf.org/thymeleaf-extras-shiro">
<head><meta charset="UTF-8"><title>Title</title>
</head>
<body><h1>首页</h1><hr><p th:text="${msg}"></p><p th:if="${#strings.isEmpty(session.loginUser)}"><a th:href="@{/do/login}">登录</a></p><p><div shiro:hasRole="add"><a th:href="@{/add}">add something</a></div><div shiro:hasRole="update"><a th:href="@{/update}">update something</a></div></p></body>
</html>

退出登录操作

在ShiroConfig 过滤器中添加

filterMap.put("/logout",“logout”);

添加退出登录的请求按钮及链接

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"xmlns:shiro="http://www.thymeleaf.org/thymeleaf-extras-shiro">
<head><meta charset="UTF-8"><title>Title</title>
</head>
<body><h1>首页</h1><hr><p th:text="${msg}"></p><p th:if="${#strings.isEmpty(session.loginUser)}"><a th:href="@{/do/login}">登录</a></p><p><div shiro:hasRole="add"><a th:href="@{/logout}">退出登录</a> |<a th:href="@{/add}">add something</a></div><div shiro:hasRole="update"><a th:href="@{/logout}">退出登录</a> |<a th:href="@{/update}">update something</a></div></p></body>
</html>
查看全文
如若内容造成侵权/违法违规/事实不符,请联系编程学习网邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

相关文章

  1. CANoe软件使用(三)——DBC编辑

    CANoe软件使用(三)——DBC编辑目录信号信息信号编辑报文编辑节点编辑 目录 本节主要介绍下通过CANdb++Editor进行DBC内容的编辑,通过CANoe自带的easy模板进行介绍。通过File——Sample Configurations打开Easy模板,并打开Easy模板自带的DBC。如下:信号信息 通过之前车速信…...

    2024/5/5 5:16:13
  2. 关于小程序中使用three.js,预览无法显示贴图图片问题,图片的像素必须为2^n,且最大像素为1024*2048,且宽高比为1:1或者1:2。

    图片的像素必须为2^n,且最大像素为1024*2048,且宽高比为1:1或者1:2。...

    2024/4/24 13:08:54
  3. nginx的安装与基本介绍

    实验环境:centos7.6,2G内存,50G硬盘大小,虚拟机ip:172.16.1.7,172.16.1.8,172.16.1.9 nginx服务的特点: 1)支持高并发,消耗内存资源少 2)具有多种功能 a.网站web服务功能 --apache b.网站负载均衡功能 --LVS c.网站缓存功能 --Squid 3)在多种平台上都可以进行部署 4)nginx实现…...

    2024/4/24 13:08:53
  4. linux低级挖矿病毒的查找定位

    现象 挖矿病毒的特点之一就是会表现出CPU负载接近饱和,因此先用free -m指令查看CPU的负荷情况。 定位使用ps -aux | head -1;ps -aux |grep -v "USER" | sort -nr -k 3 | head 命令解析:查看CPU占用百分比前十的进程。head -1显示第一行,grep -v取反,sort -nr按照…...

    2024/4/19 23:03:15
  5. android 根据状态栏高度调整标题栏的高度

    根据状态栏高度调整标题栏的高度int statubarHeight = ImmersiveStatusBar.getStatusBarHeight(getActivity());Logger.d("--getStatusBarHeight","--statubarHeight:"+statubarHeight);int uiStatubarHeight = DimensionUtility.dip2px(getActivity(), 2…...

    2024/4/18 17:24:19
  6. 吴恩达机器学习练习题python实现ex2_1(Logistic Regression)

    import numpy as np import pandas as pd import matplotlib.pyplot as plt path = ‘ex2data1.txt’ data = pd.read_csv(path,names = [‘exam1’,‘exam2’,‘accepted’]) fig,ax = plt.subplots() ax.scatter(data[data[‘accepted’]== 0][‘exam1’],data[data[‘accept…...

    2024/4/15 4:11:35
  7. [数据结构]悲剧文本(链表)

    悲剧文本 问题描述 : 你有一个破损的键盘。键盘上的所有键都可以正常工作,但有时Home键或者End键会自 动按下。你并不知道键盘存在这一问题,而是专心地输入英文单词,甚至连显示器都没瞧一眼。当你 看显示器时,展现在你面前的是一段悲剧的文本。你的任务是计算这段文本有几个…...

    2024/4/25 9:57:30
  8. Java学习日志1

    一、常用DOS命令(win+R输入cmd打开) d: 回车 盘符切换 dir(directory):列出当前目录下的文件以及文件夹 md (make directory) : 创建目录 rd (remove directory): 删除目录 cd (change directory)改变指定目录(进入指定目录) cd… : 退回到上一级目录 cd: 退回到根目录 del (…...

    2024/4/16 9:47:51
  9. 20200617 SCOI模拟T1(状压dp)

    T1 P4460 [CQOI2018]解锁屏幕 思路: 先看数据范围,想到状压 发现最后一个到达的点对 dp 有影响,于是记录一下 dp[i][j]dp[i][j]dp[i][j] 表示状态为 i,最后一个点为 j 的状态数 如果 j 到 k 点间的点全部走过,有转移方程 dp[i∣(1<<k)][k]+=dp[i][j] dp[i|(1<<…...

    2024/4/15 4:11:33
  10. 《C++ Primer Plus》读书笔记(思维导图)第一章

    ...

    2024/4/15 4:11:31
  11. jQuery静态方法

    jQuery静态方法 静态方法each方法原生JS中forEach方法第一个参数: 遍历到的元素 第二个参数: 当前遍历到的索引 原生的forEach方法只能遍历数组, 不能遍历伪数组let arr = [1,2,3,4,5,6] arr.forEach(function(value,index){console.log(index,value) })jQuery中each方法第一个…...

    2024/4/15 4:11:30
  12. js事件流,dom操作的方法

    js事件流,dom操作的方法 事件流: 事件流:也就是事件触发的顺序 事件流包括三个阶段:捕获阶段、目标阶段、冒泡阶段 事件冒泡:事件由最具体元素触发,向上传播的过程; 处于目标阶段:触发事件的那个节点,(目标元素); 捕获阶段:事件由不具体的元素向下查找,直到找到你…...

    2024/4/15 4:11:29
  13. java.lang.Noclassdeffounderror:javax/json/Json

    原因:缺少org.glassfish依赖包的问题,找不到ClassPath路径 引入依赖重启服务即可:<!--导入json依赖--><dependency><groupId>javax.json</groupId><artifactId>javax.json-api</artifactId><version>1.1</version></dep…...

    2024/4/16 17:04:59
  14. execute()、executeQuery()和executeUpdate()之间的区别

    PreparedStatement对象执行sql语句的方法。 execute() 可执行任何sql语句,方法返回值是Boolean类型。如果执行的是查询操作,并由返回结果,则此方法返回true;如果执行的是增删改操作,没有返回结果,则此方法返回false。 executeQuery() 只能用来执行查询语句,执行后返回结…...

    2024/4/15 4:11:29
  15. 循环链表——魔术师发牌问题和拉丁方阵

    问题描述: 魔术师利用一副牌中的13张黑牌,预先将他们排好后叠放在一起,牌面朝下。对观众说:“我不看牌,只数数就可以猜到每张牌是什么,我大声数数,你们听,不信?现场演示。魔术师将最上面的那张牌数为1,把他翻过来正好是黑桃A,将黑桃A放在桌子上,第二次数1,2,将第一张…...

    2024/4/15 4:11:27
  16. 【Leccture 4.1】Classes and Objects - the Basics

    文章目录Week by week20.1. Introduction: Classes and Objects - the Basics20.1.1. Object-oriented programming20.2. Objects Revisited20.3. User Defined Classes20.4. Adding Parameters to the Constructor20.5. Adding Other Methods to a Class使用 class 来表示 dat…...

    2024/4/24 13:08:54
  17. 波形自定义控件(六):原理解析之监听器

    上一篇讲解了如何在自定义控件中进行性能优化,本篇来讲解如何给自定义控件添加监听器。 基本方法 说到监听器,相信OnClickListener是大家所熟知的,控件被点击后就会调用OnCLickListener的回调方法。按照这个原理我们也可以自己为自定义控件设计一种监听器。 首先我们要想好要…...

    2024/4/24 13:08:52
  18. 用正则表达式简单验证

    这是一篇简单的博客,希望对你有所帮助。 什么是正则表达式?正则表达式( Regular Expression )是用于匹配字符串中字符组合的模式。在 JavaScript中,正则表达式也是对象。 正则表通常被用来检索、替换那些符合某个模式(规则)的文本,例如验证表单:用户 名表单只能输入英…...

    2024/4/24 13:08:50
  19. Netty 核心: ChannelPipeline

    Netty ChannelPipeline是Netty中非常核心的概念。每个SocketChannel包含一个ChannelPipeline。 ChannelPipeline包含ChannelHandler实例的列表。当数据进入和写出SocketChannel时,将调用这些ChannelHandler实例。ChannelHandler接口具有两个子接口:ChannelInboundHandlerChan…...

    2024/4/24 13:08:49
  20. 什么是CMA?你对CMA证书了解多少?

    我们常可以看到某检测机构在做企业介绍时,会重点突出自己具备了CMA资格证书来证明自己的实力和专业性***。根据计量认证管理法规规定,经计量认证合格的检测机构出具的数据,用于贸易的出证、产品质量评价、成果鉴定作为公证数据具有法律效力,而未经计量认证的技术机构为社会…...

    2024/4/15 4:11:54

最新文章

  1. LangChain 的 AI 代理的迷人思维

    我们将看另一种类型的代理&#xff0c;称为 ReAct 代理。这里的“ReAct”并不代表 React JavaScript 框架。它是 Reason&#xff08;推理&#xff09; Action&#xff08;行动&#xff09; ReAct 的组合。 让我们先创建 ReAct 代理&#xff0c;然后我们将学习它如何工作。 对…...

    2024/5/5 14:40:27
  2. 梯度消失和梯度爆炸的一些处理方法

    在这里是记录一下梯度消失或梯度爆炸的一些处理技巧。全当学习总结了如有错误还请留言&#xff0c;在此感激不尽。 权重和梯度的更新公式如下&#xff1a; w w − η ⋅ ∇ w w w - \eta \cdot \nabla w ww−η⋅∇w 个人通俗的理解梯度消失就是网络模型在反向求导的时候出…...

    2024/3/20 10:50:27
  3. 《前端防坑》- JS基础 - 你觉得typeof nullValue === null 么?

    问题 JS原始类型有6种Undefined, Null, Number, String, Boolean, Symbol共6种。 在对原始类型使用typeof进行判断时, typeof stringValue string typeof numberValue number 如果一个变量(nullValue)的值为null&#xff0c;那么typeof nullValue "?" const u …...

    2024/5/4 16:36:43
  4. ASP.NET Core 标识(Identity)框架系列(一):如何使用 ASP.NET Core 标识(Identity)框架创建用户和角色?

    前言 ASP.NET Core 内置的标识&#xff08;identity&#xff09;框架&#xff0c;采用的是 RBAC&#xff08;role-based access control&#xff0c;基于角色的访问控制&#xff09;策略&#xff0c;是一个用于管理用户身份验证、授权和安全性的框架。 它提供了一套工具和库&…...

    2024/5/1 13:12:26
  5. 【外汇早评】美通胀数据走低,美元调整

    原标题:【外汇早评】美通胀数据走低,美元调整昨日美国方面公布了新一期的核心PCE物价指数数据,同比增长1.6%,低于前值和预期值的1.7%,距离美联储的通胀目标2%继续走低,通胀压力较低,且此前美国一季度GDP初值中的消费部分下滑明显,因此市场对美联储后续更可能降息的政策…...

    2024/5/4 23:54:56
  6. 【原油贵金属周评】原油多头拥挤,价格调整

    原标题:【原油贵金属周评】原油多头拥挤,价格调整本周国际劳动节,我们喜迎四天假期,但是整个金融市场确实流动性充沛,大事频发,各个商品波动剧烈。美国方面,在本周四凌晨公布5月份的利率决议和新闻发布会,维持联邦基金利率在2.25%-2.50%不变,符合市场预期。同时美联储…...

    2024/5/4 23:54:56
  7. 【外汇周评】靓丽非农不及疲软通胀影响

    原标题:【外汇周评】靓丽非农不及疲软通胀影响在刚结束的周五,美国方面公布了新一期的非农就业数据,大幅好于前值和预期,新增就业重新回到20万以上。具体数据: 美国4月非农就业人口变动 26.3万人,预期 19万人,前值 19.6万人。 美国4月失业率 3.6%,预期 3.8%,前值 3…...

    2024/5/4 23:54:56
  8. 【原油贵金属早评】库存继续增加,油价收跌

    原标题:【原油贵金属早评】库存继续增加,油价收跌周三清晨公布美国当周API原油库存数据,上周原油库存增加281万桶至4.692亿桶,增幅超过预期的74.4万桶。且有消息人士称,沙特阿美据悉将于6月向亚洲炼油厂额外出售更多原油,印度炼油商预计将每日获得至多20万桶的额外原油供…...

    2024/5/4 23:55:17
  9. 【外汇早评】日本央行会议纪要不改日元强势

    原标题:【外汇早评】日本央行会议纪要不改日元强势近两日日元大幅走强与近期市场风险情绪上升,避险资金回流日元有关,也与前一段时间的美日贸易谈判给日本缓冲期,日本方面对汇率问题也避免继续贬值有关。虽然今日早间日本央行公布的利率会议纪要仍然是支持宽松政策,但这符…...

    2024/5/4 23:54:56
  10. 【原油贵金属早评】欧佩克稳定市场,填补伊朗问题的影响

    原标题:【原油贵金属早评】欧佩克稳定市场,填补伊朗问题的影响近日伊朗局势升温,导致市场担忧影响原油供给,油价试图反弹。此时OPEC表态稳定市场。据消息人士透露,沙特6月石油出口料将低于700万桶/日,沙特已经收到石油消费国提出的6月份扩大出口的“适度要求”,沙特将满…...

    2024/5/4 23:55:05
  11. 【外汇早评】美欲与伊朗重谈协议

    原标题:【外汇早评】美欲与伊朗重谈协议美国对伊朗的制裁遭到伊朗的抗议,昨日伊朗方面提出将部分退出伊核协议。而此行为又遭到欧洲方面对伊朗的谴责和警告,伊朗外长昨日回应称,欧洲国家履行它们的义务,伊核协议就能保证存续。据传闻伊朗的导弹已经对准了以色列和美国的航…...

    2024/5/4 23:54:56
  12. 【原油贵金属早评】波动率飙升,市场情绪动荡

    原标题:【原油贵金属早评】波动率飙升,市场情绪动荡因中美贸易谈判不安情绪影响,金融市场各资产品种出现明显的波动。随着美国与中方开启第十一轮谈判之际,美国按照既定计划向中国2000亿商品征收25%的关税,市场情绪有所平复,已经开始接受这一事实。虽然波动率-恐慌指数VI…...

    2024/5/4 23:55:16
  13. 【原油贵金属周评】伊朗局势升温,黄金多头跃跃欲试

    原标题:【原油贵金属周评】伊朗局势升温,黄金多头跃跃欲试美国和伊朗的局势继续升温,市场风险情绪上升,避险黄金有向上突破阻力的迹象。原油方面稍显平稳,近期美国和OPEC加大供给及市场需求回落的影响,伊朗局势并未推升油价走强。近期中美贸易谈判摩擦再度升级,美国对中…...

    2024/5/4 23:54:56
  14. 【原油贵金属早评】市场情绪继续恶化,黄金上破

    原标题:【原油贵金属早评】市场情绪继续恶化,黄金上破周初中国针对于美国加征关税的进行的反制措施引发市场情绪的大幅波动,人民币汇率出现大幅的贬值动能,金融市场受到非常明显的冲击。尤其是波动率起来之后,对于股市的表现尤其不安。隔夜美国股市出现明显的下行走势,这…...

    2024/5/4 18:20:48
  15. 【外汇早评】美伊僵持,风险情绪继续升温

    原标题:【外汇早评】美伊僵持,风险情绪继续升温昨日沙特两艘油轮再次发生爆炸事件,导致波斯湾局势进一步恶化,市场担忧美伊可能会出现摩擦生火,避险品种获得支撑,黄金和日元大幅走强。美指受中美贸易问题影响而在低位震荡。继5月12日,四艘商船在阿联酋领海附近的阿曼湾、…...

    2024/5/4 23:54:56
  16. 【原油贵金属早评】贸易冲突导致需求低迷,油价弱势

    原标题:【原油贵金属早评】贸易冲突导致需求低迷,油价弱势近日虽然伊朗局势升温,中东地区几起油船被袭击事件影响,但油价并未走高,而是出于调整结构中。由于市场预期局势失控的可能性较低,而中美贸易问题导致的全球经济衰退风险更大,需求会持续低迷,因此油价调整压力较…...

    2024/5/4 23:55:17
  17. 氧生福地 玩美北湖(上)——为时光守候两千年

    原标题:氧生福地 玩美北湖(上)——为时光守候两千年一次说走就走的旅行,只有一张高铁票的距离~ 所以,湖南郴州,我来了~ 从广州南站出发,一个半小时就到达郴州西站了。在动车上,同时改票的南风兄和我居然被分到了一个车厢,所以一路非常愉快地聊了过来。 挺好,最起…...

    2024/5/4 23:55:06
  18. 氧生福地 玩美北湖(中)——永春梯田里的美与鲜

    原标题:氧生福地 玩美北湖(中)——永春梯田里的美与鲜一觉醒来,因为大家太爱“美”照,在柳毅山庄去寻找龙女而错过了早餐时间。近十点,向导坏坏还是带着饥肠辘辘的我们去吃郴州最富有盛名的“鱼头粉”。说这是“十二分推荐”,到郴州必吃的美食之一。 哇塞!那个味美香甜…...

    2024/5/4 23:54:56
  19. 氧生福地 玩美北湖(下)——奔跑吧骚年!

    原标题:氧生福地 玩美北湖(下)——奔跑吧骚年!让我们红尘做伴 活得潇潇洒洒 策马奔腾共享人世繁华 对酒当歌唱出心中喜悦 轰轰烈烈把握青春年华 让我们红尘做伴 活得潇潇洒洒 策马奔腾共享人世繁华 对酒当歌唱出心中喜悦 轰轰烈烈把握青春年华 啊……啊……啊 两…...

    2024/5/4 23:55:06
  20. 扒开伪装医用面膜,翻六倍价格宰客,小姐姐注意了!

    原标题:扒开伪装医用面膜,翻六倍价格宰客,小姐姐注意了!扒开伪装医用面膜,翻六倍价格宰客!当行业里的某一品项火爆了,就会有很多商家蹭热度,装逼忽悠,最近火爆朋友圈的医用面膜,被沾上了污点,到底怎么回事呢? “比普通面膜安全、效果好!痘痘、痘印、敏感肌都能用…...

    2024/5/5 8:13:33
  21. 「发现」铁皮石斛仙草之神奇功效用于医用面膜

    原标题:「发现」铁皮石斛仙草之神奇功效用于医用面膜丽彦妆铁皮石斛医用面膜|石斛多糖无菌修护补水贴19大优势: 1、铁皮石斛:自唐宋以来,一直被列为皇室贡品,铁皮石斛生于海拔1600米的悬崖峭壁之上,繁殖力差,产量极低,所以古代仅供皇室、贵族享用 2、铁皮石斛自古民间…...

    2024/5/4 23:55:16
  22. 丽彦妆\医用面膜\冷敷贴轻奢医学护肤引导者

    原标题:丽彦妆\医用面膜\冷敷贴轻奢医学护肤引导者【公司简介】 广州华彬企业隶属香港华彬集团有限公司,专注美业21年,其旗下品牌: 「圣茵美」私密荷尔蒙抗衰,产后修复 「圣仪轩」私密荷尔蒙抗衰,产后修复 「花茵莳」私密荷尔蒙抗衰,产后修复 「丽彦妆」专注医学护…...

    2024/5/4 23:54:58
  23. 广州械字号面膜生产厂家OEM/ODM4项须知!

    原标题:广州械字号面膜生产厂家OEM/ODM4项须知!广州械字号面膜生产厂家OEM/ODM流程及注意事项解读: 械字号医用面膜,其实在我国并没有严格的定义,通常我们说的医美面膜指的应该是一种「医用敷料」,也就是说,医用面膜其实算作「医疗器械」的一种,又称「医用冷敷贴」。 …...

    2024/5/4 23:55:01
  24. 械字号医用眼膜缓解用眼过度到底有无作用?

    原标题:械字号医用眼膜缓解用眼过度到底有无作用?医用眼膜/械字号眼膜/医用冷敷眼贴 凝胶层为亲水高分子材料,含70%以上的水分。体表皮肤温度传导到本产品的凝胶层,热量被凝胶内水分子吸收,通过水分的蒸发带走大量的热量,可迅速地降低体表皮肤局部温度,减轻局部皮肤的灼…...

    2024/5/4 23:54:56
  25. 配置失败还原请勿关闭计算机,电脑开机屏幕上面显示,配置失败还原更改 请勿关闭计算机 开不了机 这个问题怎么办...

    解析如下&#xff1a;1、长按电脑电源键直至关机&#xff0c;然后再按一次电源健重启电脑&#xff0c;按F8健进入安全模式2、安全模式下进入Windows系统桌面后&#xff0c;按住“winR”打开运行窗口&#xff0c;输入“services.msc”打开服务设置3、在服务界面&#xff0c;选中…...

    2022/11/19 21:17:18
  26. 错误使用 reshape要执行 RESHAPE,请勿更改元素数目。

    %读入6幅图像&#xff08;每一幅图像的大小是564*564&#xff09; f1 imread(WashingtonDC_Band1_564.tif); subplot(3,2,1),imshow(f1); f2 imread(WashingtonDC_Band2_564.tif); subplot(3,2,2),imshow(f2); f3 imread(WashingtonDC_Band3_564.tif); subplot(3,2,3),imsho…...

    2022/11/19 21:17:16
  27. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机...

    win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”问题的解决方法在win7系统关机时如果有升级系统的或者其他需要会直接进入一个 等待界面&#xff0c;在等待界面中我们需要等待操作结束才能关机&#xff0c;虽然这比较麻烦&#xff0c;但是对系统进行配置和升级…...

    2022/11/19 21:17:15
  28. 台式电脑显示配置100%请勿关闭计算机,“准备配置windows 请勿关闭计算机”的解决方法...

    有不少用户在重装Win7系统或更新系统后会遇到“准备配置windows&#xff0c;请勿关闭计算机”的提示&#xff0c;要过很久才能进入系统&#xff0c;有的用户甚至几个小时也无法进入&#xff0c;下面就教大家这个问题的解决方法。第一种方法&#xff1a;我们首先在左下角的“开始…...

    2022/11/19 21:17:14
  29. win7 正在配置 请勿关闭计算机,怎么办Win7开机显示正在配置Windows Update请勿关机...

    置信有很多用户都跟小编一样遇到过这样的问题&#xff0c;电脑时发现开机屏幕显现“正在配置Windows Update&#xff0c;请勿关机”(如下图所示)&#xff0c;而且还需求等大约5分钟才干进入系统。这是怎样回事呢&#xff1f;一切都是正常操作的&#xff0c;为什么开时机呈现“正…...

    2022/11/19 21:17:13
  30. 准备配置windows 请勿关闭计算机 蓝屏,Win7开机总是出现提示“配置Windows请勿关机”...

    Win7系统开机启动时总是出现“配置Windows请勿关机”的提示&#xff0c;没过几秒后电脑自动重启&#xff0c;每次开机都这样无法进入系统&#xff0c;此时碰到这种现象的用户就可以使用以下5种方法解决问题。方法一&#xff1a;开机按下F8&#xff0c;在出现的Windows高级启动选…...

    2022/11/19 21:17:12
  31. 准备windows请勿关闭计算机要多久,windows10系统提示正在准备windows请勿关闭计算机怎么办...

    有不少windows10系统用户反映说碰到这样一个情况&#xff0c;就是电脑提示正在准备windows请勿关闭计算机&#xff0c;碰到这样的问题该怎么解决呢&#xff0c;现在小编就给大家分享一下windows10系统提示正在准备windows请勿关闭计算机的具体第一种方法&#xff1a;1、2、依次…...

    2022/11/19 21:17:11
  32. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”的解决方法...

    今天和大家分享一下win7系统重装了Win7旗舰版系统后&#xff0c;每次关机的时候桌面上都会显示一个“配置Windows Update的界面&#xff0c;提示请勿关闭计算机”&#xff0c;每次停留好几分钟才能正常关机&#xff0c;导致什么情况引起的呢&#xff1f;出现配置Windows Update…...

    2022/11/19 21:17:10
  33. 电脑桌面一直是清理请关闭计算机,windows7一直卡在清理 请勿关闭计算机-win7清理请勿关机,win7配置更新35%不动...

    只能是等着&#xff0c;别无他法。说是卡着如果你看硬盘灯应该在读写。如果从 Win 10 无法正常回滚&#xff0c;只能是考虑备份数据后重装系统了。解决来方案一&#xff1a;管理员运行cmd&#xff1a;net stop WuAuServcd %windir%ren SoftwareDistribution SDoldnet start WuA…...

    2022/11/19 21:17:09
  34. 计算机配置更新不起,电脑提示“配置Windows Update请勿关闭计算机”怎么办?

    原标题&#xff1a;电脑提示“配置Windows Update请勿关闭计算机”怎么办&#xff1f;win7系统中在开机与关闭的时候总是显示“配置windows update请勿关闭计算机”相信有不少朋友都曾遇到过一次两次还能忍但经常遇到就叫人感到心烦了遇到这种问题怎么办呢&#xff1f;一般的方…...

    2022/11/19 21:17:08
  35. 计算机正在配置无法关机,关机提示 windows7 正在配置windows 请勿关闭计算机 ,然后等了一晚上也没有关掉。现在电脑无法正常关机...

    关机提示 windows7 正在配置windows 请勿关闭计算机 &#xff0c;然后等了一晚上也没有关掉。现在电脑无法正常关机以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容&#xff0c;让我们赶快一起来看一下吧&#xff01;关机提示 windows7 正在配…...

    2022/11/19 21:17:05
  36. 钉钉提示请勿通过开发者调试模式_钉钉请勿通过开发者调试模式是真的吗好不好用...

    钉钉请勿通过开发者调试模式是真的吗好不好用 更新时间:2020-04-20 22:24:19 浏览次数:729次 区域: 南阳 > 卧龙 列举网提醒您:为保障您的权益,请不要提前支付任何费用! 虚拟位置外设器!!轨迹模拟&虚拟位置外设神器 专业用于:钉钉,外勤365,红圈通,企业微信和…...

    2022/11/19 21:17:05
  37. 配置失败还原请勿关闭计算机怎么办,win7系统出现“配置windows update失败 还原更改 请勿关闭计算机”,长时间没反应,无法进入系统的解决方案...

    前几天班里有位学生电脑(windows 7系统)出问题了&#xff0c;具体表现是开机时一直停留在“配置windows update失败 还原更改 请勿关闭计算机”这个界面&#xff0c;长时间没反应&#xff0c;无法进入系统。这个问题原来帮其他同学也解决过&#xff0c;网上搜了不少资料&#x…...

    2022/11/19 21:17:04
  38. 一个电脑无法关闭计算机你应该怎么办,电脑显示“清理请勿关闭计算机”怎么办?...

    本文为你提供了3个有效解决电脑显示“清理请勿关闭计算机”问题的方法&#xff0c;并在最后教给你1种保护系统安全的好方法&#xff0c;一起来看看&#xff01;电脑出现“清理请勿关闭计算机”在Windows 7(SP1)和Windows Server 2008 R2 SP1中&#xff0c;添加了1个新功能在“磁…...

    2022/11/19 21:17:03
  39. 请勿关闭计算机还原更改要多久,电脑显示:配置windows更新失败,正在还原更改,请勿关闭计算机怎么办...

    许多用户在长期不使用电脑的时候&#xff0c;开启电脑发现电脑显示&#xff1a;配置windows更新失败&#xff0c;正在还原更改&#xff0c;请勿关闭计算机。。.这要怎么办呢&#xff1f;下面小编就带着大家一起看看吧&#xff01;如果能够正常进入系统&#xff0c;建议您暂时移…...

    2022/11/19 21:17:02
  40. 还原更改请勿关闭计算机 要多久,配置windows update失败 还原更改 请勿关闭计算机,电脑开机后一直显示以...

    配置windows update失败 还原更改 请勿关闭计算机&#xff0c;电脑开机后一直显示以以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容&#xff0c;让我们赶快一起来看一下吧&#xff01;配置windows update失败 还原更改 请勿关闭计算机&#x…...

    2022/11/19 21:17:01
  41. 电脑配置中请勿关闭计算机怎么办,准备配置windows请勿关闭计算机一直显示怎么办【图解】...

    不知道大家有没有遇到过这样的一个问题&#xff0c;就是我们的win7系统在关机的时候&#xff0c;总是喜欢显示“准备配置windows&#xff0c;请勿关机”这样的一个页面&#xff0c;没有什么大碍&#xff0c;但是如果一直等着的话就要两个小时甚至更久都关不了机&#xff0c;非常…...

    2022/11/19 21:17:00
  42. 正在准备配置请勿关闭计算机,正在准备配置windows请勿关闭计算机时间长了解决教程...

    当电脑出现正在准备配置windows请勿关闭计算机时&#xff0c;一般是您正对windows进行升级&#xff0c;但是这个要是长时间没有反应&#xff0c;我们不能再傻等下去了。可能是电脑出了别的问题了&#xff0c;来看看教程的说法。正在准备配置windows请勿关闭计算机时间长了方法一…...

    2022/11/19 21:16:59
  43. 配置失败还原请勿关闭计算机,配置Windows Update失败,还原更改请勿关闭计算机...

    我们使用电脑的过程中有时会遇到这种情况&#xff0c;当我们打开电脑之后&#xff0c;发现一直停留在一个界面&#xff1a;“配置Windows Update失败&#xff0c;还原更改请勿关闭计算机”&#xff0c;等了许久还是无法进入系统。如果我们遇到此类问题应该如何解决呢&#xff0…...

    2022/11/19 21:16:58
  44. 如何在iPhone上关闭“请勿打扰”

    Apple’s “Do Not Disturb While Driving” is a potentially lifesaving iPhone feature, but it doesn’t always turn on automatically at the appropriate time. For example, you might be a passenger in a moving car, but your iPhone may think you’re the one dri…...

    2022/11/19 21:16:57