Author: Kagula
Date: 2016-9-19

环境
 [1]Spring 3.1.2
 [2]Tomcat 7.x

概要
    在《Spring Security学习一》的基础上完善自定义Login界面,并增加了Login方法的自定义。
    这里仅列出源码。
 
测试内容
[1]能否把密码明文转成密文,MD5加密。pass.
[2]能否同Spring MVC兼容。pass.
[3]自定义login方法。pass.
[4]个性化提示用户没有权限。pass.
[5]排除对jpg等图片的权限检查。pass.
[6]增加一组URL的权限检查。pass.
[7]自定义404错误。pass.

正文
第一部份配置文件
文档结构如图


pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.nuoke</groupId>
<artifactId>testSpringSecurity2</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>testSpringSecurity2 Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring.version>3.1.2.RELEASE</spring.version>
</properties>
<dependencies>    
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<!-- <exclusions> <exclusion> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> 
</exclusion> </exclusions> -->
</dependency>	
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>	
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>  
<groupId>org.springframework.security</groupId>  
<artifactId>spring-security-web</artifactId>  
<version>${spring.version}</version>
</dependency>
<dependency>  
<groupId>org.springframework.security</groupId>  
<artifactId>spring-security-config</artifactId>  
<version>${spring.version}</version>  
</dependency> 
<dependency>  
<groupId>org.springframework.security</groupId>  
<artifactId>spring-security-taglibs</artifactId>  
<version>${spring.version}</version>  
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>  
</dependencies>
<build>
<finalName>testSpringSecurity2</finalName>
<plugins>  
<!--  为了解决“Dynamic Web Module 3.0 requires Java 1.6 or newer.”错误需要下面的plugin -->
<plugin>  
<groupId>org.apache.maven.plugins</groupId>  
<artifactId>maven-compiler-plugin</artifactId>  
<version>3.0</version>  
<configuration>  
<source>1.7</source>  
<target>1.7</target>  
</configuration>  
</plugin>  
</plugins>  
</build>
</project>


 

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="schedule-console" version="3.0">
<display-name>Archetype Created Web Application</display-name>
<!-- 配置字符集过滤器 -->
<!-- 必须配置在所有过滤器的前面 -->
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<!-- 配置项目的编码mapping -->
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- 如果同一个bean被定义两次,后面一个优先 -->
<context-param>
<param-name>contextConfigLocation</param-name>  
<param-value>/WEB-INF/spring-servlet.xml,/WEB-INF/spring-security.xml</param-value>
</context-param>
<!-- 启动spring容器用,容器用于管理Bean -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener> 
<!-- Spring Security会话控制 -->  
<listener>
<listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
</listener>
<!-- Spring security Filter -->  
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- DispatcherServlet 针对MVC上下文加载,即拦截请求,分发请求给Controller -->
<!-- 《ContextLoaderListener初始化的前后文和DispatcherServlet初始化的上下文关系》    http://www.educity.cn/wenda/356953.html -->  
<servlet>  
<servlet-name>spring</servlet-name>  
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>  
<load-on-startup>1</load-on-startup>  
</servlet>
<!-- url-pattern配置为/,不带文件后缀,会造成其它静态文件(js,css等)不能访问。如配为*.do,则不影响静态文件的访问 -->  
<servlet-mapping>  
<servlet-name>spring</servlet-name>  
<url-pattern>*.do</url-pattern>  
</servlet-mapping> 
<welcome-file-list> 
<welcome-file>index.jsp</welcome-file> 
</welcome-file-list>
<error-page>
<error-code>404</error-code>
<location>/My404.jsp</location>
</error-page>
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/MyEception.jsp</location>
</error-page>   
</web-app>


 

spring-servlet.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" 
xmlns:tx="http://www.springframework.org/schema/tx"  
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">
<!-- Scan Controller Range -->  
<context:component-scan base-package="com.nuoke.controller" />
<!-- HandlerMapping -->  
<bean  
class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" />  
<!-- HandlerAdapter -->  
<bean  
class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" />
<!-- enable spring mvc annotation driven-->
<mvc:annotation-driven/>
<bean id="jspViewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/view/" />
<property name="suffix" value=".jsp" />
</bean>
<!--定义异常处理页面-->
<!-- 具体哪个页面在web.xml中设置 -->
<bean id="exceptionResolver" class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<property name="exceptionMappings">
<props>
<prop key="java.sql.SQLException">outException</prop>
<prop key="java.io.IOException">outException</prop>
</props>
</property>
</bean>	
</beans>


 

spring-security.xml

<?xml version="1.0" encoding="UTF-8"?>  
<b:beans xmlns="http://www.springframework.org/schema/security"  
xmlns:b="http://www.springframework.org/schema/beans"  
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd  
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">  
<!--此页面不过滤 -->
<!--仅自定义登录页面的示例 -->  
<http pattern="/main/login.do" security="none" />
<!--自定义登录方法的示例 -->
<http pattern="/main/customLogin.do" security="none" />
<!-- 此目录下不过滤 -->
<!-- example http://localhost:8080/testSpringSecurity2/download/c.png -->
<http pattern="/download/**" security="none" />
<!-- 从来没见过auto jump into accessDenied.jsp -->  
<http access-denied-page="/accessDenied.jsp"> 
<!-- 
login-page:默认指定的登录页面. 
authentication-failure-url:出错后跳转页面. 
default-target-url:成功登陆后跳转页面 默认登录保护url 
-->
<!-- 示例 一:自定义登录页面 -->
<!-- 
<form-login login-page="/main/login.do"
default-target-url="/main/welcome.do"
authentication-failure-url="/main/login.do?error" 
login-processing-url="/j_spring_security_check" 
username-parameter="username" 
password-parameter="password" />
-->
<!-- 示例二:自定义登录方法  -->
<!-- 示例二是在示例一Controller的基础上增加一个handler -->
<!-- view目录下增加了customLogin.jsp、customLoginResponse.jsp两个jsp,组成。 -->
<form-login login-page="/main/customLogin.do"
default-target-url="/main/welcome.do"/>
<!-- logout-success-url:成功注销后跳转到的页面; -->
<!-- 示例一和示例二的代码可以同时运行 -->
<logout logout-url="/j_spring_security_logout"
logout-success-url="/main/login.do"
invalidate-session="true" />
<!--访问资源必须有ROLE_ADMIN的权限 -->  
<intercept-url pattern="/main/welcome.do" access="ROLE_ADMIN" />  
<!--访问/**资源的用户必须具有ROLE_USER的权限 -->  
<!-- <intercept-url pattern="/**" access="ROLE_USER" /> -->
<!-- 奇怪下面的intercept-url设定对chrome不起作用,但是对IE和Eclipse中的Web Browser起作用。   -->
<!-- 发现,是因为有一次重启session还是有效造成的 -->
<!-- pattern="/*.do"的设定是不起作用的 -->
<!-- pattern="/main/*.do"的设定有效的 -->
<!-- <intercept-url pattern="/main/**" access="ROLE_USER,ROLE_ADMIN" /> -->
<session-management invalid-session-url="/sessionexpired.jsp">
<!-- 必须要有invalid-session-url属性,否则不会踢掉原来的登录  -->
<!-- 被踢掉的用户再发出请求会转到/sessionexpired.jsp页面  -->  
<concurrency-control max-sessions="1"  
error-if-maximum-exceeded="false"/>
<!-- error-if-maximum-exceeded属性为false的话,踢掉原来的登录, max-sessions默认为1 -->
<!-- expired-url="/kickout.jsp" 不设置的话会提示This session has been expired (possibly due to multiple concurrent logins being attempted as the same user). -->
<!-- 然后再刷新的话,转到/sessionexpired.jsp -->
<!-- expired-url="/kickout.jsp" 设置的话会转到/sessionexpired.jsp-->  
<!-- error-if-maximum-exceeded属性为true的话,如果帐号已经登录,在其它地方这个帐号就登录不了了 -->
</session-management> 
<custom-filter ref="myFilter" before="FILTER_SECURITY_INTERCEPTOR" />  
</http>  
<!--一个自定义的filter,必须包含 authenticationManager,accessDecisionManager,securityMetadataSource三个属性,   
我们的所有控制将在这三个类中实现,解释详见具体配置 -->  
<b:bean id="myFilter"  
class="com.nuoke.MyFilterSecurityInterceptor">  
<b:property name="authenticationManager" ref="authenticationManager" />  
<b:property name="accessDecisionManager" ref="myAccessDecisionManagerBean" />  
<b:property name="securityMetadataSource" ref="securityMetadataSource" />  
</b:bean>  
<!--验证配置,认证管理器,实现用户认证的入口,主要实现UserDetailsService接口即可 -->  
<authentication-manager alias="authenticationManager">  
<authentication-provider user-service-ref="myUserDetailService">  
<!--如果用户的密码采用加密的话  -->
<password-encoder hash="md5"/>  
</authentication-provider>  
</authentication-manager>
<!--在这个类中,你就可以从数据库中读入用户的密码,角色信息,是否锁定,账号是否过期等 -->  
<b:bean id="myUserDetailService" class="com.nuoke.MyUserDetailService" />
<!--访问决策器,决定某个用户具有的角色,是否有足够的权限去访问某个资源 -->  
<b:bean id="myAccessDecisionManagerBean"  
class="com.nuoke.MyAccessDecisionManager">  
</b:bean>  
<!--资源数据定义,将所有的资源和权限对应关系建立起来,即定义某一资源可以被哪些角色访问 -->  
<b:bean id="securityMetadataSource"  
class="com.nuoke.MyInvocationSecurityMetadataSource" />   
</b:beans>  


 

第二部份java源文件
共有7个class文件,这里只列出《学习一》内容不同或没有的java源文件


MyUserDetailService.java

package com.nuoke;
import java.util.ArrayList;
import java.util.Collection;
import org.springframework.dao.DataAccessException;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
public class MyUserDetailService implements UserDetailsService {
//登陆验证时,通过username获取用户的所有权限信息,
//并返回User放到spring的全局缓存SecurityContextHolder中,以供授权器使用
public UserDetails loadUserByUsername(String username) 
throws UsernameNotFoundException, DataAccessException {   
Collection<GrantedAuthority> auths=new ArrayList<GrantedAuthority>(); 
SimpleGrantedAuthority auth2 = new SimpleGrantedAuthority("ROLE_ADMIN"); 
SimpleGrantedAuthority auth1 = new SimpleGrantedAuthority("ROLE_USER"); 
if(username.equals("admin")){ 
auths=new ArrayList<GrantedAuthority>(); 
auths.add(auth1);
auths.add(auth2);      
}     
//第二个参数是密码。是123的md5码。        
User user = new User(username, "202cb962ac59075b964b07152d234b70", true, true, true, true, auths);
//以后还可以new a class derived from User class,为user存放更多有关这个user的信息。
//参考下文User定义,可以存放用户的更多属性。
//http://blog.csdn.net/ydj7501603/article/details/9049663
return user;  
} 
}


 

MyController.java

package com.nuoke.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
@Controller
@RequestMapping(value = "/main")
public class MyController {	
@RequestMapping(value = "/admin.do")
public ModelAndView adminPage() {
ModelAndView model = new ModelAndView();
model.addObject("title", "Spring Security Hello World");
model.addObject("message", "这是一个安全被保护的页面!");
//在MyInvocationSecurityMetadataSource类中指定了保护。
model.setViewName("admin");
return model;
}
@RequestMapping(value = "/welcome.do")
public ModelAndView WelcomeAction() {
ModelAndView model = new ModelAndView();
model.addObject("title", "Spring Security Hello World");
model.addObject("message", "这是一个欢迎页面!");
model.setViewName("welcome");
return model;
}
/*
* 仅自定义login页面
* 测试url:
* http://localhost:8080/testSpringSecurity2/main/login.do
*/
@RequestMapping(value = "/login.do")
public ModelAndView LoginAction(
@RequestParam(value = "error", required = false) String error,
@RequestParam(value = "logout", required = false) String logout) {
ModelAndView model = new ModelAndView();
if (error != null) {
model.addObject("error", "用户名或密码不正确!");
}
if (logout != null) {
model.addObject("msg", "您已成功注销系统.");
}
model.setViewName("login");
return model;
}
//自定义Login方法示例
/*
* 测试Url:
* http://localhost:8080/testSpringSecurity2/main/customLogin.do
* 
* 补充参考资料:
* 《在spring security手动 自定义 用户认证 SecurityContextHolder》
* https://my.oschina.net/lemonzone2010/blog/268452#OSC_h2_1
* 《》
* http://www.programcreek.com/java-api-examples/index.php?api=org.springframework.security.core.context.SecurityContext
*/
@Autowired
private AuthenticationManager authenticationManager;
@RequestMapping(value="/customLogin.do")
public ModelAndView customLoginAction(@RequestParam(defaultValue="") String username,
@RequestParam(defaultValue="") String password,
HttpServletRequest request){
//
username = username.trim();
//返回登录页面
ModelAndView model = new ModelAndView();
model.setViewName("customLogin");
if(username==null||username.isEmpty()||
password==null||password.isEmpty())
{
return model;			
}
//向AJAX请求返回消息提醒(json字符串)
model.setViewName("customLoginResponse");
UsernamePasswordAuthenticationToken authRequest = 
new UsernamePasswordAuthenticationToken(username, password);
//
try {
Authentication authentication = authenticationManager.authenticate(authRequest);
SecurityContextHolder.getContext().setAuthentication(authentication);
HttpSession session = request.getSession();
session.setAttribute("SPRING_SECURITY_CONTEXT", SecurityContextHolder.getContext()); // 这个非常重要,否则验证后将无法登陆
model.addObject("message","登录用户:"+authentication.getName());
model.addObject("ok",1);//这样view/customLogin.jsp得到成功标记后可以做url跳转。
} catch (AuthenticationException ex) {
model.addObject("message","用户名或密码错误");
model.addObject("ok",0);//为了view/customLogin.jsp得到失败标记后可以提醒用户重新输入用户名、密码。
}//end catch
return model;
}//end handler
}//end class


 

第三部份jsp源文件
参考图一共有十个jsp文件,这里只列出比较重要的几个jsp。

MyException.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>异常处理页面</title>
</head>
<body>
<% Exception ex = (Exception) request.getAttribute("Exception");%>
<H2>Exception:<%=ex.getMessage()%>
</H2>
</body>
</html>


login.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>示例一:自定义登录界面</title>
<style>
.error {
padding: 15px;
margin-bottom: 20px;
border: 1px solid transparent;
border-radius: 4px;
color: #a94442;
background-color: #f2dede;
border-color: #ebccd1;
}
.msg {
padding: 15px;
margin-bottom: 20px;
border: 1px solid transparent;
border-radius: 4px;
color: #31708f;
background-color: #d9edf7;
border-color: #bce8f1;
}
#login-box {
width: 300px;
padding: 20px;
margin: 100px auto;
background: #fff;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border: 1px solid #000;
}
</style>
</head>
<body οnlοad='document.loginForm.username.focus();'>
<div id="login-box">
<h2>请输入您的用户名与密码</h2>
<c:if test="${not empty error}">
<div class="error">${error}</div>
</c:if>
<c:if test="${not empty msg}">
<div class="msg">${msg}</div>
</c:if>
<form name='loginForm'  action="<c:url value='/j_spring_security_check' />" method='POST'>
<table>
<tr>
<td>用户:</td>
<td><input type='text' name='username' value=''></td>
</tr>
<tr>
<td>密码:</td>
<td><input type='password' name='password' /></td>
</tr>
<tr>
<td colspan='2'><input name="submit" type="submit"
value="登录" /></td>
</tr>
</table>
<!-- 猜测_csrf是给不支持Cookie的Web Browser准备的。 -->
<!-- <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" /> -->
</form>
</div>
</body>
</html>


welcome.jsp

<%@ page language="java" import="java.util.*,java.text.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page session="false"%>
<html>
<body>
<h1>标题 : ${title}</h1>    
<h1>消息 : ${message}</h1>
<br> 
<%
Date date = new Date(); 
SimpleDateFormat t = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String time = t.format(date);
%>
<br/>
当前时间:<%= time %>     
</body>
</html>


admin.jsp

<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page session="true"%>
<html>
<body>
<h1>标题 : ${title}</h1>
<h1>消息 : ${message}</h1>
<c:url value="/j_spring_security_logout"  var="logoutUrl" />
<form action="${logoutUrl}" method="post" id="logoutForm">
<!-- csrf for log out-->
<!-- 猜测_csrf是给不支持Cookie的Web Browser准备的。 -->
<!-- <input type="hidden"  name="${_csrf.parameterName}" value="${_csrf.token}" /> -->
</form>
<script>
function formSubmit() {
document.getElementById("logoutForm").submit();
}
</script>
<c:if test="${pageContext.request.userPrincipal.name != null}">
<h2>
欢迎 : ${pageContext.request.userPrincipal.name} 登录本系统 | <a
href="javascript:formSubmit()"> 注销</a>
</h2>
</c:if>
</body>
</html>


customLogin.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>自定义登录控制</title>
<link href="../common/bootstrap/css/bootstrap.min.css"       rel="stylesheet">
<link href="../common/bootstrap/css/bootstrap-theme.min.css" rel="stylesheet">
<script type="text/javascript"
src="../common/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" 
src="../common/jquery/jquery-2.1.1.min.js"></script>
<body>
<div class="container">
<div id="container_demo">
<div id="wrapper">
<div id="login" class="animate form">
<h1>示例二 自定义login方法</h1>
<form id='loginForm' method="POST">
<p>
<label for="" class="uname" data-icon="u"> 用户名 </label>
<input id="username" name="username" required="required" type="text" placeholder="myusername or mymail@mail.com">
</p>
<p>
<label for="" class="youpasswd" data-icon="p"> 密码 </label>
<input id="password" name="password" required="required" type="password" placeholder="eg. X8df!90EO">
</p>
<p class="login button">
<input type="submit" id="submitId" value="登录">
</p>
</form>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
$(function(){
/登录提交
$("#loginForm").submit(function() {
var username=$("#username").val();
var password=$("#password").val();
var data={username:username,password:password}; 
var url="/testSpringSecurity2/main/customLogin.do"; 
$.ajax({
type: "POST",
url: url,
data: data,
// contentType: "application/json",
dataType: "json",
success:function (result) {
if(result.ok){
location.href="/testSpringSecurity2/main/admin.do";
} else
{
$(".error").remove();
$("#loginForm").prepend("<div class='error'><font color='red'>"+result.msg+"</font></div>");  
}              
},
error:function(XMLHttpRequest, textStatus, errorThrown){
alert('读取超时,请检查网络连接...'); 
}
});
return false;
});
});    
</script>
</html>


 

customLoginResponse.jsp

<%@ page language="java" import="java.util.*,java.text.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page session="false"%>
{"ok":${ok},"msg":"${message}"}


遗留问题

登录的时候,如何知道帐户已经在其它地方登录?


参考资料
[1]《Spring Security》
http://docs.spring.io/spring-security/site/docs/3.1.x/reference/springsecurity.html
[2]《intercept-url配置》
参考这篇文章可以限定用户只能使用https协议访问服务
http://haohaoxuexi.iteye.com/blog/2161056
[3]《Spring Security 3.1.2 + Spring Framework 3.1.2+使用Annotation实战指南》
http://www.itpub.net/thread-1719846-1-1.html
[4]《Spring Security 3.1 自定义实例之登陆》
使用AJAX来验证登录
使用了spring自带的login方法来验证登录
http://www.cnblogs.com/ilife/archive/2013/02/28/2936067.html
[5]《Spring Security 3.1.2.RELEASE API》
http://tool.oschina.net/uploads/apidocs/spring-security-3.1.2/apidocs/
[6]《spring security Controller用户角色的判断》
http://blog.csdn.net/softwarehe/article/details/7711302
[7]《How to manually log out a user with spring security?》
http://stackoverflow.com/questions/5727380/how-to-manually-log-out-a-user-with-spring-security
[8]《Spring and Angular JS: A Secure Single Page Application》
https://spring.io/blog/2015/01/12/spring-and-angular-js-a-secure-single-page-application

查看全文
如若内容造成侵权/违法违规/事实不符,请联系编程学习网邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

相关文章

  1. 使用Angular,Ionic 4和Spring Boot构建移动应用

    朋友不允许朋友写用户身份验证。 厌倦了管理自己的用户&#xff1f; 立即尝试Okta的API和Java SDK。 在几分钟之内即可对任何应用程序中的用户进行身份验证&#xff0c;管理和保护。 我是Ionic的忠实粉丝。 几年前&#xff0c;我基于AngularJS开始使用它。 作为开发人员&#…...

    2024/4/21 4:20:25
  2. SpringBoot入门系列:Spring Security 和 Angular JS(2)

    添加动态的内容 目前我们已经有了一个应用程序&#xff0c;硬编码了一句问候语在里面。这对学习如何把这些凑到一起很有帮助&#xff0c;不过实际上我们期望的是来自于后台服务器的内容&#xff0c;因此我们可以创建一个HTTP端点&#xff0c;然后用这个来抓取到一句问候语。在你…...

    2024/4/21 4:20:25
  3. Spring与Serverless 相关服务了解

    目录 前端开发模式的演进 Serverless 常见服务商提供的解决方案 基于 Serverless 的前端开发模式 serverless带来的价值 serverless实践 总结serverless - less is more Spring 对Serverless的实践 无服务器 什么是无服务器&#xff1f; 无服务器特性&#xff1f; 无…...

    2024/4/21 4:20:24
  4. Angular 架构概述

    Angular 8.1.0 环境搭建 & 初始化项目 两天学会Angular开发——第一天 两天学会Angular开发——第二天 架构概述 Angular应用的基本构建模块是 NgModules &#xff0c;它为组件提供编译上下文。Angular 应用程序由一组 NgModules 定义&#xff0c;至少有一个根模块&#…...

    2024/4/21 4:20:23
  5. Kotlin+Spring Boot开发REST API实战

    Kotlin简介 Kotlin是面向JVM、Android、JavaScript 及原生平台的开源静态类型编程语言&#xff0c;支持面向对象和函数式编程。Kotlin项目开始于2010年&#xff0c;由 JetBrains开发&#xff0c;2016年2月发布第一个官方版本1.0&#xff0c;当前版本是 1.3.72&#xff0c;发布…...

    2024/4/27 11:24:28
  6. 从零开始构建一个spring boot + angular web应用(1)

    http://www.jianshu.com/p/cd6f07e30443 首先&#xff0c;开始项目前&#xff0c;电脑的必备开发环境要首先具备。如&#xff0c; JDK、node、maven、bower等常用工具要具备。废话不多说了。 step 1 创建maven项目&#xff0c;随便找个地方创建一个文件夹demo&#xff0c;cmd进…...

    2024/4/21 4:20:21
  7. Spring 注解笔记整理

    Spring 注解整理 1.核心容器&#xff08;Core&#xff09; Spring Core 提供bean工厂 控制反转&#xff08;IOC&#xff09;&#xff0c;利用IOC使配置与代码进行分离&#xff0c;降低耦合。 基于xml配置元数据; Spring 2.5引入了基于注释的配置元数据; 从Spring 3开始基于ja…...

    2024/4/21 4:20:20
  8. Angular的后院:组件依赖关系的解决

    by Dor Moshe通过Dor Moshe Angular的后院&#xff1a;解决 组件依赖关系 (Angular’s Backyard: The Resolving of Components Dependencies) This article originally appeared on dormoshe.io这篇文章 最初出现在dormoshe.io Many of us use the Hierarchical Dependenc…...

    2024/4/21 4:20:19
  9. Spring Boot 学习笔记

    嗯,加油生活,依旧,摘几句子.我十有八九的欲言又止&#xff0c;在日后想来都庆幸。而绝大多数的敞开心扉在事后都追悔。 -------德卡先生的信箱2019.10.3 Spring的发展 Spring1.x 时代&#xff1a;在Spring1.x时代&#xff0c;都是通过xml文件配置bean&#xff0c;随着项目的…...

    2024/4/20 19:51:01
  10. Application of LiDAR in driveless technology

    电子科技大学格拉斯哥学院 2017级 贺俊皓 The car accident happened in Chongqing last month is really a tragedy for all peopel in China.The unreasonalbe female passenger was accused of the crime culprit of this accident. So, which kind of measure could be ada…...

    2024/4/20 16:21:01
  11. paper survey ——Underwater optical communication

    本博文为本人阅读水下通信系列的笔记 Gaussian kernel-aided deep neural network equalizer utilized in underwater PAM8 visible light communication system VLC has advantages that include high speed, the absence of electromagnetic radiation, safety for human ey…...

    2024/4/23 22:51:33
  12. 把这304道React的面试题刷完,前端面试没有在怕的!

    Core React 什么是 React? React 是一个开源前端 JavaScript 库&#xff0c;用于构建用户界面&#xff0c;尤其是单页应用程序。它用于处理网页和移动应用程序的视图层。React 是由 Facebook 的软件工程师 Jordan Walke 创建的。在 2011 年 React 应用首次被部署到 Facebook 的…...

    2024/4/29 3:55:16
  13. 图像质量评价FSIM,matlab代码

    主函数 clc clear all close all; aimread(1.png)); %处理后的图像 A imread(2.jpg)); %源图像 Argb2gray(A);%如果图像是灰度图像&#xff0c;把这句话注释掉 A imresize(A,[256,256]); [FSIM, FSIMc] FeatureSIM(a, A);%这里调用函数&#xff0c; S F…...

    2024/4/21 4:20:17
  14. 前端 基础面试问题汇总

    1>、html5有哪些新标签&#xff1f;<article> 标签定义外部的内容&#xff08;外部内容如blog,news&#xff09;。<aside> 标签定义article以外的内容&#xff08;可用做文章的侧栏&#xff09;。<canvas>使用JavaScript在网页上绘制图形图像。<detail…...

    2024/5/1 14:36:35
  15. griffin编译安装

    Griffin编译安装 前言 Griffin是一个应用于分布式数据系统中的开源数据质量解决方案&#xff0c;例如在Hadoop, Spark, Storm等分布式系统中&#xff0c;Griffin提供了一整套统一的流程来定义和检测数据集的质量并及时报告问题。Apache Griffin是一个开源的大数据数据质量解决…...

    2024/4/21 4:20:16
  16. 小邵教你玩转Generator+co/async await

    前言&#xff1a;大家好&#xff0c;我叫邵威儒&#xff0c;大家都喜欢喊我小邵&#xff0c;学的金融专业却凭借兴趣爱好入了程序猿的坑&#xff0c;从大学买的第一本vb和自学vb&#xff0c;我就与编程结下不解之缘&#xff0c;随后自学易语言写游戏辅助、交易软件&#xff0c;…...

    2024/4/21 4:20:14
  17. 三维空间中的旋转--旋转向量

    处理三维旋转问题时&#xff0c;通常采用旋转矩阵的方式来描述。一个向量乘以旋转矩阵等价于向量以某种方式进行旋转。除了采用旋转矩阵描述外&#xff0c;还可以用旋转向量来描述旋转&#xff0c;旋转向量的长度&#xff08;模&#xff09;表示绕轴逆时针旋转的角度&#xff0…...

    2024/5/3 5:35:23
  18. [转]DCM Tutorial – An Introduction to Orientation Kinematics

    原地址http://www.starlino.com/dcm_tutorial.html Introduction This article is a continuation of my IMU Guide, covering additional orientation kinematics topics. I will go through some theory first and then I will present a practical example with code build …...

    2024/4/20 15:44:30
  19. 华工软院IBM LinuxONE Community Cloud云计算实验文档

    此博文介绍华南理工大学软件学院“云计算开发与应用”实验课。本人在大二期间选修了这门课&#xff0c;实验课内容是把已有的app部署到云服务器上运行。虽然实验内容很简单(作者大概一个小时就做完了两天的实验内容)&#xff0c;但觉得这次实验是我在华工期间做过的为数不多有意…...

    2024/5/5 17:31:53
  20. 7_nodejs angularjs

    webstrom使用&#xff1a; ctrlb/点击&#xff0c;代码导航,自动跳转到定义 ctrln跳转指定类 ctrld复制当前行ctrlenter另起一行ctrly删除当前行 ctrlalt/shiftb跳转方法实现/定义处 包裹/去掉外围代码unwrap... 主题appearance 字体editor-colors&fonts-font 自动换行sett…...

    2024/5/6 7:02:12

最新文章

  1. 深度学习网络:设计、开发和部署

    ​书籍&#xff1a;Deep Learning Networks: Design, Development and Deployment 作者&#xff1a;Jayakumar Singaram&#xff0c;S. S. Iyengar&#xff0c;Azad M. Madni 出版&#xff1a;Springer书籍下载-《​深度学习网络&#xff1a;设计、开发和部署》该教材为学生和工…...

    2024/5/8 23:18:18
  2. 梯度消失和梯度爆炸的一些处理方法

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

    2024/5/7 10:36:02
  3. Burp Suite Professional 2024.3.1 for macOS x64 ARM64 - 领先的 Web 渗透测试软件

    Burp Suite Professional 2024.3.1 for macOS x64 & ARM64 - 领先的 Web 渗透测试软件 世界排名第一的 Web 渗透测试工具包 请访问原文链接&#xff1a;Burp Suite Professional 2024.3.1 for macOS x64 & ARM64 - 领先的 Web 渗透测试软件&#xff0c;查看最新版。原…...

    2024/5/5 22:42:13
  4. Redis Stack十部曲之三:理解Redis Stack中的数据类型

    文章目录 前言String字符串作为计数器限制 List限制列表阻塞列表自动创建和删除聚合类型键限制 Set限制 Hash限制 Sorted Set范围操作字典操作更新分数 JSON路径限制 BitMapBitfieldProbabilisticHyperLogLogBloom filterCuckoo filtert-digestTop-KCount-min sketchConfigurat…...

    2024/5/4 13:36:16
  5. DDIM,多样性与运行效率之间的trade off

    DDPM的重大缺陷在于其在反向扩散的过程中需要逐步从 x t x_t xt​倒推到 x 0 x_0 x0​&#xff0c;因此其推理速度非常缓慢。相反&#xff0c;DDPM的训练过程是很快的&#xff0c;可以直接根据 x 0 x_0 x0​到 x t x_t xt​添加的高斯噪声 ϵ \epsilon ϵ完成一次训练。 为了解…...

    2024/5/8 4:05:48
  6. 【外汇早评】美通胀数据走低,美元调整

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

    2024/5/8 6:01:22
  7. 【原油贵金属周评】原油多头拥挤,价格调整

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

    2024/5/7 9:45:25
  8. 【外汇周评】靓丽非农不及疲软通胀影响

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

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

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

    2024/5/7 14:25:14
  10. 【外汇早评】日本央行会议纪要不改日元强势

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

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

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

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

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

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

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

    2024/5/7 11:36:39
  14. 【原油贵金属周评】伊朗局势升温,黄金多头跃跃欲试

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

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

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

    2024/5/6 1:40:42
  16. 【外汇早评】美伊僵持,风险情绪继续升温

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

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

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

    2024/5/8 20:48:49
  18. 氧生福地 玩美北湖(上)——为时光守候两千年

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

    2024/5/7 9:26:26
  19. 氧生福地 玩美北湖(中)——永春梯田里的美与鲜

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

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

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

    2024/5/8 19:33:07
  21. 扒开伪装医用面膜,翻六倍价格宰客,小姐姐注意了!

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

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

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

    2024/5/8 20:38:49
  23. 丽彦妆\医用面膜\冷敷贴轻奢医学护肤引导者

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

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

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

    2024/5/6 21:42:42
  25. 械字号医用眼膜缓解用眼过度到底有无作用?

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

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

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

    2022/11/19 21:17:18
  27. 错误使用 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
  28. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机...

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

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

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

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

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

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

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

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

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

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

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

    2022/11/19 21:17:10
  34. 电脑桌面一直是清理请关闭计算机,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
  35. 计算机配置更新不起,电脑提示“配置Windows Update请勿关闭计算机”怎么办?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    2022/11/19 21:16:58
  45. 如何在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