Commit 52cdc784 by chenzx

单点登录模式修改为war模式

parent cfa1e5e8
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<groupId>LV77</groupId> <groupId>LV77</groupId>
<artifactId>ads-mds-login</artifactId> <artifactId>ads-mds-login</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>war</packaging>
<name>mdslogin</name> <name>mdslogin</name>
<description>mdslogin</description> <description>mdslogin</description>
...@@ -66,10 +66,11 @@ ...@@ -66,10 +66,11 @@
<artifactId>jedis</artifactId> <artifactId>jedis</artifactId>
<version>2.9.0</version> <version>2.9.0</version>
</dependency> </dependency>
<!--
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId> <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency> </dependency>-->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
...@@ -98,6 +99,17 @@ ...@@ -98,6 +99,17 @@
<version>5.2.4.Final</version> <version>5.2.4.Final</version>
</dependency> </dependency>
<!-- CXF webservice --> <!-- CXF webservice -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
<dependencyManagement> <dependencyManagement>
......
package com.keymobile.proxy.api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@Controller
public class SSOCtrl {
private Logger logger = LoggerFactory.getLogger(SSOCtrl.class);
// @Value("${sso.url}")
// private String ssoUrl;
@Value("${redirect-url.data-platform}")
private String dataPlatformURL;
@GetMapping("/go")
public String doJump(Map<String, Object> model) {
model.put("success", true);
model.put("redirect-url", dataPlatformURL);
model.put("msg", "验证成功");
return "main";
}
@GetMapping("/refuse")
public String refuse(Map<String, Object> model,
@RequestParam(value = "code",required = false) String code) {
model.put("success", false);
switch (code){
case "401":
model.put("msg", "缺少token参数,验证失败");
break;
case "402":
model.put("msg", "Token验证异常,请重试");
break;
case "403":
model.put("msg", "单点登录异常,请联系管理员");
break;
case "405":
model.put("msg", "Token验证失败,请联系管理员");
break;
}
return "main";
}
}
\ No newline at end of file
...@@ -49,7 +49,7 @@ public class RESTAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuc ...@@ -49,7 +49,7 @@ public class RESTAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuc
&& !rootAllowLogin) && !rootAllowLogin)
returnStatus = "root not allow login"; returnStatus = "root not allow login";
//response.sendRedirect("/sso/go"); response.sendRedirect("/go");
PrintWriter writer = response.getWriter(); PrintWriter writer = response.getWriter();
writer.write(returnStatus); writer.write(returnStatus);
......
...@@ -30,6 +30,10 @@ spring: ...@@ -30,6 +30,10 @@ spring:
multipart: multipart:
max-file-size: 100Mb max-file-size: 100Mb
max-request-size: 100Mb max-request-size: 100Mb
mvc:
view:
prefix: /WEB-INF/jsp/
suffix: .jsp
eureka: eureka:
client: client:
...@@ -52,6 +56,7 @@ logging: ...@@ -52,6 +56,7 @@ logging:
redirect-url: redirect-url:
system-management: http://192.168.0.216:9090/center-home/view/index system-management: http://192.168.0.216:9090/center-home/view/index
data-platform: http://192.168.0.216:9090/center-home/view/index
security: security:
permit: false permit: false
......
...@@ -3,6 +3,6 @@ spring: ...@@ -3,6 +3,6 @@ spring:
name: auth name: auth
profiles: profiles:
active: test active: test
cloud: # cloud:
config: # config:
uri: http://localhost:8082 # uri: http://localhost:8082
\ No newline at end of file \ No newline at end of file
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page pageEncoding = "gb2312" %>
<%@ page contentType = "text/html;charset=gb2312" %>
<% request.setCharacterEncoding("gb2312"); %>
<html lang="en">
<c:choose>
<c:when test="${requestScope.success}">
<%
response.sendRedirect((String) request.getAttribute("redirect-url"));
%>
</c:when>
<c:otherwise>
${requestScope.msg}
</c:otherwise>
</c:choose>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment