Index: ssts-web/build.gradle =================================================================== diff -u -r27238 -r27735 --- ssts-web/build.gradle (.../build.gradle) (revision 27238) +++ ssts-web/build.gradle (.../build.gradle) (revision 27735) @@ -290,7 +290,7 @@ println "运行任务2:准备spring security xml文件,使用标准的或者项目定制的xml文件" // spring security.xml文件名的后缀,applicationContext-acegi-security-standard.xml.back def suffix = 'standard' - if (projectName == 'zd5y' || projectName == 'hzszxrmyy' || projectName == 'dysyy' || projectName == 'gdsy' || projectName == 'gzzyyfy' || projectName == 'bjdxzlyy' || projectName == 'gdsrmyyzhyy'){ + if (projectName == 'zd5y' || projectName == 'hzszxrmyy' || projectName == 'dysyy' || projectName == 'gdsy' || projectName == 'gzzyyfy' || projectName == 'bjdxzlyy' || projectName == 'gdsrmyyzhyy' || projectName == 'cszxyy'){ suffix = projectName } Index: ssts-web/src/main/webapp/WEB-INF/web-cszxyy.xml =================================================================== diff -u -r26218 -r27735 --- ssts-web/src/main/webapp/WEB-INF/web-cszxyy.xml (.../web-cszxyy.xml) (revision 26218) +++ ssts-web/src/main/webapp/WEB-INF/web-cszxyy.xml (.../web-cszxyy.xml) (revision 27735) @@ -372,7 +372,7 @@ - logon.jsp + logonSSOForCszxyy.jsp Index: ssts-web/src/main/resources/spring/projects/cszxyy/applicationContext-disinfectsystem-project-specific.xml =================================================================== diff -u -r12331 -r27735 --- ssts-web/src/main/resources/spring/projects/cszxyy/applicationContext-disinfectsystem-project-specific.xml (.../applicationContext-disinfectsystem-project-specific.xml) (revision 12331) +++ ssts-web/src/main/resources/spring/projects/cszxyy/applicationContext-disinfectsystem-project-specific.xml (.../applicationContext-disinfectsystem-project-specific.xml) (revision 27735) @@ -4,7 +4,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd" default-autowire="byName"> - Index: ssts-client-misc/src/main/java/com/forgon/disinfectsystem/security/handler/AuthenticationSuccessHandlerForCszxyy.java =================================================================== diff -u --- ssts-client-misc/src/main/java/com/forgon/disinfectsystem/security/handler/AuthenticationSuccessHandlerForCszxyy.java (revision 0) +++ ssts-client-misc/src/main/java/com/forgon/disinfectsystem/security/handler/AuthenticationSuccessHandlerForCszxyy.java (revision 27735) @@ -0,0 +1,41 @@ +package com.forgon.disinfectsystem.security.handler; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler; +import org.springframework.stereotype.Service; + +/** + * 长沙中心医院身份验证成功后的handler + * @author syf + * @since 2020-03-31 + */ +@Service("authenticationSuccessHandlerForCszxyy") +public class AuthenticationSuccessHandlerForCszxyy extends + SavedRequestAwareAuthenticationSuccessHandler { + + @Override + public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, + Authentication authentication) throws ServletException, IOException { + + Authentication auth = SecurityContextHolder.getContext().getAuthentication(); + if (auth != null && auth.isAuthenticated()) { + + String username = auth.getPrincipal().toString(); + String url = getDefaultTargetUrl(); + response.sendRedirect(url); + +// UserData userData = userService.getUserData(username); + // And then here more checks, handlings etc. + } + + + super.onAuthenticationSuccess(request, response, authentication); + } +} Index: ssts-web/src/main/resources/spring/security/applicationContext-acegi-security-cszxyy.xml.back =================================================================== diff -u --- ssts-web/src/main/resources/spring/security/applicationContext-acegi-security-cszxyy.xml.back (revision 0) +++ ssts-web/src/main/resources/spring/security/applicationContext-acegi-security-cszxyy.xml.back (revision 27735) @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Index: ssts-web/src/main/webapp/logonSSOForCszxyy.jsp =================================================================== diff -u -r20599 -r27735 --- ssts-web/src/main/webapp/logonSSOForCszxyy.jsp (.../logonSSOForCszxyy.jsp) (revision 20599) +++ ssts-web/src/main/webapp/logonSSOForCszxyy.jsp (.../logonSSOForCszxyy.jsp) (revision 27735) @@ -1,3 +1,6 @@ +<%@page import="com.forgon.security.service.SSOAuthenticationService"%> +<%@page import="com.forgon.tools.SpringBeanManger"%> +<%@page import="org.apache.commons.io.IOUtils"%> <%@page import="com.forgon.disinfectsystem.common.CssdUtils"%> <%@ page contentType="text/html; charset=UTF-8" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> @@ -6,28 +9,15 @@ <%@page import="org.apache.commons.lang.StringUtils"%> <% -ArrayList message = new ArrayList(); -//用户名 -String un = request.getParameter("un"); -//密码 -String up = request.getParameter("up"); -if(StringUtils.isBlank(un)){ - message.add("用户名不能为空"); -}else if(StringUtils.isBlank(up)){ - message.add("密码不能为空"); -} -pageContext.setAttribute("un", un); -pageContext.setAttribute("up", up); -pageContext.setAttribute("message", message); - String companyName = CssdUtils.getSystemSetConfigByName("companyName"); String companyNameStr = ""; if(companyName == null || companyName.equals("forgon")){ - companyNameStr = "©2016 广州孚峻信息技术有限公司 版权所有"; + companyNameStr = "©2018 广州孚峻信息技术有限公司 版权所有"; }else if(companyName.equals("dingxiang")){ - companyNameStr = "©2016 广州丁香软件有限公司 版权所有"; + companyNameStr = "©2018 广州丁香软件有限公司 版权所有"; } session.setAttribute("companyName", companyNameStr); + String project = CssdUtils.getConfigProperty("project"); session.setAttribute("profile", project); @@ -43,7 +33,35 @@ request.setAttribute("logoPath","themes/portalPage/img/logo_dingxiangsoft.png"); } } - + +//用户名 +String un = request.getParameter("j_username"); +//密码 +String up = request.getParameter("j_password"); +if(StringUtils.isNotBlank(un)){ + if(StringUtils.isBlank(up)){ + pageContext.setAttribute("message", "密码不能为空"); + }else{ + //否则提交接口认证 + SSOAuthenticationService authenticationService = + (SSOAuthenticationService)SpringBeanManger.getBean("authenticationService"); + if(authenticationService == null){ + pageContext.setAttribute("message", "未配置认证的bean,请检查!"); + }else{ + boolean validateSuccess = authenticationService.authentication(un,up,""); + if(validateSuccess){ + //如果认证成功,转向至主页() + response.sendRedirect(request.getContextPath() + "/homepage/portalPage.jsp?un=" + un); + }else{ + //否则如果认证不成功,提示认证失败 + pageContext.setAttribute("message", "用户名"+ un +"认证失败,请检查用户名与密码是否正确"); + } + } + } +}else{ + //pageContext.setAttribute("message", "用户名不能为空"); +} + %> @@ -54,31 +72,33 @@ 消毒供应质量追溯管理系统 -<%-- --%> + - + -
+
-
- 账号或密码错误!请重新输入! - 验证码错误,请重新输入! - 该用户没有回收清点的权限,请重新输入! - 注册码不正确或试用期已过!请与管理人员联系! - 身份验证接口访问异常,请与系统管理员联系! +