├── Flow-chart ├── SSO权限流程图.png ├── SSO流程图.png └── 配置子系统流程图.png ├── Interceptor-api-1.0-SNAPSHOT.jar ├── Interceptor-api ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.core.resources.prefs │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ └── org.eclipse.wst.validation.prefs ├── pom.xml ├── src │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── sso │ │ │ │ ├── Interceptor │ │ │ │ └── Interceptor.java │ │ │ │ ├── constant │ │ │ │ └── Constant.java │ │ │ │ ├── dao │ │ │ │ └── redis │ │ │ │ │ ├── JedisPoolFactory.java │ │ │ │ │ ├── PtokenDao.java │ │ │ │ │ ├── TicketDao.java │ │ │ │ │ ├── UrlDao.java │ │ │ │ │ └── UserStateDao.java │ │ │ │ ├── dto │ │ │ │ ├── CheckOut.java │ │ │ │ └── IntercepData.java │ │ │ │ └── util │ │ │ │ ├── HttpClientUtil.java │ │ │ │ └── InterceptorUtil.java │ │ ├── resources │ │ │ └── JedisPool-Conf.properties │ │ └── webapp │ │ │ └── META-INF │ │ │ └── MANIFEST.MF │ └── test │ │ └── java │ │ └── com │ │ └── sohu │ │ └── test │ │ └── HttpClientTest.java └── target │ ├── Interceptor-api-1.0-SNAPSHOT.jar │ ├── classes │ ├── JedisPool-Conf.properties │ ├── META-INF │ │ └── maven │ │ │ └── Interceptor-api │ │ │ └── Interceptor-api │ │ │ ├── pom.properties │ │ │ └── pom.xml │ └── com │ │ └── sso │ │ ├── Interceptor │ │ └── Interceptor.class │ │ ├── constant │ │ └── Constant.class │ │ ├── dao │ │ └── redis │ │ │ ├── JedisPoolFactory.class │ │ │ ├── PtokenDao.class │ │ │ ├── TicketDao.class │ │ │ ├── UrlDao.class │ │ │ └── UserStateDao.class │ │ ├── dto │ │ ├── CheckOut.class │ │ └── IntercepData.class │ │ └── util │ │ ├── HttpClientUtil.class │ │ └── InterceptorUtil.class │ ├── maven-archiver │ └── pom.properties │ ├── surefire-reports │ ├── TEST-com.sohu.test.HttpClientTest.xml │ └── com.sohu.test.HttpClientTest.txt │ └── test-classes │ └── com │ └── sohu │ └── test │ └── HttpClientTest.class ├── README.md ├── marmot-sso-child-another ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.core.resources.prefs │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ └── org.eclipse.wst.validation.prefs ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── sohu │ │ │ └── controller │ │ │ └── UserController.java │ │ ├── resources │ │ ├── app.properties │ │ ├── c3p0.properties │ │ ├── hibernate │ │ │ └── hibernate.cfg.xml │ │ └── spring │ │ │ ├── spring-dao.xml │ │ │ ├── spring-mvc.xml │ │ │ └── spring-service.xml │ │ └── webapp │ │ ├── META-INF │ │ └── MANIFEST.MF │ │ └── WEB-INF │ │ ├── jsp │ │ ├── 1.jsp │ │ ├── 2.jsp │ │ ├── error.jsp │ │ └── index.jsp │ │ └── web.xml └── target │ ├── classes │ ├── app.properties │ ├── c3p0.properties │ ├── com │ │ └── sohu │ │ │ └── controller │ │ │ └── UserController.class │ ├── hibernate │ │ └── hibernate.cfg.xml │ └── spring │ │ ├── spring-dao.xml │ │ ├── spring-mvc.xml │ │ └── spring-service.xml │ ├── m2e-jee │ └── web-resources │ │ └── META-INF │ │ ├── MANIFEST.MF │ │ └── maven │ │ └── SSO-child-another │ │ └── SSO-child-another │ │ ├── pom.properties │ │ └── pom.xml │ └── tmp │ └── jsp │ └── org │ └── apache │ └── jsp │ └── WEB_002dINF │ └── jsp │ ├── _1_jsp.class │ ├── _1_jsp.java │ ├── index_jsp.class │ └── index_jsp.java ├── marmot-sso-child ├── .classpath ├── .project ├── .settings │ ├── .jsdtscope │ ├── org.eclipse.core.resources.prefs │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ └── org.eclipse.wst.validation.prefs ├── pom.xml ├── src │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── sohu │ │ │ │ └── controller │ │ │ │ └── UserController.java │ │ ├── resources │ │ │ ├── app.properties │ │ │ ├── c3p0.properties │ │ │ ├── hibernate │ │ │ │ └── hibernate.cfg.xml │ │ │ └── spring │ │ │ │ ├── spring-dao.xml │ │ │ │ ├── spring-mvc.xml │ │ │ │ └── spring-service.xml │ │ └── webapp │ │ │ ├── META-INF │ │ │ └── MANIFEST.MF │ │ │ ├── WEB-INF │ │ │ ├── jsp │ │ │ │ ├── 1.jsp │ │ │ │ ├── 2.jsp │ │ │ │ ├── error.jsp │ │ │ │ └── index.jsp │ │ │ └── web.xml │ │ │ └── images │ │ │ └── 1.jpg │ └── test │ │ └── java │ │ └── com │ │ └── sohu │ │ └── test │ │ └── Demo1.java └── target │ ├── classes │ ├── app.properties │ ├── c3p0.properties │ ├── com │ │ └── sohu │ │ │ └── controller │ │ │ └── UserController.class │ ├── hibernate │ │ └── hibernate.cfg.xml │ └── spring │ │ ├── spring-dao.xml │ │ ├── spring-mvc.xml │ │ └── spring-service.xml │ ├── m2e-jee │ └── web-resources │ │ └── META-INF │ │ ├── MANIFEST.MF │ │ └── maven │ │ └── SSO-child │ │ └── SSO-child │ │ ├── pom.properties │ │ └── pom.xml │ ├── test-classes │ └── com │ │ └── sohu │ │ └── test │ │ └── Demo1.class │ └── tmp │ └── jsp │ └── org │ └── apache │ └── jsp │ └── WEB_002dINF │ └── jsp │ ├── _1_jsp.class │ ├── _1_jsp.java │ ├── _2_jsp.class │ ├── _2_jsp.java │ ├── _3_jsp.class │ ├── _3_jsp.java │ ├── index_jsp.class │ └── index_jsp.java └── marmot-sso ├── .classpath ├── .project ├── .settings ├── .jsdtscope ├── org.eclipse.core.resources.prefs ├── org.eclipse.jdt.core.prefs ├── org.eclipse.m2e.core.prefs ├── org.eclipse.wst.common.component ├── org.eclipse.wst.common.project.facet.core.xml ├── org.eclipse.wst.jsdt.ui.superType.container ├── org.eclipse.wst.jsdt.ui.superType.name └── org.eclipse.wst.validation.prefs ├── pom.xml ├── src ├── main │ ├── java │ │ └── com │ │ │ └── sohu │ │ │ ├── controller │ │ │ ├── AppController.java │ │ │ ├── BaseController.java │ │ │ └── SsoController.java │ │ │ ├── dao │ │ │ ├── AppDao.java │ │ │ ├── BaseDao.java │ │ │ ├── UserDao.java │ │ │ ├── impl │ │ │ │ ├── AppDaoImpl.java │ │ │ │ ├── BaseDaoImpl.java │ │ │ │ └── UserDaoImpl.java │ │ │ └── redis │ │ │ │ ├── JedisPoolFactory.java │ │ │ │ ├── PtokenDao.java │ │ │ │ ├── TicketDao.java │ │ │ │ ├── UrlDao.java │ │ │ │ └── UserStateDao.java │ │ │ ├── dto │ │ │ ├── AppEnum.java │ │ │ ├── CheckOut.java │ │ │ ├── IntercepData.java │ │ │ └── JsonDto.java │ │ │ ├── interceptor │ │ │ └── Interceptor.java │ │ │ ├── model │ │ │ ├── App.java │ │ │ ├── Group.java │ │ │ ├── Url.java │ │ │ ├── User.java │ │ │ └── UserGroup.java │ │ │ ├── service │ │ │ ├── AppService.java │ │ │ ├── UserService.java │ │ │ └── impl │ │ │ │ ├── AppServiceImpl.java │ │ │ │ └── UserServiceImpl.java │ │ │ └── util │ │ │ ├── DesUtil.java │ │ │ ├── HttpClientUtil.java │ │ │ └── InterceptorUtil.java │ ├── resources │ │ ├── JedisPool-Conf.properties │ │ ├── app.properties │ │ ├── c3p0.properties │ │ ├── hibernate │ │ │ └── hibernate.cfg.xml │ │ └── spring │ │ │ ├── spring-dao.xml │ │ │ ├── spring-mvc.xml │ │ │ └── spring-service.xml │ └── webapp │ │ ├── META-INF │ │ └── MANIFEST.MF │ │ ├── WEB-INF │ │ ├── jsp │ │ │ ├── admin │ │ │ │ └── manageUser.jsp │ │ │ ├── applogin.jsp │ │ │ ├── develop │ │ │ │ └── manageAdmin.jsp │ │ │ ├── error.jsp │ │ │ ├── login.jsp │ │ │ ├── logout.jsp │ │ │ ├── sso_admin │ │ │ │ └── index.jsp │ │ │ └── user │ │ │ │ ├── app_apply.jsp │ │ │ │ └── repeatLogin.jsp │ │ └── web.xml │ │ ├── css │ │ ├── style.css │ │ └── style2.css │ │ └── images │ │ ├── adm.png │ │ ├── avtar.png │ │ ├── banner.jpg │ │ ├── bg1.jpg │ │ ├── close.png │ │ ├── key.png │ │ ├── logout.jpg │ │ └── pass.png └── test │ └── java │ └── com │ └── sohu │ └── service │ └── test │ ├── AppServiceTest.java │ └── UserServiceTest.java └── target ├── classes ├── JedisPool-Conf.properties ├── app.properties ├── c3p0.properties ├── com │ └── sohu │ │ ├── controller │ │ ├── AppController.class │ │ ├── BaseController.class │ │ └── SsoController.class │ │ ├── dao │ │ ├── AppDao.class │ │ ├── BaseDao.class │ │ ├── UserDao.class │ │ ├── impl │ │ │ ├── AppDaoImpl.class │ │ │ ├── BaseDaoImpl.class │ │ │ └── UserDaoImpl.class │ │ └── redis │ │ │ ├── JedisPoolFactory.class │ │ │ ├── PtokenDao.class │ │ │ ├── TicketDao.class │ │ │ ├── UrlDao.class │ │ │ └── UserStateDao.class │ │ ├── dto │ │ ├── AppEnum.class │ │ ├── CheckOut.class │ │ ├── IntercepData.class │ │ └── JsonDto.class │ │ ├── interceptor │ │ └── Interceptor.class │ │ ├── model │ │ ├── App.class │ │ ├── Group.class │ │ ├── Url.class │ │ ├── User.class │ │ └── UserGroup.class │ │ ├── service │ │ ├── AppService.class │ │ ├── UserService.class │ │ └── impl │ │ │ ├── AppServiceImpl.class │ │ │ └── UserServiceImpl.class │ │ └── util │ │ ├── DesUtil.class │ │ ├── HttpClientUtil.class │ │ └── InterceptorUtil.class ├── hibernate │ └── hibernate.cfg.xml └── spring │ ├── spring-dao.xml │ ├── spring-mvc.xml │ └── spring-service.xml ├── m2e-jee └── web-resources │ └── META-INF │ ├── MANIFEST.MF │ └── maven │ └── SSO │ └── SSO │ ├── pom.properties │ └── pom.xml ├── test-classes └── com │ └── sohu │ └── service │ └── test │ ├── AppServiceTest.class │ └── UserServiceTest.class └── tmp └── jsp └── org └── apache └── jsp └── WEB_002dINF └── jsp ├── admin ├── manageUser_jsp.class └── manageUser_jsp.java ├── applogin_jsp.class ├── applogin_jsp.java ├── develop ├── manageAdmin_jsp.class └── manageAdmin_jsp.java ├── login_jsp.class ├── login_jsp.java ├── logout_jsp.class ├── logout_jsp.java └── sso_005fadmin ├── index_jsp.class └── index_jsp.java /Flow-chart/SSO权限流程图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/Flow-chart/SSO权限流程图.png -------------------------------------------------------------------------------- /Flow-chart/SSO流程图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/Flow-chart/SSO流程图.png -------------------------------------------------------------------------------- /Flow-chart/配置子系统流程图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/Flow-chart/配置子系统流程图.png -------------------------------------------------------------------------------- /Interceptor-api-1.0-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/Interceptor-api-1.0-SNAPSHOT.jar -------------------------------------------------------------------------------- /Interceptor-api/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Interceptor-api/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Interceptor-api 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.common.project.facet.core.builder 20 | 21 | 22 | 23 | 24 | org.eclipse.wst.validation.validationbuilder 25 | 26 | 27 | 28 | 29 | com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator 30 | 31 | 32 | 33 | 34 | org.eclipse.m2e.core.maven2Builder 35 | 36 | 37 | 38 | 39 | com.genuitec.eclipse.springframework.springbuilder 40 | 41 | 42 | 43 | 44 | 45 | com.genuitec.eclipse.springframework.springnature 46 | org.eclipse.m2e.core.maven2Nature 47 | org.eclipse.jem.workbench.JavaEMFNature 48 | org.eclipse.wst.common.modulecore.ModuleCoreNature 49 | org.eclipse.wst.common.project.facet.core.nature 50 | org.eclipse.jdt.core.javanature 51 | org.eclipse.wst.jsdt.core.jsNature 52 | 53 | 54 | -------------------------------------------------------------------------------- /Interceptor-api/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Interceptor-api/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding//src/test/java=UTF-8 5 | encoding//src/test/resources=UTF-8 6 | encoding/=UTF-8 7 | -------------------------------------------------------------------------------- /Interceptor-api/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.compliance=1.7 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.7 9 | -------------------------------------------------------------------------------- /Interceptor-api/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /Interceptor-api/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Interceptor-api/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Interceptor-api/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /Interceptor-api/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /Interceptor-api/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /Interceptor-api/src/main/java/com/sso/constant/Constant.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sso.constant; 5 | /** 6 | *

7 | * Description: 8 | *

9 | * @author wenbozhang 10 | * @version 1.0 11 | * @Date 2016年2月29日下午3:07:56 12 | */ 13 | public class Constant { 14 | public static final String Server_Address="http://127.0.0.1:8080"; 15 | 16 | public static final String Server_Logout="http://127.0.0.1:8080/user/logout"; 17 | } 18 | -------------------------------------------------------------------------------- /Interceptor-api/src/main/java/com/sso/dao/redis/JedisPoolFactory.java: -------------------------------------------------------------------------------- 1 | package com.sso.dao.redis; 2 | 3 | import java.util.ResourceBundle; 4 | 5 | import org.apache.commons.pool2.impl.GenericObjectPoolConfig; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.stereotype.Repository; 9 | 10 | import redis.clients.jedis.JedisPool; 11 | 12 | @Repository 13 | public class JedisPoolFactory { 14 | 15 | private final static Logger logger = LoggerFactory.getLogger(JedisPoolFactory.class); 16 | 17 | private static String REDIS_HOST; 18 | private static int REDIS_PORT; 19 | private static int JEDIS_POOL_TIME_OUT; 20 | 21 | /** 22 | * 加载JedisPool-Conf.properties配置文件中的信息 23 | */ 24 | static { 25 | ResourceBundle resourceBundle = ResourceBundle.getBundle("JedisPool-Conf"); 26 | REDIS_HOST = resourceBundle.getString("redis.host"); 27 | REDIS_PORT = Integer.valueOf(resourceBundle.getString("redis.port")); 28 | JEDIS_POOL_TIME_OUT = Integer.valueOf(resourceBundle.getString("jedis.pooltimeout")); 29 | } 30 | 31 | /** 32 | * 静态工厂方法创建JedisPool 33 | * @return 34 | */ 35 | public static JedisPool getStaticJedisPool() { 36 | JedisPool jedisPool = null; 37 | GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig(); 38 | poolConfig.setMaxTotal(GenericObjectPoolConfig.DEFAULT_MAX_TOTAL * 5); 39 | poolConfig.setMaxIdle(GenericObjectPoolConfig.DEFAULT_MAX_IDLE * 3); 40 | poolConfig.setMinIdle(GenericObjectPoolConfig.DEFAULT_MIN_IDLE * 2); 41 | poolConfig.setJmxEnabled(true); 42 | poolConfig.setMaxWaitMillis(3000); 43 | jedisPool = new JedisPool(poolConfig, REDIS_HOST, REDIS_PORT, JEDIS_POOL_TIME_OUT); 44 | logger.info("jedisPool={}",jedisPool); 45 | return jedisPool; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Interceptor-api/src/main/java/com/sso/dao/redis/PtokenDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sso.dao.redis; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | import java.util.Set; 9 | 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Repository; 12 | 13 | import redis.clients.jedis.Jedis; 14 | 15 | /** 16 | *

17 | * Description: 18 | *

19 | * @author wenbozhang 20 | * @version 1.0 21 | * @Date 2016年2月25日上午11:34:15 22 | */ 23 | @Repository 24 | public class PtokenDao { 25 | @Autowired 26 | private JedisPoolFactory jedisPool; 27 | 28 | public void setPtoken(long userid, String ptoken) { 29 | Jedis jedis = null; 30 | try { 31 | String key = "user:ptoken:" + userid; 32 | jedis = JedisPoolFactory.getStaticJedisPool().getResource(); 33 | jedis.sadd(key, ptoken); 34 | } finally { 35 | jedis.close(); 36 | } 37 | 38 | } 39 | 40 | public boolean getPtoken(long userid,String ptoken) { 41 | Jedis jedis = null; 42 | try { 43 | String key = "user:ptoken:" + userid; 44 | jedis = JedisPoolFactory.getStaticJedisPool().getResource(); 45 | Set set=jedis.smembers(key); 46 | if(set.size()==0){ 47 | return false; 48 | } 49 | List list=new ArrayList(); 50 | list.addAll(set); 51 | for (String s : list) { 52 | if(s.equals(ptoken)){ 53 | return true; 54 | } 55 | } 56 | return false; 57 | } finally { 58 | jedis.close(); 59 | } 60 | } 61 | 62 | public void detelePtoken(long userid){ 63 | Jedis jedis = null; 64 | try { 65 | String key = "user:ptoken:" + userid; 66 | jedis = JedisPoolFactory.getStaticJedisPool().getResource(); 67 | jedis.del(key); 68 | } finally { 69 | jedis.close(); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Interceptor-api/src/main/java/com/sso/dao/redis/TicketDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sso.dao.redis; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Repository; 8 | 9 | import redis.clients.jedis.Jedis; 10 | 11 | /** 12 | *

13 | * Description: 14 | *

15 | * 16 | * @author wenbozhang 17 | * @version 1.0 18 | * @Date 2016年2月25日上午10:50:27 19 | */ 20 | @Repository 21 | public class TicketDao { 22 | @Autowired 23 | private JedisPoolFactory jedisPool; 24 | 25 | public void setTicket(long userid, String ticket) { 26 | Jedis jedis = null; 27 | try { 28 | String key = "user:ticket:" + userid; 29 | jedis = JedisPoolFactory.getStaticJedisPool().getResource(); 30 | int timeout = 60 * 2; 31 | jedis.setex(key, timeout,ticket); 32 | } finally { 33 | jedis.close(); 34 | } 35 | 36 | } 37 | 38 | public boolean getTicket(long userid,String ticket) { 39 | Jedis jedis = null; 40 | try { 41 | String key = "user:ticket:" + userid; 42 | jedis = JedisPoolFactory.getStaticJedisPool().getResource(); 43 | String JedisTicket=jedis.get(key); 44 | if(ticket.equals(JedisTicket)){ 45 | return true; 46 | }else{ 47 | return false; 48 | } 49 | } finally { 50 | jedis.close(); 51 | } 52 | } 53 | 54 | public void deteleTicket(long userid){ 55 | Jedis jedis = null; 56 | try { 57 | String key = "user:ticket:" + userid; 58 | jedis = JedisPoolFactory.getStaticJedisPool().getResource(); 59 | jedis.del(key); 60 | } finally { 61 | jedis.close(); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Interceptor-api/src/main/java/com/sso/dao/redis/UrlDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sso.dao.redis; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Repository; 8 | 9 | import redis.clients.jedis.Jedis; 10 | 11 | /** 12 | *

13 | * Description: 14 | *

15 | * @author wenbozhang 16 | * @version 1.0 17 | * @Date 2016年3月2日下午5:14:22 18 | */ 19 | @Repository 20 | public class UrlDao { 21 | @Autowired 22 | private JedisPoolFactory jedisPool; 23 | 24 | public void setUrl(long userid, String[] url) { 25 | Jedis jedis = null; 26 | try { 27 | String key = "user:url:"+ userid; 28 | jedis = JedisPoolFactory.getStaticJedisPool().getResource(); 29 | jedis.sadd(key, url); 30 | } finally { 31 | jedis.close(); 32 | } 33 | 34 | } 35 | 36 | 37 | public boolean getUrl(long userid,String url) { 38 | Jedis jedis = null; 39 | try { 40 | String key = "user:url:"+ userid; 41 | jedis = JedisPoolFactory.getStaticJedisPool().getResource(); 42 | return jedis.sismember(key, url); 43 | } finally { 44 | jedis.close(); 45 | } 46 | } 47 | 48 | public void deteleTicket(long userid){ 49 | Jedis jedis = null; 50 | try { 51 | String key = "user:url:"+ userid; 52 | jedis = JedisPoolFactory.getStaticJedisPool().getResource(); 53 | jedis.del(key); 54 | } finally { 55 | jedis.close(); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Interceptor-api/src/main/java/com/sso/dao/redis/UserStateDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sso.dao.redis; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Repository; 8 | 9 | import redis.clients.jedis.Jedis; 10 | 11 | /** 12 | *

13 | * Description: 14 | *

15 | * @author wenbozhang 16 | * @version 1.0 17 | * @Date 2016年2月25日上午11:26:45 18 | */ 19 | @Repository 20 | public class UserStateDao { 21 | @Autowired 22 | private JedisPoolFactory jedisPool; 23 | 24 | public void setUser(long userid) { 25 | Jedis jedis = null; 26 | try { 27 | String key = "user:state:" + userid; 28 | jedis = JedisPoolFactory.getStaticJedisPool().getResource(); 29 | jedis.setnx(key, "1"); 30 | } finally { 31 | jedis.close(); 32 | } 33 | 34 | } 35 | 36 | public boolean getUser(long userid) { 37 | Jedis jedis = null; 38 | try { 39 | String key = "user:state:" + userid; 40 | jedis = JedisPoolFactory.getStaticJedisPool().getResource(); 41 | String state=jedis.get(key); 42 | if("".equals(state)||state==null){ 43 | return false; 44 | }else{ 45 | return true; 46 | } 47 | 48 | } finally { 49 | jedis.close(); 50 | } 51 | } 52 | 53 | public void deteleUser(long userid){ 54 | Jedis jedis = null; 55 | try { 56 | String key = "user:state:" + userid; 57 | jedis = JedisPoolFactory.getStaticJedisPool().getResource(); 58 | jedis.del(key); 59 | } finally { 60 | jedis.close(); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Interceptor-api/src/main/java/com/sso/dto/CheckOut.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sso.dto; 5 | /** 6 | *

7 | * Description:用于进行子系统的校验,以及注销校验 8 | *

9 | * @author wenbozhang 10 | * @version 1.0 11 | * @Date 2016年2月19日上午10:58:53 12 | */ 13 | public class CheckOut { 14 | private Long userId; //用于表示唯一用户 15 | private String ticket; //用于登录验证的票据 16 | private String ptoken; //用于注销验证的票据 17 | /** 18 | * 代表登录当前系统用户的类型 1:普通用户 2 管理员 3 开发者 4 SSO超管 19 | */ 20 | private int userState; 21 | 22 | 23 | public int getUserState() { 24 | return userState; 25 | } 26 | public void setUserState(int userState) { 27 | this.userState = userState; 28 | } 29 | public Long getUserId() { 30 | return userId; 31 | } 32 | public void setUserId(Long userId) { 33 | this.userId = userId; 34 | } 35 | public String getTicket() { 36 | return ticket; 37 | } 38 | public void setTicket(String ticket) { 39 | this.ticket = ticket; 40 | } 41 | public String getPtoken() { 42 | return ptoken; 43 | } 44 | public void setPtoken(String ptoken) { 45 | this.ptoken = ptoken; 46 | } 47 | public CheckOut(){}; 48 | public CheckOut(Long userId, String ticket, String ptoken) { 49 | this.userId = userId; 50 | this.ticket = ticket; 51 | this.ptoken = ptoken; 52 | } 53 | @Override 54 | public String toString() { 55 | return "CheckOut [userId=" + userId + ", ticket=" + ticket + ", ptoken=" + ptoken + "]"; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Interceptor-api/src/main/java/com/sso/dto/IntercepData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sso.dto; 5 | 6 | 7 | 8 | 9 | /** 10 | *

11 | * Description: 12 | *

13 | * @author wenbozhang 14 | * @version 1.0 15 | * @Date 2016年3月2日下午12:11:24 16 | */ 17 | public class IntercepData { 18 | private CheckOut checkOut; 19 | private String[] urls; 20 | 21 | public CheckOut getCheckOut() { 22 | return checkOut; 23 | } 24 | public void setCheckOut(CheckOut checkOut) { 25 | this.checkOut = checkOut; 26 | } 27 | 28 | public String[] getUrls() { 29 | return urls; 30 | } 31 | public void setUrls(String[] urls) { 32 | this.urls = urls; 33 | } 34 | 35 | public IntercepData(CheckOut checkOut, String[] urls) { 36 | super(); 37 | this.checkOut = checkOut; 38 | this.urls = urls; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Interceptor-api/src/main/java/com/sso/util/HttpClientUtil.java: -------------------------------------------------------------------------------- 1 | package com.sso.util; 2 | 3 | 4 | import java.net.URI; 5 | import java.util.ArrayList; 6 | import java.util.Iterator; 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | import org.apache.http.HttpEntity; 11 | import org.apache.http.HttpResponse; 12 | import org.apache.http.NameValuePair; 13 | import org.apache.http.client.HttpClient; 14 | import org.apache.http.client.entity.UrlEncodedFormEntity; 15 | import org.apache.http.client.methods.HttpGet; 16 | import org.apache.http.client.methods.HttpPost; 17 | import org.apache.http.impl.client.DefaultHttpClient; 18 | import org.apache.http.message.BasicNameValuePair; 19 | import org.apache.http.util.EntityUtils; 20 | import org.slf4j.Logger; 21 | import org.slf4j.LoggerFactory; 22 | 23 | public class HttpClientUtil { 24 | private final Logger logger = LoggerFactory.getLogger(HttpClientUtil.class); 25 | 26 | public String doPost(String url, Map map, String charset) { 27 | HttpClient httpClient = null; 28 | HttpPost httpPost = null; 29 | String result = null; 30 | try { 31 | httpClient = new DefaultHttpClient(); 32 | httpPost = new HttpPost(url); 33 | //设置参数 34 | List list = new ArrayList(); 35 | Iterator iterator = map.entrySet().iterator(); 36 | while (iterator.hasNext()) { 37 | Map.Entry elem = (Map.Entry) iterator.next(); 38 | list.add(new BasicNameValuePair(elem.getKey(), elem.getValue())); 39 | } 40 | if (list.size() > 0) { 41 | UrlEncodedFormEntity entity = new UrlEncodedFormEntity(list, charset); 42 | httpPost.setEntity(entity); 43 | } 44 | HttpResponse response = httpClient.execute(httpPost); 45 | if (response != null) { 46 | HttpEntity resEntity = response.getEntity(); 47 | if (resEntity != null) { 48 | result = EntityUtils.toString(resEntity, charset); 49 | } 50 | } 51 | } catch (Exception e) { 52 | logger.error(e.getMessage()+"url="+url); 53 | }finally{ 54 | httpPost.releaseConnection(); 55 | } 56 | return result; 57 | } 58 | 59 | public String doGet(String url) { 60 | HttpGet httpGet = null; 61 | try { 62 | HttpClient httpClient = new DefaultHttpClient(); 63 | httpGet = new HttpGet(); 64 | httpGet.setURI(new URI(url)); 65 | HttpResponse reponse = httpClient.execute(httpGet); 66 | HttpEntity httpEntity = reponse.getEntity(); 67 | if (httpEntity == null) { 68 | logger.info("HttpClientUtil doGet 发生异常"); 69 | return null; 70 | } else { 71 | String value = EntityUtils.toString(httpEntity); 72 | return value; 73 | } 74 | } catch (Exception e) { 75 | logger.error(e.getMessage()+" url="+url); 76 | }finally{ 77 | httpGet.releaseConnection(); 78 | } 79 | return null; 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /Interceptor-api/src/main/java/com/sso/util/InterceptorUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sso.util; 5 | 6 | import java.util.ResourceBundle; 7 | 8 | import javax.servlet.http.HttpServletRequest; 9 | 10 | import com.google.gson.Gson; 11 | import com.sso.dto.CheckOut; 12 | 13 | 14 | 15 | /** 16 | *

17 | * Description: 18 | *

19 | * @author wenbozhang 20 | * @version 1.0 21 | * @Date 2016年2月19日上午9:59:20 22 | */ 23 | public class InterceptorUtil { 24 | public static String getaAppId(){ 25 | ResourceBundle resource = ResourceBundle.getBundle("app"); 26 | return resource.getString("appid"); 27 | } 28 | 29 | public static String toJson(Object t){ 30 | Gson gson=new Gson(); 31 | return gson.toJson(t); 32 | } 33 | 34 | public static CheckOut toCheckOut(String s){ 35 | Gson gson=new Gson(); 36 | return gson.fromJson(s,CheckOut.class); 37 | } 38 | public static String getRequestUrl(HttpServletRequest request){ 39 | String url=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getRequestURI(); 40 | System.out.println("=====url====="+url); 41 | return url; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Interceptor-api/src/main/resources/JedisPool-Conf.properties: -------------------------------------------------------------------------------- 1 | #单机 host 2 | redis.host=XXXX 3 | #单机 port 4 | redis.port=6888 5 | #超时时间 毫秒 6 | jedis.pooltimeout=1000 -------------------------------------------------------------------------------- /Interceptor-api/src/main/webapp/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /Interceptor-api/src/test/java/com/sohu/test/HttpClientTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.test; 5 | 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | import org.junit.Test; 10 | 11 | import com.sso.dto.CheckOut; 12 | import com.sso.util.HttpClientUtil; 13 | import com.sso.util.InterceptorUtil; 14 | 15 | 16 | /** 17 | *

18 | * Description: 19 | *

20 | * @author wenbozhang 21 | * @version 1.0 22 | * @Date 2016年2月29日上午10:39:31 23 | */ 24 | public class HttpClientTest { 25 | 26 | @Test 27 | public void test1(){ 28 | HttpClientUtil client=new HttpClientUtil(); 29 | Map map=new HashMap(); 30 | map.put("name", "张文博"); 31 | String result=client.doPost("http://127.0.0.1:8080/manager/index", map,"UTF-8"); 32 | System.out.println(result); 33 | } 34 | @Test 35 | public void test2(){ 36 | Map map=new HashMap(); 37 | map.put("ticket","cf767e6c86026a75f9b30b3d1090c58f"); 38 | map.put("userid","1"); 39 | HttpClientUtil client=new HttpClientUtil(); 40 | String s=client.doPost("http://127.0.0.1:8080/user/check",map,"UTF-8"); 41 | System.out.println(s); 42 | } 43 | @Test 44 | public void test3(){ 45 | CheckOut checkOut=new CheckOut(1L,"11","111"); 46 | String json=InterceptorUtil.toJson(checkOut); 47 | System.out.println(json); 48 | 49 | CheckOut cc=InterceptorUtil.toCheckOut(json); 50 | System.out.println(cc); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Interceptor-api/target/Interceptor-api-1.0-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/Interceptor-api/target/Interceptor-api-1.0-SNAPSHOT.jar -------------------------------------------------------------------------------- /Interceptor-api/target/classes/JedisPool-Conf.properties: -------------------------------------------------------------------------------- 1 | #单机 host 2 | redis.host=10.10.88.223 3 | #单机 port 4 | redis.port=6888 5 | #超时时间 毫秒 6 | jedis.pooltimeout=1000 -------------------------------------------------------------------------------- /Interceptor-api/target/classes/META-INF/maven/Interceptor-api/Interceptor-api/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Sun Mar 06 13:27:12 CST 2016 3 | version=1.0-SNAPSHOT 4 | groupId=Interceptor-api 5 | m2e.projectName=Interceptor-api 6 | m2e.projectLocation=E\:\\MyEclipseProject\\Interceptor-api 7 | artifactId=Interceptor-api 8 | -------------------------------------------------------------------------------- /Interceptor-api/target/classes/com/sso/Interceptor/Interceptor.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/Interceptor-api/target/classes/com/sso/Interceptor/Interceptor.class -------------------------------------------------------------------------------- /Interceptor-api/target/classes/com/sso/constant/Constant.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/Interceptor-api/target/classes/com/sso/constant/Constant.class -------------------------------------------------------------------------------- /Interceptor-api/target/classes/com/sso/dao/redis/JedisPoolFactory.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/Interceptor-api/target/classes/com/sso/dao/redis/JedisPoolFactory.class -------------------------------------------------------------------------------- /Interceptor-api/target/classes/com/sso/dao/redis/PtokenDao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/Interceptor-api/target/classes/com/sso/dao/redis/PtokenDao.class -------------------------------------------------------------------------------- /Interceptor-api/target/classes/com/sso/dao/redis/TicketDao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/Interceptor-api/target/classes/com/sso/dao/redis/TicketDao.class -------------------------------------------------------------------------------- /Interceptor-api/target/classes/com/sso/dao/redis/UrlDao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/Interceptor-api/target/classes/com/sso/dao/redis/UrlDao.class -------------------------------------------------------------------------------- /Interceptor-api/target/classes/com/sso/dao/redis/UserStateDao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/Interceptor-api/target/classes/com/sso/dao/redis/UserStateDao.class -------------------------------------------------------------------------------- /Interceptor-api/target/classes/com/sso/dto/CheckOut.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/Interceptor-api/target/classes/com/sso/dto/CheckOut.class -------------------------------------------------------------------------------- /Interceptor-api/target/classes/com/sso/dto/IntercepData.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/Interceptor-api/target/classes/com/sso/dto/IntercepData.class -------------------------------------------------------------------------------- /Interceptor-api/target/classes/com/sso/util/HttpClientUtil.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/Interceptor-api/target/classes/com/sso/util/HttpClientUtil.class -------------------------------------------------------------------------------- /Interceptor-api/target/classes/com/sso/util/InterceptorUtil.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/Interceptor-api/target/classes/com/sso/util/InterceptorUtil.class -------------------------------------------------------------------------------- /Interceptor-api/target/maven-archiver/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven 2 | #Sat Mar 05 23:31:35 CST 2016 3 | version=1.0-SNAPSHOT 4 | groupId=Interceptor-api 5 | artifactId=Interceptor-api 6 | -------------------------------------------------------------------------------- /Interceptor-api/target/surefire-reports/com.sohu.test.HttpClientTest.txt: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------------- 2 | Test set: com.sohu.test.HttpClientTest 3 | ------------------------------------------------------------------------------- 4 | Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.565 sec 5 | -------------------------------------------------------------------------------- /Interceptor-api/target/test-classes/com/sohu/test/HttpClientTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/Interceptor-api/target/test-classes/com/sohu/test/HttpClientTest.class -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # marmot-sso 2 | Proof of concept OAuth server to be used for Single Sign On 3 | -------------------------------------------------------------------------------- /marmot-sso-child-another/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /marmot-sso-child-another/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | SSO-child-another 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.common.project.facet.core.builder 20 | 21 | 22 | 23 | 24 | org.eclipse.wst.validation.validationbuilder 25 | 26 | 27 | 28 | 29 | com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator 30 | 31 | 32 | 33 | 34 | com.genuitec.eclipse.springframework.springbuilder 35 | 36 | 37 | 38 | 39 | org.eclipse.m2e.core.maven2Builder 40 | 41 | 42 | 43 | 44 | 45 | com.genuitec.eclipse.springframework.springnature 46 | org.eclipse.m2e.core.maven2Nature 47 | org.eclipse.jem.workbench.JavaEMFNature 48 | org.eclipse.wst.common.modulecore.ModuleCoreNature 49 | org.eclipse.wst.common.project.facet.core.nature 50 | org.eclipse.jdt.core.javanature 51 | org.eclipse.wst.jsdt.core.jsNature 52 | 53 | 54 | -------------------------------------------------------------------------------- /marmot-sso-child-another/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /marmot-sso-child-another/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding//src/test/java=UTF-8 5 | encoding//src/test/resources=UTF-8 6 | encoding/=UTF-8 7 | -------------------------------------------------------------------------------- /marmot-sso-child-another/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.compliance=1.7 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.7 9 | -------------------------------------------------------------------------------- /marmot-sso-child-another/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /marmot-sso-child-another/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | uses 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /marmot-sso-child-another/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /marmot-sso-child-another/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /marmot-sso-child-another/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /marmot-sso-child-another/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /marmot-sso-child-another/src/main/java/com/sohu/controller/UserController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.controller; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpSession; 8 | 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Controller; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | 13 | import com.sso.dao.redis.PtokenDao; 14 | import com.sso.dao.redis.UrlDao; 15 | import com.sso.dao.redis.UserStateDao; 16 | import com.sso.dto.CheckOut; 17 | 18 | /** 19 | *

20 | * Description: 21 | *

22 | * 23 | * @author wenbozhang 24 | * @version 1.0 25 | * @Date 2016年3月2日下午7:24:26 26 | */ 27 | @Controller 28 | @RequestMapping("/user") 29 | public class UserController { 30 | @Autowired 31 | private PtokenDao PtokenDao; 32 | 33 | @Autowired 34 | private UserStateDao UserStateDao; 35 | 36 | @Autowired 37 | private UrlDao UrlDao; 38 | 39 | @RequestMapping(value = "/index", produces = "application/json;charset=UTF-8") 40 | public String userCenter() { 41 | return "index"; 42 | } 43 | 44 | @RequestMapping(value = "logout") 45 | public String logoutAll(HttpServletRequest request) { 46 | HttpSession session = request.getSession(); 47 | CheckOut checkOut = (CheckOut) session.getAttribute("login"); 48 | if (checkOut == null) 49 | return "redirect:/user/index"; 50 | long userid = checkOut.getUserId(); 51 | String ptoken = checkOut.getPtoken(); 52 | if (PtokenDao.getPtoken(userid, ptoken)) { 53 | PtokenDao.detelePtoken(userid); 54 | UserStateDao.deteleUser(userid); 55 | UrlDao.deteleTicket(userid); 56 | session.removeAttribute("login"); 57 | String url = "http://127.0.0.1:8080/user/logout"; 58 | return "redirect:" + url; 59 | } else { 60 | return "error"; 61 | } 62 | } 63 | 64 | 65 | @RequestMapping(value="/1") 66 | public String page1(){ 67 | return "1"; 68 | } 69 | @RequestMapping(value="/2") 70 | public String page2(){ 71 | return "2"; 72 | } 73 | @RequestMapping(value="/3") 74 | public String page3(){ 75 | return "3"; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /marmot-sso-child-another/src/main/resources/app.properties: -------------------------------------------------------------------------------- 1 | appid=17 2 | 3 | -------------------------------------------------------------------------------- /marmot-sso-child-another/src/main/resources/c3p0.properties: -------------------------------------------------------------------------------- 1 | c3p0.driverClass=com.mysql.jdbc.Driver 2 | c3p0.jdbcUrl=jdbc:mysql://127.0.0.1:3306/sso?useUnicode=true&characterEncoding=UTF8 3 | c3p0.user=root 4 | c3p0.password= 5 | c3p0.minPoolSize=10 6 | c3p0.maxPoolSize=30 7 | c3p0.autoCommitOnClose=false 8 | c3p0.checkoutTimeout=1000 9 | c3p0.acquireRetryAttempts=2 10 | -------------------------------------------------------------------------------- /marmot-sso-child-another/src/main/resources/hibernate/hibernate.cfg.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | org.hibernate.dialect.MySQLDialect 10 | 11 | 12 | true 13 | 14 | 15 | true 16 | 17 | 18 | 20 | 21 | -------------------------------------------------------------------------------- /marmot-sso-child-another/src/main/resources/spring/spring-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 56 | 57 | -------------------------------------------------------------------------------- /marmot-sso-child-another/src/main/resources/spring/spring-mvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /marmot-sso-child-another/src/main/resources/spring/spring-service.xml: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /marmot-sso-child-another/src/main/webapp/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /marmot-sso-child-another/src/main/webapp/WEB-INF/jsp/1.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <% 3 | String path = request.getContextPath(); 4 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 5 | %> 6 | 7 | 8 | 9 | 10 | 11 | 12 | 子系统页面1 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 26 |
27 |

子系统页面1

28 | 可浏览界面 29 |
30 | 31 | 32 | -------------------------------------------------------------------------------- /marmot-sso-child-another/src/main/webapp/WEB-INF/jsp/2.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <% 3 | String path = request.getContextPath(); 4 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 5 | %> 6 | 7 | 8 | 9 | 10 | 11 | 12 | 子系统页面2 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 26 |
27 |

子系统页面2

28 | 可浏览界面 29 |
30 | 31 | 32 | -------------------------------------------------------------------------------- /marmot-sso-child-another/src/main/webapp/WEB-INF/jsp/error.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <% 3 | String path = request.getContextPath(); 4 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 5 | %> 6 | 7 | 8 | 9 | 10 | 11 | 12 | My JSP 'error.jsp' starting page 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 26 |
session不存在
27 | 28 | 29 | -------------------------------------------------------------------------------- /marmot-sso-child-another/src/main/webapp/WEB-INF/jsp/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <% 3 | String path = request.getContextPath(); 4 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 5 | %> 6 | 7 | 8 | 9 | 10 | 11 | 12 | 子系统信息展示页面 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 |
31 |
32 | 59 | 60 | 61 | 62 | 65 | 68 | 71 | 72 | 73 | 74 | 75 | 78 | 81 | 84 | 85 | 86 | 89 | 92 | 95 | 96 | 97 |
63 | 编号 64 | 66 | 连接 67 | 69 | 可点击的连接 70 |
76 | 1 77 | 79 | user/1 80 | 82 | 有权限的连接 83 |
87 | 2 88 | 90 | user/2 91 | 93 | 无权限的连接 94 |
98 |
99 |
100 |
101 | 102 | 103 | -------------------------------------------------------------------------------- /marmot-sso-child-another/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | SSO-child-another 4 | 5 | SSO-child-another 6 | org.springframework.web.servlet.DispatcherServlet 7 | 8 | contextConfigLocation 9 | classpath:spring/spring-mvc.xml 10 | 11 | 1 12 | 13 | 14 | SSO-child-another 15 | / 16 | 17 | -------------------------------------------------------------------------------- /marmot-sso-child-another/target/classes/app.properties: -------------------------------------------------------------------------------- 1 | appid=17 2 | 3 | -------------------------------------------------------------------------------- /marmot-sso-child-another/target/classes/c3p0.properties: -------------------------------------------------------------------------------- 1 | c3p0.driverClass=com.mysql.jdbc.Driver 2 | c3p0.jdbcUrl=jdbc:mysql://127.0.0.1:3306/sso?useUnicode=true&characterEncoding=UTF8 3 | c3p0.user=root 4 | c3p0.password= 5 | c3p0.minPoolSize=10 6 | c3p0.maxPoolSize=30 7 | c3p0.autoCommitOnClose=false 8 | c3p0.checkoutTimeout=1000 9 | c3p0.acquireRetryAttempts=2 10 | -------------------------------------------------------------------------------- /marmot-sso-child-another/target/classes/com/sohu/controller/UserController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso-child-another/target/classes/com/sohu/controller/UserController.class -------------------------------------------------------------------------------- /marmot-sso-child-another/target/classes/hibernate/hibernate.cfg.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | org.hibernate.dialect.MySQLDialect 10 | 11 | 12 | true 13 | 14 | 15 | true 16 | 17 | 18 | 20 | 21 | -------------------------------------------------------------------------------- /marmot-sso-child-another/target/classes/spring/spring-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 56 | 57 | -------------------------------------------------------------------------------- /marmot-sso-child-another/target/classes/spring/spring-mvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /marmot-sso-child-another/target/classes/spring/spring-service.xml: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /marmot-sso-child-another/target/m2e-jee/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Build-Jdk: 1.7.0_45 3 | Built-By: wenbozhang 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /marmot-sso-child-another/target/m2e-jee/web-resources/META-INF/maven/SSO-child-another/SSO-child-another/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Sun Mar 06 20:15:36 CST 2016 3 | version=0.0.1-SNAPSHOT 4 | groupId=SSO-child-another 5 | m2e.projectName=SSO-child-another 6 | m2e.projectLocation=E\:\\MyEclipseProject\\SSO-child-another 7 | artifactId=SSO-child-another 8 | -------------------------------------------------------------------------------- /marmot-sso-child-another/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/_1_jsp.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso-child-another/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/_1_jsp.class -------------------------------------------------------------------------------- /marmot-sso-child-another/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/index_jsp.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso-child-another/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/index_jsp.class -------------------------------------------------------------------------------- /marmot-sso-child/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /marmot-sso-child/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | SSO-child 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.common.project.facet.core.builder 20 | 21 | 22 | 23 | 24 | org.eclipse.wst.validation.validationbuilder 25 | 26 | 27 | 28 | 29 | com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator 30 | 31 | 32 | 33 | 34 | com.genuitec.eclipse.springframework.springbuilder 35 | 36 | 37 | 38 | 39 | org.eclipse.m2e.core.maven2Builder 40 | 41 | 42 | 43 | 44 | 45 | com.genuitec.eclipse.springframework.springnature 46 | org.eclipse.m2e.core.maven2Nature 47 | org.eclipse.jem.workbench.JavaEMFNature 48 | org.eclipse.wst.common.modulecore.ModuleCoreNature 49 | org.eclipse.wst.common.project.facet.core.nature 50 | org.eclipse.jdt.core.javanature 51 | org.eclipse.wst.jsdt.core.jsNature 52 | 53 | 54 | -------------------------------------------------------------------------------- /marmot-sso-child/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /marmot-sso-child/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding//src/test/java=UTF-8 5 | encoding//src/test/resources=UTF-8 6 | encoding/=UTF-8 7 | -------------------------------------------------------------------------------- /marmot-sso-child/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.compliance=1.7 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.7 9 | -------------------------------------------------------------------------------- /marmot-sso-child/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /marmot-sso-child/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | uses 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /marmot-sso-child/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /marmot-sso-child/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /marmot-sso-child/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /marmot-sso-child/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /marmot-sso-child/src/main/java/com/sohu/controller/UserController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.controller; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpSession; 8 | 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Controller; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | 13 | import com.sso.dao.redis.PtokenDao; 14 | import com.sso.dao.redis.UrlDao; 15 | import com.sso.dao.redis.UserStateDao; 16 | import com.sso.dto.CheckOut; 17 | 18 | /** 19 | *

20 | * Description: 21 | *

22 | * 23 | * @author wenbozhang 24 | * @version 1.0 25 | * @Date 2016年3月2日下午7:24:26 26 | */ 27 | @Controller 28 | @RequestMapping("/user") 29 | public class UserController { 30 | @Autowired 31 | private PtokenDao PtokenDao; 32 | 33 | @Autowired 34 | private UserStateDao UserStateDao; 35 | 36 | @Autowired 37 | private UrlDao UrlDao; 38 | 39 | @RequestMapping(value = "/index", produces = "application/json;charset=UTF-8") 40 | public String userCenter() { 41 | return "index"; 42 | } 43 | 44 | @RequestMapping(value = "logout") 45 | public String logoutAll(HttpServletRequest request) { 46 | HttpSession session = request.getSession(); 47 | CheckOut checkOut = (CheckOut) session.getAttribute("login"); 48 | if (checkOut == null) 49 | return "redirect:/user/index"; 50 | long userid = checkOut.getUserId(); 51 | String ptoken = checkOut.getPtoken(); 52 | if (PtokenDao.getPtoken(userid, ptoken)) { 53 | PtokenDao.detelePtoken(userid); 54 | UserStateDao.deteleUser(userid); 55 | UrlDao.deteleTicket(userid); 56 | session.removeAttribute("login"); 57 | String url = "http://127.0.0.1:8080/user/logout"; 58 | return "redirect:" + url; 59 | } else { 60 | return "error"; 61 | } 62 | } 63 | 64 | 65 | @RequestMapping(value="/1") 66 | public String page1(){ 67 | return "1"; 68 | } 69 | @RequestMapping(value="/2") 70 | public String page2(){ 71 | return "2"; 72 | } 73 | @RequestMapping(value="/3") 74 | public String page3(){ 75 | return "3"; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /marmot-sso-child/src/main/resources/app.properties: -------------------------------------------------------------------------------- 1 | appid=16 2 | -------------------------------------------------------------------------------- /marmot-sso-child/src/main/resources/c3p0.properties: -------------------------------------------------------------------------------- 1 | c3p0.driverClass=com.mysql.jdbc.Driver 2 | c3p0.jdbcUrl=jdbc:mysql://127.0.0.1:3306/sso?useUnicode=true&characterEncoding=UTF8 3 | c3p0.user=root 4 | c3p0.password= 5 | c3p0.minPoolSize=10 6 | c3p0.maxPoolSize=30 7 | c3p0.autoCommitOnClose=false 8 | c3p0.checkoutTimeout=1000 9 | c3p0.acquireRetryAttempts=2 10 | -------------------------------------------------------------------------------- /marmot-sso-child/src/main/resources/hibernate/hibernate.cfg.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | org.hibernate.dialect.MySQLDialect 10 | 11 | 12 | true 13 | 14 | 15 | true 16 | 17 | 18 | 20 | 21 | -------------------------------------------------------------------------------- /marmot-sso-child/src/main/resources/spring/spring-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 56 | 57 | -------------------------------------------------------------------------------- /marmot-sso-child/src/main/resources/spring/spring-mvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /marmot-sso-child/src/main/resources/spring/spring-service.xml: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /marmot-sso-child/src/main/webapp/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /marmot-sso-child/src/main/webapp/WEB-INF/jsp/1.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <% 3 | String path = request.getContextPath(); 4 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 5 | %> 6 | 7 | 8 | 9 | 10 | 11 | 12 | 子系统页面1 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 26 |
27 |

子系统页面1

28 | 可浏览界面 29 |
30 | 31 | 32 | -------------------------------------------------------------------------------- /marmot-sso-child/src/main/webapp/WEB-INF/jsp/2.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <% 3 | String path = request.getContextPath(); 4 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 5 | %> 6 | 7 | 8 | 9 | 10 | 11 | 12 | 子系统页面2 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 26 |
27 |

子系统页面2

28 | 可浏览界面 29 |
30 | 31 | 32 | -------------------------------------------------------------------------------- /marmot-sso-child/src/main/webapp/WEB-INF/jsp/error.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <% 3 | String path = request.getContextPath(); 4 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 5 | %> 6 | 7 | 8 | 9 | 10 | 11 | 12 | My JSP 'error.jsp' starting page 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 26 |
session不存在
27 | 28 | 29 | -------------------------------------------------------------------------------- /marmot-sso-child/src/main/webapp/WEB-INF/jsp/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <% 3 | String path = request.getContextPath(); 4 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 5 | %> 6 | 7 | 8 | 9 | 10 | 11 | 12 | 子系统信息展示页面 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 |
31 |
32 | 59 | 60 | 61 | 62 | 65 | 68 | 71 | 72 | 73 | 74 | 75 | 78 | 81 | 84 | 85 | 86 | 89 | 92 | 95 | 96 | 97 |
63 | 编号 64 | 66 | 连接 67 | 69 | 可点击的连接 70 |
76 | 1 77 | 79 | user/1 80 | 82 | 有权限的连接 83 |
87 | 2 88 | 90 | user/2 91 | 93 | 无权限的连接 94 |
98 |
99 |
100 |
101 | 102 | 103 | -------------------------------------------------------------------------------- /marmot-sso-child/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | SSO-child 4 | 5 | SSO-child 6 | org.springframework.web.servlet.DispatcherServlet 7 | 8 | contextConfigLocation 9 | classpath:spring/spring-mvc.xml 10 | 11 | 1 12 | 13 | 14 | SSO-child 15 | / 16 | 17 | -------------------------------------------------------------------------------- /marmot-sso-child/src/main/webapp/images/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso-child/src/main/webapp/images/1.jpg -------------------------------------------------------------------------------- /marmot-sso-child/src/test/java/com/sohu/test/Demo1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.test; 5 | 6 | import java.util.ResourceBundle; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.test.context.ContextConfiguration; 12 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 13 | 14 | import com.sso.dao.redis.UrlDao; 15 | 16 | /** 17 | *

18 | * Description: 19 | *

20 | * 21 | * @author wenbozhang 22 | * @version 1.0 23 | * @Date 2016年2月25日下午2:45:27 24 | */ 25 | @RunWith(SpringJUnit4ClassRunner.class) 26 | @ContextConfiguration(locations = {"classpath:spring/spring-dao.xml"}) 27 | public class Demo1 { 28 | @Autowired 29 | private UrlDao UrlDao; 30 | @Test 31 | public void test() { 32 | ResourceBundle resource = ResourceBundle.getBundle("app"); 33 | String appid = resource.getString("appid"); 34 | System.out.println(appid); 35 | } 36 | @Test 37 | public void UrlDaoTest(){ 38 | UrlDao.deteleTicket(4); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /marmot-sso-child/target/classes/app.properties: -------------------------------------------------------------------------------- 1 | appid=16 2 | -------------------------------------------------------------------------------- /marmot-sso-child/target/classes/c3p0.properties: -------------------------------------------------------------------------------- 1 | c3p0.driverClass=com.mysql.jdbc.Driver 2 | c3p0.jdbcUrl=jdbc:mysql://127.0.0.1:3306/sso?useUnicode=true&characterEncoding=UTF8 3 | c3p0.user=root 4 | c3p0.password= 5 | c3p0.minPoolSize=10 6 | c3p0.maxPoolSize=30 7 | c3p0.autoCommitOnClose=false 8 | c3p0.checkoutTimeout=1000 9 | c3p0.acquireRetryAttempts=2 10 | -------------------------------------------------------------------------------- /marmot-sso-child/target/classes/com/sohu/controller/UserController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso-child/target/classes/com/sohu/controller/UserController.class -------------------------------------------------------------------------------- /marmot-sso-child/target/classes/hibernate/hibernate.cfg.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | org.hibernate.dialect.MySQLDialect 10 | 11 | 12 | true 13 | 14 | 15 | true 16 | 17 | 18 | 20 | 21 | -------------------------------------------------------------------------------- /marmot-sso-child/target/classes/spring/spring-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 56 | 57 | -------------------------------------------------------------------------------- /marmot-sso-child/target/classes/spring/spring-mvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /marmot-sso-child/target/classes/spring/spring-service.xml: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /marmot-sso-child/target/m2e-jee/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Build-Jdk: 1.7.0_45 3 | Built-By: wenbozhang 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /marmot-sso-child/target/m2e-jee/web-resources/META-INF/maven/SSO-child/SSO-child/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Sun Mar 06 20:14:36 CST 2016 3 | version=0.0.1-SNAPSHOT 4 | groupId=SSO-child 5 | m2e.projectName=SSO-child 6 | m2e.projectLocation=E\:\\MyEclipseProject\\SSO-child 7 | artifactId=SSO-child 8 | -------------------------------------------------------------------------------- /marmot-sso-child/target/test-classes/com/sohu/test/Demo1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso-child/target/test-classes/com/sohu/test/Demo1.class -------------------------------------------------------------------------------- /marmot-sso-child/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/_1_jsp.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso-child/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/_1_jsp.class -------------------------------------------------------------------------------- /marmot-sso-child/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/_2_jsp.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso-child/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/_2_jsp.class -------------------------------------------------------------------------------- /marmot-sso-child/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/_3_jsp.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso-child/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/_3_jsp.class -------------------------------------------------------------------------------- /marmot-sso-child/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/index_jsp.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso-child/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/index_jsp.class -------------------------------------------------------------------------------- /marmot-sso/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /marmot-sso/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | SSO 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.common.project.facet.core.builder 20 | 21 | 22 | 23 | 24 | org.eclipse.wst.validation.validationbuilder 25 | 26 | 27 | 28 | 29 | com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator 30 | 31 | 32 | 33 | 34 | com.genuitec.eclipse.springframework.springbuilder 35 | 36 | 37 | 38 | 39 | org.eclipse.m2e.core.maven2Builder 40 | 41 | 42 | 43 | 44 | 45 | com.genuitec.eclipse.springframework.springnature 46 | org.eclipse.m2e.core.maven2Nature 47 | org.eclipse.jem.workbench.JavaEMFNature 48 | org.eclipse.wst.common.modulecore.ModuleCoreNature 49 | org.eclipse.wst.common.project.facet.core.nature 50 | org.eclipse.jdt.core.javanature 51 | org.eclipse.wst.jsdt.core.jsNature 52 | 53 | 54 | -------------------------------------------------------------------------------- /marmot-sso/.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /marmot-sso/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding//src/test/java=UTF-8 5 | encoding//src/test/resources=UTF-8 6 | encoding/=UTF-8 7 | -------------------------------------------------------------------------------- /marmot-sso/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.compliance=1.7 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 8 | org.eclipse.jdt.core.compiler.source=1.7 9 | -------------------------------------------------------------------------------- /marmot-sso/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /marmot-sso/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /marmot-sso/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /marmot-sso/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /marmot-sso/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /marmot-sso/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/controller/BaseController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.controller; 5 | 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | import javax.servlet.http.Cookie; 10 | import javax.servlet.http.HttpServletRequest; 11 | 12 | 13 | /** 14 | *

15 | * Description: 16 | *

17 | * @author wenbozhang 18 | * @version 1.0 19 | * @Date 2016年2月19日上午9:59:20 20 | */ 21 | public class BaseController { 22 | private static Map ReadCookieMap(HttpServletRequest request){ 23 | Map cookieMap = new HashMap(); 24 | Cookie[] cookies = request.getCookies(); 25 | if(null!=cookies){ 26 | for(Cookie cookie : cookies){ 27 | cookieMap.put(cookie.getName(), cookie); 28 | } 29 | } 30 | return cookieMap; 31 | } 32 | 33 | public static Cookie getCookieByName(HttpServletRequest request,String name){ 34 | Map cookieMap = ReadCookieMap(request); 35 | if(cookieMap.containsKey(name)){ 36 | Cookie cookie = cookieMap.get(name); 37 | return cookie; 38 | }else{ 39 | return null; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/dao/AppDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.dao; 5 | 6 | import java.util.List; 7 | 8 | import com.sohu.model.App; 9 | import com.sohu.model.Group; 10 | 11 | /** 12 | *

13 | * Description: 14 | *

15 | * @author wenbozhang 16 | * @version 1.0 17 | * @Date 2016年2月29日下午8:20:27 18 | */ 19 | public interface AppDao { 20 | 21 | void applyApp(App app); 22 | 23 | List getAppList(int state); 24 | 25 | void changeAppState(long appid,int state); 26 | 27 | App getAppById(long appid); 28 | 29 | void insertAppPage(long appid,String groupUrls); 30 | 31 | List getGroupByAppid(long appid); 32 | 33 | void deleteGroup(long groupid); 34 | 35 | int addUserRight(long[] groups,long userid,long appid); 36 | 37 | void deleteUserGroup(long groupid); 38 | } 39 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/dao/BaseDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.dao; 5 | 6 | import org.hibernate.Session; 7 | 8 | /** 9 | *

10 | * Description: 11 | *

12 | * @author wenbozhang 13 | * @version 1.0 14 | * @Date 2016年2月19日上午11:15:34 15 | */ 16 | public interface BaseDao { 17 | Session getSession(); 18 | } 19 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/dao/UserDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.dao; 5 | 6 | import java.util.List; 7 | 8 | import com.sohu.model.App; 9 | import com.sohu.model.Group; 10 | import com.sohu.model.User; 11 | import com.sohu.model.UserGroup; 12 | 13 | /** 14 | *

15 | * Description: 16 | *

17 | * @author wenbozhang 18 | * @version 1.0 19 | * @Date 2016年2月19日上午10:53:35 20 | */ 21 | public interface UserDao { 22 | User userLogin(User user); 23 | 24 | User getUserById(Long userid); 25 | 26 | App getAppById(Long appid); 27 | 28 | void updateUserState(long userid,int state); 29 | 30 | User findUserByName(String userName); 31 | 32 | void updateUser(User u); 33 | 34 | void updateUserAppid(long userid,long appid); 35 | 36 | List findUser(long appid,int state); 37 | 38 | 39 | List findGroupsById(long userid,long appid); 40 | 41 | Group getGroupById(long groupid); 42 | } 43 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/dao/impl/AppDaoImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.dao.impl; 5 | 6 | import java.util.List; 7 | 8 | import org.hibernate.Query; 9 | import org.hibernate.Session; 10 | import org.hibernate.Transaction; 11 | import org.springframework.stereotype.Repository; 12 | 13 | import com.sohu.dao.AppDao; 14 | import com.sohu.model.App; 15 | import com.sohu.model.Group; 16 | import com.sohu.model.UserGroup; 17 | 18 | /** 19 | *

20 | * Description: 21 | *

22 | * 23 | * @author wenbozhang 24 | * @version 1.0 25 | * @Date 2016年2月29日下午8:21:14 26 | */ 27 | @Repository 28 | public class AppDaoImpl extends BaseDaoImpl implements AppDao { 29 | @Override 30 | public void applyApp(App app) { 31 | Session session = null; 32 | try { 33 | session = getSession(); 34 | session.save(app); 35 | } finally { 36 | session.close(); 37 | } 38 | } 39 | 40 | @Override 41 | public List getAppList(int state) { 42 | Session session = null; 43 | String hql =null; 44 | Query query = null; 45 | try { 46 | session = getSession(); 47 | if(10==state){ 48 | hql="from App"; 49 | query=session.createQuery(hql); 50 | }else{ 51 | hql="from App a where a.appState=:state"; 52 | query=session.createQuery(hql).setInteger("state",state); 53 | } 54 | List list = query.list(); 55 | return list; 56 | } finally { 57 | session.close(); 58 | } 59 | } 60 | 61 | @Override 62 | public void changeAppState(long appid, int state) { 63 | Session session = null; 64 | try { 65 | session = getSession(); 66 | String hql = "UPDATE App a SET a.appState=:state WHERE a.appId=:id"; 67 | Query queryupdate = session.createQuery(hql).setLong("id", appid).setInteger("state", state); 68 | queryupdate.executeUpdate(); 69 | } finally { 70 | session.close(); 71 | } 72 | } 73 | 74 | @Override 75 | public App getAppById(long appid) { 76 | Session session = getSession(); 77 | App app = (App) session.get(App.class, appid); 78 | if (app == null) { 79 | return null; 80 | } 81 | session.close(); 82 | return app; 83 | } 84 | 85 | @Override 86 | public void insertAppPage(long appid, String groupUrls) { 87 | Session session = getSession(); 88 | Group group = new Group(groupUrls, appid); 89 | session.save(group); 90 | session.close(); 91 | } 92 | 93 | @Override 94 | public List getGroupByAppid(long appid) { 95 | Session session = getSession(); 96 | String hql="from Group g where g.appId=:id"; 97 | Query query = session.createQuery(hql).setLong("id",appid); 98 | List list = query.list(); 99 | return list; 100 | } 101 | 102 | @Override 103 | public void deleteGroup(long groupid) { 104 | Session session = null; 105 | try { 106 | session = getSession(); 107 | String hql = "delete Group where groupId=:id"; 108 | Query queryupdate = session.createQuery(hql).setLong("id", groupid); 109 | queryupdate.executeUpdate(); 110 | } finally { 111 | session.close(); 112 | } 113 | } 114 | 115 | @Override 116 | public int addUserRight(long[] groups, long userid,long appid) { 117 | Session session = getSession(); 118 | Transaction tx = session.beginTransaction(); 119 | try { 120 | for (long groupid : groups) { 121 | UserGroup UserGroup=new UserGroup(userid,groupid,appid); 122 | session.save(UserGroup); 123 | } 124 | return 2; 125 | }catch(Exception e){ 126 | return 1; 127 | }finally{ 128 | tx.commit(); 129 | session.close(); 130 | } 131 | } 132 | 133 | @Override 134 | public void deleteUserGroup(long groupid) { 135 | Session session = null; 136 | try { 137 | session = getSession(); 138 | String hql = "delete UserGroup where groupId=:id"; 139 | Query queryupdate = session.createQuery(hql).setLong("id", groupid); 140 | queryupdate.executeUpdate(); 141 | } finally { 142 | session.close(); 143 | } 144 | } 145 | 146 | } 147 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/dao/impl/BaseDaoImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.dao.impl; 5 | 6 | import org.hibernate.Session; 7 | import org.hibernate.SessionFactory; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Repository; 10 | 11 | import com.sohu.dao.BaseDao; 12 | 13 | /** 14 | *

15 | * Description: 16 | *

17 | * @author wenbozhang 18 | * @version 1.0 19 | * @Date 2016年2月19日上午11:15:49 20 | */ 21 | @Repository 22 | public class BaseDaoImpl implements BaseDao{ 23 | 24 | @Autowired 25 | private SessionFactory sessionfactory; 26 | 27 | @Override 28 | public Session getSession() { 29 | return sessionfactory.openSession(); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/dao/redis/JedisPoolFactory.java: -------------------------------------------------------------------------------- 1 | package com.sohu.dao.redis; 2 | 3 | import java.util.ResourceBundle; 4 | 5 | import org.apache.commons.pool2.impl.GenericObjectPoolConfig; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.stereotype.Repository; 9 | 10 | import redis.clients.jedis.JedisPool; 11 | @Repository 12 | public class JedisPoolFactory { 13 | 14 | private final static Logger logger = LoggerFactory.getLogger(JedisPoolFactory.class); 15 | 16 | private static String REDIS_HOST; 17 | private static int REDIS_PORT; 18 | private static int JEDIS_POOL_TIME_OUT; 19 | 20 | /** 21 | * 加载JedisPool-Conf.properties配置文件中的信息 22 | */ 23 | static { 24 | ResourceBundle resourceBundle = ResourceBundle.getBundle("JedisPool-Conf"); 25 | REDIS_HOST = resourceBundle.getString("redis.host"); 26 | REDIS_PORT = Integer.valueOf(resourceBundle.getString("redis.port")); 27 | JEDIS_POOL_TIME_OUT = Integer.valueOf(resourceBundle.getString("jedis.pooltimeout")); 28 | } 29 | 30 | /** 31 | * 静态工厂方法创建JedisPool 32 | * @return 33 | */ 34 | public static JedisPool getStaticJedisPool() { 35 | JedisPool jedisPool = null; 36 | GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig(); 37 | poolConfig.setMaxTotal(GenericObjectPoolConfig.DEFAULT_MAX_TOTAL * 5); 38 | poolConfig.setMaxIdle(GenericObjectPoolConfig.DEFAULT_MAX_IDLE * 3); 39 | poolConfig.setMinIdle(GenericObjectPoolConfig.DEFAULT_MIN_IDLE * 2); 40 | poolConfig.setJmxEnabled(true); 41 | poolConfig.setMaxWaitMillis(3000); 42 | jedisPool = new JedisPool(poolConfig, REDIS_HOST, REDIS_PORT, JEDIS_POOL_TIME_OUT); 43 | logger.info("jedisPool={}",jedisPool); 44 | return jedisPool; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/dao/redis/PtokenDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.dao.redis; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | import java.util.Set; 9 | 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Repository; 12 | 13 | import redis.clients.jedis.Jedis; 14 | 15 | /** 16 | *

17 | * Description: 18 | *

19 | * @author wenbozhang 20 | * @version 1.0 21 | * @Date 2016年2月25日上午11:34:15 22 | */ 23 | @Repository 24 | public class PtokenDao { 25 | @Autowired 26 | private JedisPoolFactory jedisPool; 27 | 28 | public void setPtoken(long userid, String ptoken) { 29 | Jedis jedis = null; 30 | try { 31 | String key = "user:ptoken:" + userid; 32 | jedis = JedisPoolFactory.getStaticJedisPool().getResource(); 33 | jedis.sadd(key, ptoken); 34 | } finally { 35 | jedis.close(); 36 | } 37 | 38 | } 39 | 40 | public boolean getPtoken(long userid,String ptoken) { 41 | Jedis jedis = null; 42 | try { 43 | String key = "user:ptoken:" + userid; 44 | jedis = JedisPoolFactory.getStaticJedisPool().getResource(); 45 | Set set=jedis.smembers(key); 46 | if(set.size()==0){ 47 | return false; 48 | } 49 | List list=new ArrayList(); 50 | list.addAll(set); 51 | for (String s : list) { 52 | if(s.equals(ptoken)){ 53 | return true; 54 | } 55 | } 56 | return false; 57 | } finally { 58 | jedis.close(); 59 | } 60 | } 61 | 62 | public void detelePtoken(String userid){ 63 | Jedis jedis = null; 64 | try { 65 | String key = "user:ptoken:" + userid; 66 | jedis = JedisPoolFactory.getStaticJedisPool().getResource(); 67 | jedis.del(key); 68 | } finally { 69 | jedis.close(); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/dao/redis/TicketDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.dao.redis; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Repository; 8 | 9 | import redis.clients.jedis.Jedis; 10 | 11 | /** 12 | *

13 | * Description: 14 | *

15 | * 16 | * @author wenbozhang 17 | * @version 1.0 18 | * @Date 2016年2月25日上午10:50:27 19 | */ 20 | @Repository 21 | public class TicketDao { 22 | @Autowired 23 | private JedisPoolFactory jedisPool; 24 | 25 | public void setTicket(long userid, String ticket) { 26 | Jedis jedis = null; 27 | try { 28 | String key = "user:ticket:" + userid; 29 | jedis = JedisPoolFactory.getStaticJedisPool().getResource(); 30 | int timeout = 60 * 2; 31 | jedis.setex(key, timeout,ticket); 32 | } finally { 33 | jedis.close(); 34 | } 35 | 36 | } 37 | 38 | public boolean getTicket(long userid,String ticket) { 39 | Jedis jedis = null; 40 | try { 41 | String key = "user:ticket:" + userid; 42 | jedis = JedisPoolFactory.getStaticJedisPool().getResource(); 43 | String JedisTicket=jedis.get(key); 44 | if(ticket.equals(JedisTicket)){ 45 | return true; 46 | }else{ 47 | return false; 48 | } 49 | } finally { 50 | jedis.close(); 51 | } 52 | } 53 | 54 | public void deteleTicket(long userid){ 55 | Jedis jedis = null; 56 | try { 57 | String key = "user:ticket:" + userid; 58 | jedis = JedisPoolFactory.getStaticJedisPool().getResource(); 59 | jedis.del(key); 60 | } finally { 61 | jedis.close(); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/dao/redis/UrlDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.dao.redis; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Repository; 8 | 9 | import redis.clients.jedis.Jedis; 10 | 11 | /** 12 | *

13 | * Description: 14 | *

15 | * @author wenbozhang 16 | * @version 1.0 17 | * @Date 2016年3月2日下午5:14:22 18 | */ 19 | @Repository 20 | public class UrlDao { 21 | @Autowired 22 | private JedisPoolFactory jedisPool; 23 | 24 | public void setUrl(long userid, String[] url) { 25 | Jedis jedis = null; 26 | try { 27 | String key = "user:url:"+ userid; 28 | jedis = JedisPoolFactory.getStaticJedisPool().getResource(); 29 | jedis.sadd(key, url); 30 | } finally { 31 | jedis.close(); 32 | } 33 | 34 | } 35 | 36 | 37 | public boolean getUrl(long userid,String url) { 38 | Jedis jedis = null; 39 | try { 40 | String key = "user:url:"+ userid; 41 | jedis = JedisPoolFactory.getStaticJedisPool().getResource(); 42 | return jedis.sismember(key, url); 43 | } finally { 44 | jedis.close(); 45 | } 46 | } 47 | 48 | public void deteleTicket(long userid){ 49 | Jedis jedis = null; 50 | try { 51 | String key = "user:url:"+ userid; 52 | jedis = JedisPoolFactory.getStaticJedisPool().getResource(); 53 | jedis.del(key); 54 | } finally { 55 | jedis.close(); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/dao/redis/UserStateDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.dao.redis; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Repository; 8 | 9 | import redis.clients.jedis.Jedis; 10 | 11 | /** 12 | *

13 | * Description: 14 | *

15 | * @author wenbozhang 16 | * @version 1.0 17 | * @Date 2016年2月25日上午11:26:45 18 | */ 19 | @Repository 20 | public class UserStateDao { 21 | @Autowired 22 | private JedisPoolFactory jedisPool; 23 | 24 | public void setUser(long userid) { 25 | Jedis jedis = null; 26 | try { 27 | String key = "user:state:" + userid; 28 | jedis = JedisPoolFactory.getStaticJedisPool().getResource(); 29 | jedis.setnx(key, "1"); 30 | } finally { 31 | jedis.close(); 32 | } 33 | 34 | } 35 | 36 | public boolean getUser(long userid) { 37 | Jedis jedis = null; 38 | try { 39 | String key = "user:state:" + userid; 40 | jedis = JedisPoolFactory.getStaticJedisPool().getResource(); 41 | String state=jedis.get(key); 42 | if("".equals(state)||state==null){ 43 | return false; 44 | }else{ 45 | return true; 46 | } 47 | } finally { 48 | jedis.close(); 49 | } 50 | } 51 | 52 | public void deteleUser(String userid){ 53 | Jedis jedis = null; 54 | try { 55 | String key = "user:state:" + userid; 56 | jedis = JedisPoolFactory.getStaticJedisPool().getResource(); 57 | jedis.del(key); 58 | } finally { 59 | jedis.close(); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/dto/AppEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.dto; 5 | /** 6 | *

7 | * Description: 8 | *

9 | * @author wenbozhang 10 | * @version 1.0 11 | * @Date 2016年3月2日上午10:55:02 12 | */ 13 | public enum AppEnum { 14 | NOUSER(0,"没有找到用户"), 15 | DATAERROR(1,"添加数据异常"), 16 | SUCCESS(2,"批量操作成功"); 17 | 18 | private int state; 19 | private String info; 20 | 21 | public int getState() { 22 | return state; 23 | } 24 | 25 | public void setState(int state) { 26 | this.state = state; 27 | } 28 | 29 | public String getInfo() { 30 | return info; 31 | } 32 | 33 | public void setInfo(String info) { 34 | this.info = info; 35 | } 36 | 37 | 38 | AppEnum(int state,String s){ 39 | this.state=state; 40 | this.info=s; 41 | } 42 | 43 | public static AppEnum getState(int index){ 44 | for(AppEnum appEnum:values()){ 45 | if(appEnum.getState()==index){ 46 | return appEnum; 47 | } 48 | } 49 | return null; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/dto/CheckOut.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.dto; 5 | /** 6 | *

7 | * Description:用于进行子系统的校验,以及注销校验 8 | *

9 | * @author wenbozhang 10 | * @version 1.0 11 | * @Date 2016年2月19日上午10:58:53 12 | */ 13 | public class CheckOut { 14 | private Long userId; //用于表示唯一用户 15 | private String ticket; //用于登录验证的票据 16 | private String ptoken; //用于注销验证的票据 17 | /** 18 | * 代表登录当前系统用户的类型 1:普通用户 2 管理员 3 开发者 4 SSO超管 19 | */ 20 | private int userState; 21 | 22 | 23 | public int getUserState() { 24 | return userState; 25 | } 26 | public void setUserState(int userState) { 27 | this.userState = userState; 28 | } 29 | public Long getUserId() { 30 | return userId; 31 | } 32 | public void setUserId(Long userId) { 33 | this.userId = userId; 34 | } 35 | public String getTicket() { 36 | return ticket; 37 | } 38 | public void setTicket(String ticket) { 39 | this.ticket = ticket; 40 | } 41 | public String getPtoken() { 42 | return ptoken; 43 | } 44 | public void setPtoken(String ptoken) { 45 | this.ptoken = ptoken; 46 | } 47 | public CheckOut(){}; 48 | public CheckOut(Long userId, String ticket, String ptoken) { 49 | this.userId = userId; 50 | this.ticket = ticket; 51 | this.ptoken = ptoken; 52 | } 53 | @Override 54 | public String toString() { 55 | return "CheckOut [userId=" + userId + ", ticket=" + ticket + ", ptoken=" + ptoken + "]"; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/dto/IntercepData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.dto; 5 | 6 | 7 | 8 | /** 9 | *

10 | * Description: 11 | *

12 | * @author wenbozhang 13 | * @version 1.0 14 | * @Date 2016年3月2日下午12:11:24 15 | */ 16 | public class IntercepData { 17 | private CheckOut checkOut; 18 | private String[] urls; 19 | 20 | public CheckOut getCheckOut() { 21 | return checkOut; 22 | } 23 | public void setCheckOut(CheckOut checkOut) { 24 | this.checkOut = checkOut; 25 | } 26 | 27 | public String[] getUrls() { 28 | return urls; 29 | } 30 | public void setUrls(String[] urls) { 31 | this.urls = urls; 32 | } 33 | 34 | public IntercepData(CheckOut checkOut, String[] urls) { 35 | super(); 36 | this.checkOut = checkOut; 37 | this.urls = urls; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/dto/JsonDto.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @Title: JsonDto.java 3 | * @Package com.sohu.dto 4 | * @Description: (用一句话描述该文件做什么) 5 | * @author wenbozhang 6 | * @date 2016年1月28日 下午3:25:43 7 | * @version V1.0 8 | */ 9 | /* 10 | * Copyright (c) 2016 Sohu TV. All rights reserved. 11 | */ 12 | package com.sohu.dto; 13 | /** 14 | * @ClassName: JsonDto 15 | * @Description: 用于前后台传输json的工具类 16 | * @author wenbozhang 17 | * @date 2016年1月28日 下午3:25:43 18 | * 19 | */ 20 | public class JsonDto { 21 | private boolean isSuccess; 22 | private String info; 23 | private T data; 24 | 25 | public void setIsSuccess(boolean isSuccess){ 26 | this.isSuccess=isSuccess; 27 | } 28 | public boolean getIsSuccess(){ 29 | return isSuccess; 30 | } 31 | public String getInfo() { 32 | return info; 33 | } 34 | public void setInfo(String info) { 35 | this.info = info; 36 | } 37 | public T getData() { 38 | return data; 39 | } 40 | public void setData(T data) { 41 | this.data = data; 42 | } 43 | 44 | public JsonDto(boolean isSuccess, String info) { 45 | super(); 46 | this.isSuccess = isSuccess; 47 | this.info = info; 48 | } 49 | 50 | public JsonDto(boolean isSuccess, T data) { 51 | super(); 52 | this.isSuccess = isSuccess; 53 | this.data = data; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/interceptor/Interceptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.interceptor; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | 9 | import org.slf4j.Logger; 10 | import org.slf4j.LoggerFactory; 11 | import org.springframework.web.servlet.HandlerInterceptor; 12 | import org.springframework.web.servlet.ModelAndView; 13 | 14 | /** 15 | *

16 | * Description: 17 | *

18 | * 19 | * @author wenbozhang 20 | * @version 1.0 21 | * @Date 2016年2月19日上午10:14:07 22 | */ 23 | public class Interceptor implements HandlerInterceptor { 24 | private final Logger logger = LoggerFactory.getLogger(Interceptor.class); 25 | 26 | @Override 27 | /** 28 | * preHandle方法是进行处理器拦截用的,顾名思义,该方法将在Controller处理之前进行调用,SpringMVC中的Interceptor拦截器是链式的 29 | * 回值为false,当preHandle的返回值为false的时候整个请求就结束了 30 | */ 31 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 32 | return true; 33 | } 34 | 35 | /** 36 | * postHandle是进行处理器拦截用的,它的执行时间是在处理器进行处理之后, 37 | * 也就是在Controller的方法调用之后执行,但是它会在DispatcherServlet进行视图的渲染之前执行 38 | * ,也就是说在这个方法中你可以对ModelAndView进行操 39 | */ 40 | @Override 41 | public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, 42 | ModelAndView modelAndView) throws Exception { 43 | } 44 | 45 | @Override 46 | public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) 47 | throws Exception {// 关闭资源 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/model/App.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.model; 5 | 6 | import java.util.Date; 7 | 8 | import javax.persistence.Column; 9 | import javax.persistence.Entity; 10 | import javax.persistence.GeneratedValue; 11 | import javax.persistence.GenerationType; 12 | import javax.persistence.Id; 13 | import javax.persistence.Table; 14 | import javax.persistence.Temporal; 15 | import javax.persistence.TemporalType; 16 | 17 | /** 18 | *

19 | * Description: 20 | *

21 | * @author wenbozhang 22 | * @version 1.0 23 | * @Date 2016年2月19日上午10:41:26 24 | */ 25 | @Entity 26 | @Table(name="tb_app") 27 | public class App { 28 | 29 | @Id 30 | @Column(name="app_id") 31 | @GeneratedValue(strategy = GenerationType.IDENTITY) 32 | private Long appId; 33 | 34 | @Column(name="app_name") 35 | private String appName; 36 | 37 | @Column(name="app_info") 38 | private String appInfo; 39 | 40 | @Column(name="app_phone") 41 | private String appPhone; 42 | 43 | @Column(name="app_state") 44 | private int appState; 45 | 46 | @Column(name="create_time") 47 | @Temporal(TemporalType.TIMESTAMP) 48 | private Date createTime; 49 | 50 | @Column(name="modify_time") 51 | @Temporal(TemporalType.TIMESTAMP) 52 | private Date modifyTime; 53 | 54 | @Column(name="owner_id") 55 | private Long ownerId; 56 | 57 | public Long getOwnerId() { 58 | return ownerId; 59 | } 60 | 61 | public void setOwnerId(long ownerId) { 62 | this.ownerId = ownerId; 63 | } 64 | 65 | public int getAppState() { 66 | return appState; 67 | } 68 | 69 | public void setAppState(int appState) { 70 | this.appState = appState; 71 | } 72 | 73 | public String getAppPhone() { 74 | return appPhone; 75 | } 76 | 77 | public void setAppPhone(String appPhone) { 78 | this.appPhone = appPhone; 79 | } 80 | 81 | public Long getAppId() { 82 | return appId; 83 | } 84 | 85 | public void setAppId(Long appId) { 86 | this.appId = appId; 87 | } 88 | 89 | public String getAppName() { 90 | return appName; 91 | } 92 | 93 | public void setAppName(String appName) { 94 | this.appName = appName; 95 | } 96 | 97 | 98 | public String getAppInfo() { 99 | return appInfo; 100 | } 101 | 102 | public void setAppInfo(String appInfo) { 103 | this.appInfo = appInfo; 104 | } 105 | 106 | public Date getCreateTime() { 107 | return createTime; 108 | } 109 | 110 | public void setCreateTime(Date createTime) { 111 | this.createTime = createTime; 112 | } 113 | 114 | public Date getModifyTime() { 115 | return modifyTime; 116 | } 117 | 118 | public void setModifyTime(Date modifyTime) { 119 | this.modifyTime = modifyTime; 120 | } 121 | 122 | @Override 123 | public String toString() { 124 | return "App [appId=" + appId + ", appName=" + appName + ", appInfo=" + appInfo + ", appPhone=" + appPhone 125 | + ", appState=" + appState + ", createTime=" + createTime + ", modifyTime=" + modifyTime + "]"; 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/model/Group.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.model; 5 | 6 | import javax.persistence.Column; 7 | import javax.persistence.Entity; 8 | import javax.persistence.GeneratedValue; 9 | import javax.persistence.GenerationType; 10 | import javax.persistence.Id; 11 | import javax.persistence.Table; 12 | 13 | /** 14 | *

15 | * Description: 16 | *

17 | * 18 | * @author wenbozhang 19 | * @version 1.0 20 | * @Date 2016年3月1日下午5:55:49 21 | */ 22 | @Entity 23 | @Table(name="tb_group") 24 | public class Group { 25 | 26 | @Id 27 | @Column(name = "group_id") 28 | @GeneratedValue(strategy = GenerationType.IDENTITY) 29 | private long groupId; 30 | 31 | @Column(name="group_url") 32 | private String groupUrl; 33 | 34 | @Column(name="app_id") 35 | private long appId; 36 | 37 | 38 | public long getGroupId() { 39 | return groupId; 40 | } 41 | 42 | public void setGroupId(long groupId) { 43 | this.groupId = groupId; 44 | } 45 | 46 | 47 | public String getGroupUrl() { 48 | return groupUrl; 49 | } 50 | 51 | public void setGroupUrl(String groupUrl) { 52 | this.groupUrl = groupUrl; 53 | } 54 | 55 | public long getAppId() { 56 | return appId; 57 | } 58 | 59 | public void setAppId(long appId) { 60 | this.appId = appId; 61 | } 62 | public Group(){} 63 | public Group( String groupUrl, long appId) { 64 | super(); 65 | this.groupUrl = groupUrl; 66 | this.appId = appId; 67 | } 68 | 69 | @Override 70 | public String toString() { 71 | return "Group [groupId=" + groupId + ", groupUrl=" + groupUrl + ", appId=" + appId + "]"; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/model/Url.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.model; 5 | 6 | import javax.persistence.Column; 7 | import javax.persistence.Entity; 8 | import javax.persistence.GeneratedValue; 9 | import javax.persistence.GenerationType; 10 | import javax.persistence.Id; 11 | import javax.persistence.Table; 12 | 13 | /** 14 | *

15 | * Description: 16 | *

17 | * @author wenbozhang 18 | * @version 1.0 19 | * @Date 2016年2月25日下午11:15:07 20 | */ 21 | @Entity 22 | @Table(name="tb_url") 23 | public class Url { 24 | @Id 25 | @Column(name="url_id") 26 | @GeneratedValue(strategy = GenerationType.IDENTITY) 27 | private long urlId; 28 | 29 | 30 | 31 | @Column(name="url_group") 32 | private long urlGroup; 33 | 34 | @Column(name="url_content") 35 | private String urlContent; 36 | 37 | public long getUrlId() { 38 | return urlId; 39 | } 40 | 41 | public void setUrlId(long urlId) { 42 | this.urlId = urlId; 43 | } 44 | 45 | public long getUrlGroup() { 46 | return urlGroup; 47 | } 48 | 49 | public void setUrlGroup(long urlGroup) { 50 | this.urlGroup = urlGroup; 51 | } 52 | 53 | public String getUrlContent() { 54 | return urlContent; 55 | } 56 | 57 | public void setUrlContent(String urlContent) { 58 | this.urlContent = urlContent; 59 | } 60 | 61 | @Override 62 | public String toString() { 63 | return "Url [urlId=" + urlId + ", urlGroup=" + urlGroup + ", urlContent=" + urlContent + "]"; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/model/User.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.model; 5 | 6 | import javax.persistence.Column; 7 | import javax.persistence.Entity; 8 | import javax.persistence.GeneratedValue; 9 | import javax.persistence.GenerationType; 10 | import javax.persistence.Id; 11 | import javax.persistence.Table; 12 | 13 | /** 14 | *

15 | * Description: 16 | *

17 | * @author wenbozhang 18 | * @version 1.0 19 | * @Date 2016年2月19日上午10:37:20 20 | */ 21 | @Entity 22 | @Table(name="tb_user") 23 | public class User { 24 | @Id 25 | @Column(name="user_id") 26 | @GeneratedValue(strategy = GenerationType.IDENTITY) 27 | private Long userId; 28 | 29 | @Column(name="user_name") 30 | private String userName; 31 | 32 | @Column(name="user_password") 33 | private String userPassword; 34 | 35 | @Column(name="user_state") 36 | private int userState; 37 | 38 | @Column(name="app_id") 39 | private long appId; 40 | 41 | 42 | public long getAppId() { 43 | return appId; 44 | } 45 | public void setAppId(long appId) { 46 | this.appId = appId; 47 | } 48 | public int getUserState() { 49 | return userState; 50 | } 51 | public void setUserState(int userState) { 52 | this.userState = userState; 53 | } 54 | public Long getUserId() { 55 | return userId; 56 | } 57 | public void setUserId(Long userId) { 58 | this.userId = userId; 59 | } 60 | public String getUserName() { 61 | return userName; 62 | } 63 | public void setUserName(String userName) { 64 | this.userName = userName; 65 | } 66 | public String getUserPassword() { 67 | return userPassword; 68 | } 69 | public void setUserPassword(String userPassword) { 70 | this.userPassword = userPassword; 71 | } 72 | @Override 73 | public String toString() { 74 | return "User [userId=" + userId + ", userName=" + userName + ", userPassword=" + userPassword + ", userState=" 75 | + userState + "]"; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/model/UserGroup.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.model; 5 | 6 | import javax.persistence.Column; 7 | import javax.persistence.Entity; 8 | import javax.persistence.GeneratedValue; 9 | import javax.persistence.GenerationType; 10 | import javax.persistence.Id; 11 | import javax.persistence.Table; 12 | 13 | /** 14 | *

15 | * Description: 16 | *

17 | * @author wenbozhang 18 | * @version 1.0 19 | * @Date 2016年3月1日下午8:00:32 20 | */ 21 | @Entity 22 | @Table(name="user_group") 23 | public class UserGroup { 24 | @Id 25 | @Column(name="id") 26 | @GeneratedValue(strategy = GenerationType.IDENTITY) 27 | private long id; 28 | 29 | @Column(name="user_id") 30 | private long userId; 31 | 32 | @Column(name="group_id") 33 | private long groupId; 34 | 35 | @Column(name="app_id") 36 | private long appId; 37 | 38 | public long getAppId() { 39 | return appId; 40 | } 41 | 42 | public void setAppId(long appId) { 43 | this.appId = appId; 44 | } 45 | 46 | public long getId() { 47 | return id; 48 | } 49 | 50 | public void setId(long id) { 51 | this.id = id; 52 | } 53 | 54 | public long getUserId() { 55 | return userId; 56 | } 57 | 58 | public void setUserId(long userId) { 59 | this.userId = userId; 60 | } 61 | 62 | public long getGroupId() { 63 | return groupId; 64 | } 65 | 66 | public void setGroupId(long groupId) { 67 | this.groupId = groupId; 68 | } 69 | public UserGroup(){} 70 | 71 | public UserGroup(long userId, long groupId, long appId) { 72 | super(); 73 | this.userId = userId; 74 | this.groupId = groupId; 75 | this.appId = appId; 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/service/AppService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.service; 5 | 6 | import java.util.List; 7 | 8 | import com.sohu.model.App; 9 | import com.sohu.model.Group; 10 | 11 | /** 12 | *

13 | * Description: 14 | *

15 | * @author wenbozhang 16 | * @version 1.0 17 | * @Date 2016年2月29日下午8:06:13 18 | */ 19 | public interface AppService { 20 | /** 21 | * 22 | * @Title: applyApp 23 | * @Description: (完成app的申请,默认申请者是开发者,且app的默认状态是未审批) 24 | * @param @param app 25 | * @param @param userid 设定文件 26 | * @return void 返回类型 27 | * @throws 28 | */ 29 | void applyApp(App app,long userid); 30 | /** 31 | * 32 | * @Title: getAppList 33 | * @Description: (获取app列表,默认传10代表是全部app信息) 34 | * 0代表是没有审批的 1代表是审批过的 35 | * @param @return 设定文件 36 | * @return List 返回类型 37 | * @throws 38 | */ 39 | List getAppList(int state); 40 | /** 41 | * 42 | * @Title: changeAppState 43 | * @Description: (更新App的状态,同时会将app申请者的角色由用户,改为开发者) 44 | * @param @param appid 45 | * @param @param state 设定文件 46 | * @return void 返回类型 47 | * @throws 48 | */ 49 | void changeAppState(long appid,int state); 50 | /** 51 | * 52 | * @Title: findAppState 53 | * @Description: (查看App申请的结果) 54 | * @param @param userid 55 | * @param @return 设定文件 56 | * @return App 返回类型 57 | * @throws 58 | */ 59 | App findAppState(long userid); 60 | /** 61 | * 62 | * @Title: getGroupByAppid 63 | * @Description: (根据appid,返回group的列表) 64 | * @param @param appid 65 | * @param @return 设定文件 66 | * @return List 返回类型 67 | * @throws 68 | */ 69 | List getGroupByAppid(long appid); 70 | /** 71 | * 72 | * @Title: insertGroup 73 | * @Description: (这里用一句话描述这个方法的作用) 74 | * @param @param ugroupUrl 设定文件 75 | * @return void 返回类型 76 | * @throws 77 | */ 78 | void insertGroup(String groupUrl,long appid); 79 | /** 80 | * 81 | * @Title: deleteGroup 82 | * @Description: (删除某个子项目的页面) 83 | * @param @param groupid 设定文件 84 | * @return void 返回类型 85 | * @throws 86 | */ 87 | void deleteGroup(long groupid); 88 | 89 | /** 90 | * 91 | * @Title: insertAdmin 92 | * @Description: (插入项目管理员) 93 | * @param @param adminName 94 | * @param @param appid 95 | * @param @return 设定文件 96 | * @return boolean 返回类型 97 | * @throws 98 | */ 99 | boolean insertAdmin(String adminName,long appid); 100 | /** 101 | * 102 | * @Title: deleteAdmin 103 | * @Description: (删除项目对应的管理员) 104 | * @param @param userid 设定文件 105 | * @return void 返回类型 106 | * @throws 107 | */ 108 | void deleteAdmin(long userid); 109 | 110 | int addUserRight(long[] groups,String name,long appid); 111 | } 112 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/service/UserService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.service; 5 | 6 | import java.util.List; 7 | 8 | import com.sohu.dto.CheckOut; 9 | import com.sohu.model.App; 10 | import com.sohu.model.User; 11 | 12 | /** 13 | *

14 | * Description: 15 | *

16 | * @author wenbozhang 17 | * @version 1.0 18 | * @Date 2016年2月19日上午10:50:22 19 | */ 20 | public interface UserService { 21 | /** 22 | * 23 | * @Title: userLogin 24 | * @Description: (用户的账号密码登录) 25 | * @param @param user 26 | * @param @return 设定文件 27 | * @return User 返回类型 28 | * @throws 29 | */ 30 | User userLogin(User user); 31 | /** 32 | * 33 | * @Title: getUserById 34 | * @Description: (根据userid返回user) 35 | * @param @param userid 36 | * @param @return 设定文件 37 | * @return User 返回类型 38 | * @throws 39 | */ 40 | User getUserById(Long userid); 41 | /** 42 | * 43 | * @Title: getAppById 根据appid,获取app信息 44 | * @param @param appid 45 | * @param @return 设定文件 46 | * @return App 返回类型 47 | * @throws 48 | */ 49 | App getAppById(Long appid); 50 | /** 51 | * 52 | * @Title: getCheckOut 更加用户的id,生成ticket,ptoken 53 | * @param @param userid 54 | * @param @return 设定文件 55 | * @return CheckOut 返回类型 56 | * @throws 57 | */ 58 | CheckOut getCheckOut(long userid); 59 | /** 60 | * 61 | * @Title: findUserByName 62 | * @Description: (根据userName找User) 63 | * @param @param userName 64 | * @param @return 设定文件 65 | * @return User 返回类型 66 | * @throws 67 | */ 68 | User findUserByName(String userName); 69 | /** 70 | * 71 | * @Title: updateUser 72 | * @Description: (更新User对象) 73 | * @param @param u 设定文件 74 | * @return void 返回类型 75 | * @throws 76 | */ 77 | void updateUser(User u); 78 | /** 79 | * 80 | * @Title: findUser 81 | * @Description: (返回某个项目特定角色的用户) 82 | * 其实只有 开发者 和 管理员两种角色 83 | * @param @param appid 84 | * @param @param state 85 | * @param @return 设定文件 86 | * @return List 返回类型 87 | * @throws 88 | */ 89 | List findUser(long appid,int state); 90 | 91 | String[] findGroupsById(long userid,long appid); 92 | 93 | } 94 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/service/impl/AppServiceImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @Title: AppServiceImpl.java 3 | * @Package com.sohu.service.impl 4 | * @author wenbozhang 5 | * @date 2016年2月29日 下午8:06:23 6 | * @version V1.0 7 | */ 8 | /* 9 | * Copyright (c) 2016 Sohu TV. All rights reserved. 10 | */ 11 | package com.sohu.service.impl; 12 | 13 | import java.util.List; 14 | 15 | import org.springframework.beans.factory.annotation.Autowired; 16 | import org.springframework.stereotype.Service; 17 | import org.springframework.transaction.annotation.Transactional; 18 | 19 | import com.sohu.dao.AppDao; 20 | import com.sohu.dao.UserDao; 21 | import com.sohu.model.App; 22 | import com.sohu.model.Group; 23 | import com.sohu.model.User; 24 | import com.sohu.service.AppService; 25 | 26 | /** 27 | * @ClassName: AppServiceImpl 28 | * @author wenbozhang 29 | * @date 2016年2月29日 下午8:06:23 30 | * 31 | */ 32 | @Service 33 | public class AppServiceImpl implements AppService{ 34 | @Autowired 35 | private AppDao appDao; 36 | @Autowired 37 | private UserDao userDao; 38 | 39 | @Override 40 | @Transactional 41 | public void applyApp(App app, long userid) { 42 | appDao.applyApp(app); 43 | /* userDao.updateUserState(userid,3);*/ 44 | } 45 | 46 | @Override 47 | public List getAppList(int state) { 48 | return appDao.getAppList(state); 49 | } 50 | 51 | @Override 52 | public void changeAppState(long appid,int state) { 53 | appDao.changeAppState(appid, state); 54 | App app=appDao.getAppById(appid); 55 | if(state==1){//请过审批之后,申请的用户会变成开发者的角色 56 | long userid=app.getOwnerId(); 57 | userDao.updateUserState(userid, 3); 58 | userDao.updateUserAppid(userid, appid); 59 | } 60 | } 61 | 62 | @Override 63 | public App findAppState(long userid) { 64 | User user=userDao.getUserById(userid); 65 | App app=appDao.getAppById(user.getAppId()); 66 | return app; 67 | } 68 | 69 | @Override 70 | public List getGroupByAppid(long appid) { 71 | return appDao.getGroupByAppid(appid); 72 | } 73 | 74 | @Override 75 | public void insertGroup(String groupUrl, long appid) { 76 | appDao.insertAppPage(appid, groupUrl); 77 | } 78 | 79 | @Override 80 | @Transactional 81 | public void deleteGroup(long groupid) { 82 | appDao.deleteGroup(groupid); 83 | appDao.deleteUserGroup(groupid); 84 | } 85 | 86 | @Override 87 | public boolean insertAdmin(String adminName,long appid) { 88 | User admin=userDao.findUserByName(adminName); 89 | System.out.println("==admin=="+admin); 90 | if(admin!=null){ 91 | if(admin.getAppId()==0){ 92 | admin.setUserState(2); 93 | admin.setAppId(appid); 94 | userDao.updateUser(admin); 95 | return true; 96 | }else{ 97 | return false; 98 | } 99 | }else{ 100 | return false; 101 | } 102 | } 103 | 104 | @Override 105 | public void deleteAdmin(long userid) { 106 | User user=userDao.getUserById(userid); 107 | user.setUserState(1); 108 | user.setAppId(0); 109 | userDao.updateUser(user); 110 | } 111 | 112 | @Override 113 | public int addUserRight(long[] groups, String name,long appid) { 114 | User user=userDao.findUserByName(name); 115 | if(user==null){ 116 | return 1; 117 | } 118 | long userid=user.getUserId(); 119 | return appDao.addUserRight(groups, userid,appid); 120 | } 121 | 122 | } 123 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.sohu.service.impl; 2 | 3 | import java.util.Date; 4 | import java.util.List; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | import org.springframework.util.DigestUtils; 9 | 10 | import com.sohu.dao.UserDao; 11 | import com.sohu.dto.CheckOut; 12 | import com.sohu.model.App; 13 | import com.sohu.model.User; 14 | import com.sohu.model.UserGroup; 15 | import com.sohu.service.UserService; 16 | 17 | /* 18 | * Copyright (c) 2016 Sohu TV. All rights reserved. 19 | */ 20 | /** 21 | *

22 | * Description: 23 | *

24 | * @author wenbozhang 25 | * @version 1.0 26 | * @Date 2016年2月19日上午10:50:56 27 | */ 28 | @Service 29 | public class UserServiceImpl implements UserService { 30 | 31 | private static final String MD5_1 = "EWQ312312&*^7"; 32 | 33 | private static final String MD5_2= "EW12&*^7**^TN##1"; 34 | @Autowired 35 | private UserDao UserDao; 36 | 37 | 38 | @Override 39 | public User userLogin(User user) { 40 | User findUser=UserDao.userLogin(user); 41 | if(findUser==null) 42 | return null; 43 | return findUser; 44 | } 45 | 46 | public String get_Tiekct_Md5(long userid) { 47 | String md5 = userid + MD5_1+new Date(); 48 | return new String(DigestUtils.md5DigestAsHex(md5.getBytes())); 49 | } 50 | public String get_Ptoken_tMd5(long userid) { 51 | String md5 = userid + MD5_2+new Date(); 52 | return new String(DigestUtils.md5DigestAsHex(md5.getBytes())); 53 | } 54 | 55 | @Override 56 | public User getUserById(Long userid) { 57 | return UserDao.getUserById(userid); 58 | } 59 | 60 | @Override 61 | public App getAppById(Long appid) { 62 | return UserDao.getAppById(appid); 63 | } 64 | @Override 65 | public CheckOut getCheckOut(long userid) { 66 | CheckOut checkOut=new CheckOut(); 67 | int state=getUserById(userid).getUserState(); 68 | String ticket=get_Tiekct_Md5(userid); 69 | String ptoken=get_Ptoken_tMd5(userid); 70 | checkOut.setTicket(ticket); 71 | checkOut.setPtoken(ptoken); 72 | checkOut.setUserId(userid); 73 | checkOut.setUserState(state); 74 | return checkOut; 75 | } 76 | 77 | @Override 78 | public User findUserByName(String userName) { 79 | return UserDao.findUserByName(userName); 80 | } 81 | 82 | @Override 83 | public void updateUser(User u) { 84 | UserDao.updateUser(u); 85 | } 86 | 87 | @Override 88 | public List findUser(long appid, int state) { 89 | return UserDao.findUser(appid, state); 90 | } 91 | 92 | @Override 93 | public String[] findGroupsById(long userid,long appid) { 94 | List groups=UserDao.findGroupsById(userid,appid); 95 | int size=groups.size(); 96 | if(size==0){ 97 | return null; 98 | } 99 | String[] urls=new String[size]; 100 | for (int i = 0; i < groups.size(); i++) { 101 | long groupid=groups.get(i).getGroupId(); 102 | String url=UserDao.getGroupById(groupid).getGroupUrl(); 103 | urls[i]=url; 104 | } 105 | return urls; 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/util/HttpClientUtil.java: -------------------------------------------------------------------------------- 1 | package com.sohu.util; 2 | 3 | 4 | 5 | import java.net.URI; 6 | import java.util.ArrayList; 7 | import java.util.Iterator; 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | import org.apache.http.HttpEntity; 12 | import org.apache.http.HttpResponse; 13 | import org.apache.http.NameValuePair; 14 | import org.apache.http.client.HttpClient; 15 | import org.apache.http.client.entity.UrlEncodedFormEntity; 16 | import org.apache.http.client.methods.HttpGet; 17 | import org.apache.http.client.methods.HttpPost; 18 | import org.apache.http.impl.client.DefaultHttpClient; 19 | import org.apache.http.message.BasicNameValuePair; 20 | import org.apache.http.util.EntityUtils; 21 | import org.slf4j.Logger; 22 | import org.slf4j.LoggerFactory; 23 | 24 | public class HttpClientUtil { 25 | private final Logger logger = LoggerFactory.getLogger(HttpClientUtil.class); 26 | 27 | public String doPost(String url, Map map, String charset) { 28 | HttpClient httpClient = null; 29 | HttpPost httpPost = null; 30 | String result = null; 31 | try { 32 | httpClient = new DefaultHttpClient(); 33 | httpPost = new HttpPost(url); 34 | //设置参数 35 | List list = new ArrayList(); 36 | Iterator iterator = map.entrySet().iterator(); 37 | while (iterator.hasNext()) { 38 | Map.Entry elem = (Map.Entry) iterator.next(); 39 | list.add(new BasicNameValuePair(elem.getKey(), (String) elem.getValue())); 40 | } 41 | if (list.size() > 0) { 42 | UrlEncodedFormEntity entity = new UrlEncodedFormEntity(list, charset); 43 | httpPost.setEntity(entity); 44 | } 45 | HttpResponse response = httpClient.execute(httpPost); 46 | if (response != null) { 47 | HttpEntity resEntity = response.getEntity(); 48 | if (resEntity != null) { 49 | result = EntityUtils.toString(resEntity, charset); 50 | } 51 | } 52 | } catch (Exception e) { 53 | logger.error(e.getMessage()+" url="+url); 54 | }finally{ 55 | httpPost.releaseConnection(); 56 | } 57 | return result; 58 | } 59 | 60 | public String doGet(String url) { 61 | HttpGet httpGet = null; 62 | try { 63 | HttpClient httpClient = new DefaultHttpClient(); 64 | httpGet = new HttpGet(); 65 | httpGet.setURI(new URI(url)); 66 | HttpResponse reponse = httpClient.execute(httpGet); 67 | HttpEntity httpEntity = reponse.getEntity(); 68 | if (httpEntity == null) { 69 | logger.info("HttpClientUtil doGet 发生异常"); 70 | return null; 71 | } else { 72 | String value = EntityUtils.toString(httpEntity); 73 | return value; 74 | } 75 | } catch (Exception e) { 76 | logger.error(e.getMessage()+"url="+url); 77 | }finally{ 78 | httpGet.releaseConnection(); 79 | } 80 | return null; 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /marmot-sso/src/main/java/com/sohu/util/InterceptorUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.util; 5 | 6 | import java.util.ResourceBundle; 7 | 8 | import com.google.gson.Gson; 9 | 10 | 11 | 12 | /** 13 | *

14 | * Description: 15 | *

16 | * @author wenbozhang 17 | * @version 1.0 18 | * @Date 2016年2月19日上午9:59:20 19 | */ 20 | public class InterceptorUtil { 21 | public static String getaAppId(){ 22 | ResourceBundle resource = ResourceBundle.getBundle("app"); 23 | return resource.getString("appid"); 24 | } 25 | 26 | public static String toJson(Object t){ 27 | Gson gson=new Gson(); 28 | return gson.toJson(t); 29 | } 30 | 31 | public static Object toObject(String s,Class t){ 32 | Gson gson=new Gson(); 33 | return gson.fromJson(s,t); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /marmot-sso/src/main/resources/JedisPool-Conf.properties: -------------------------------------------------------------------------------- 1 | #单机 host 2 | redis.host=XXX 3 | #单机 port 4 | redis.port=6888 5 | #超时时间 毫秒 6 | jedis.pooltimeout=1000 -------------------------------------------------------------------------------- /marmot-sso/src/main/resources/app.properties: -------------------------------------------------------------------------------- 1 | c3p0.driverClass=com.mysql.jdbc.Driver 2 | c3p0.jdbcUrl=jdbc:mysql://127.0.0.1:3306/sso?useUnicode=true&characterEncoding=UTF8 3 | c3p0.user=root 4 | c3p0.password= 5 | c3p0.minPoolSize=10 6 | c3p0.maxPoolSize=30 7 | c3p0.autoCommitOnClose=false 8 | c3p0.checkoutTimeout=1000 9 | c3p0.acquireRetryAttempts=2 10 | -------------------------------------------------------------------------------- /marmot-sso/src/main/resources/c3p0.properties: -------------------------------------------------------------------------------- 1 | c3p0.driverClass=com.mysql.jdbc.Driver 2 | c3p0.jdbcUrl=jdbc:mysql://127.0.0.1:3306/sso?useUnicode=true&characterEncoding=UTF8 3 | c3p0.user=root 4 | c3p0.password= 5 | c3p0.minPoolSize=10 6 | c3p0.maxPoolSize=30 7 | c3p0.autoCommitOnClose=false 8 | c3p0.checkoutTimeout=1000 9 | c3p0.acquireRetryAttempts=2 10 | -------------------------------------------------------------------------------- /marmot-sso/src/main/resources/hibernate/hibernate.cfg.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | org.hibernate.dialect.MySQLDialect 10 | 11 | 12 | true 13 | 14 | 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /marmot-sso/src/main/resources/spring/spring-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 55 | -------------------------------------------------------------------------------- /marmot-sso/src/main/resources/spring/spring-mvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 34 | -------------------------------------------------------------------------------- /marmot-sso/src/main/resources/spring/spring-service.xml: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /marmot-sso/src/main/webapp/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /marmot-sso/src/main/webapp/WEB-INF/jsp/applogin.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <% 3 | String path = request.getContextPath(); 4 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 5 | %> 6 | 7 | 8 | 9 | 10 | 11 | 12 | 申请成为子应用登录 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |

App后台申请管理系统

34 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /marmot-sso/src/main/webapp/WEB-INF/jsp/error.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <% 3 | String path = request.getContextPath(); 4 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 5 | %> 6 | 7 | 8 | 9 | 10 | 11 | 12 | 页面出错了 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 26 |
27 |

注销失败

28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /marmot-sso/src/main/webapp/WEB-INF/jsp/login.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <% 3 | String path = request.getContextPath(); 4 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 5 | %> 6 | 7 | 8 | 9 | 10 | 11 | 12 | SSO登录接口 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 22 | 23 | 24 | 26 | 27 | 29 | 30 | 33 | 36 | 37 | 38 | 39 | 40 | 61 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /marmot-sso/src/main/webapp/WEB-INF/jsp/logout.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <% 3 | String path = request.getContextPath(); 4 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 5 | %> 6 | 7 | 8 | 9 | 10 | 11 | 12 | 已经注销 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 26 |
27 |

拜拜拜拜拜。。。。

28 | 注销 29 |
30 | 31 | 32 | -------------------------------------------------------------------------------- /marmot-sso/src/main/webapp/WEB-INF/jsp/user/repeatLogin.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <% 3 | String path = request.getContextPath(); 4 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 5 | %> 6 | 7 | 8 | 9 | 10 | 11 | 12 | 重复登录 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 26 |
27 |

重复登录

28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /marmot-sso/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Archetype Created Web Application 4 | 5 | SSO 6 | org.springframework.web.servlet.DispatcherServlet 7 | 8 | contextConfigLocation 9 | classpath:spring/spring-mvc.xml 10 | 11 | 1 12 | 13 | 14 | SSO 15 | / 16 | 17 | 18 | -------------------------------------------------------------------------------- /marmot-sso/src/main/webapp/images/adm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/src/main/webapp/images/adm.png -------------------------------------------------------------------------------- /marmot-sso/src/main/webapp/images/avtar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/src/main/webapp/images/avtar.png -------------------------------------------------------------------------------- /marmot-sso/src/main/webapp/images/banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/src/main/webapp/images/banner.jpg -------------------------------------------------------------------------------- /marmot-sso/src/main/webapp/images/bg1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/src/main/webapp/images/bg1.jpg -------------------------------------------------------------------------------- /marmot-sso/src/main/webapp/images/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/src/main/webapp/images/close.png -------------------------------------------------------------------------------- /marmot-sso/src/main/webapp/images/key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/src/main/webapp/images/key.png -------------------------------------------------------------------------------- /marmot-sso/src/main/webapp/images/logout.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/src/main/webapp/images/logout.jpg -------------------------------------------------------------------------------- /marmot-sso/src/main/webapp/images/pass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/src/main/webapp/images/pass.png -------------------------------------------------------------------------------- /marmot-sso/src/test/java/com/sohu/service/test/AppServiceTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.service.test; 5 | 6 | import java.util.List; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | import org.slf4j.Logger; 11 | import org.slf4j.LoggerFactory; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.test.context.ContextConfiguration; 14 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 15 | 16 | import com.sohu.dao.UserDao; 17 | import com.sohu.model.App; 18 | import com.sohu.model.Group; 19 | import com.sohu.model.User; 20 | import com.sohu.service.AppService; 21 | import com.sohu.service.UserService; 22 | 23 | /** 24 | *

25 | * Description: 26 | *

27 | * @author wenbozhang 28 | * @version 1.0 29 | * @Date 2016年3月1日上午10:34:35 30 | */ 31 | @RunWith(SpringJUnit4ClassRunner.class) 32 | @ContextConfiguration(locations = {"classpath:spring/spring-mvc.xml"}) 33 | public class AppServiceTest { 34 | private final Logger logger= LoggerFactory.getLogger(this.getClass()); 35 | 36 | @Autowired 37 | private AppService appService; 38 | 39 | @Autowired 40 | private UserDao UserDao; 41 | 42 | @Autowired 43 | private UserService UserService; 44 | 45 | @Test 46 | public void changeAppStateTest(){ 47 | appService.changeAppState(3,0); 48 | } 49 | 50 | @Test 51 | public void getAppListTest() { 52 | List apps=appService.getAppList(0); 53 | System.out.println("apps.size()="+apps.size()); 54 | for (App app : apps) { 55 | logger.info(app.toString()); 56 | } 57 | } 58 | 59 | @Test 60 | public void insertAppPageTest(){ 61 | /* User user= UserDao.findUserByName("3"); 62 | System.out.println(user.toString());*/ 63 | /* appService.insertAppPage(2,"127.0.0.1/page/1","3");*/ 64 | } 65 | 66 | @Test 67 | public void updateUserAppidTest(){ 68 | UserDao.updateUserAppid(3, 1); 69 | } 70 | 71 | @Test 72 | public void getGroupByAppidTest(){ 73 | List groups=appService.getGroupByAppid(1); 74 | for (Group group : groups) { 75 | logger.info(group.toString()); 76 | } 77 | } 78 | 79 | @Test 80 | public void deleteGroupTest(){ 81 | appService.deleteGroup(20); 82 | } 83 | @Test 84 | public void findUserTest(){ 85 | List lists=UserService.findUser(15, 2); 86 | for (User user : lists) { 87 | logger.info(user.toString()); 88 | } 89 | } 90 | @Test 91 | public void insertAdminTest(){ 92 | boolean flag=appService.insertAdmin("6", 15); 93 | System.out.println(flag); 94 | } 95 | @Test 96 | public void findGroupsByIdTest(){ 97 | String[] urls=UserService.findGroupsById(4, 16); 98 | for (String string : urls) { 99 | System.out.println(string); 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /marmot-sso/src/test/java/com/sohu/service/test/UserServiceTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Sohu TV. All rights reserved. 3 | */ 4 | package com.sohu.service.test; 5 | 6 | import org.hibernate.Query; 7 | import org.hibernate.Session; 8 | import org.hibernate.SessionFactory; 9 | import org.junit.Test; 10 | import org.junit.runner.RunWith; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.orm.hibernate4.HibernateTemplate; 13 | import org.springframework.test.context.ContextConfiguration; 14 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 15 | 16 | import com.sohu.dao.redis.PtokenDao; 17 | import com.sohu.model.User; 18 | 19 | 20 | /** 21 | *

22 | * Description: 23 | *

24 | * @author wenbozhang 25 | * @version 1.0 26 | * @Date 2015年12月21日下午2:04:20 27 | */ 28 | @RunWith(SpringJUnit4ClassRunner.class) 29 | @ContextConfiguration(locations = {"classpath:spring/spring-dao.xml"}) 30 | public class UserServiceTest { 31 | public static Session session; 32 | 33 | @Autowired 34 | HibernateTemplate template; 35 | 36 | @Autowired 37 | private SessionFactory sessionfactory; 38 | 39 | @Test 40 | public void test2(){ 41 | User user= template.get(User.class, 1L); 42 | System.out.println(user.toString()); 43 | } 44 | 45 | @Test 46 | public void test3(){ 47 | PtokenDao PtokenDao=new PtokenDao(); 48 | PtokenDao.setPtoken(1,"1"); 49 | PtokenDao.setPtoken(1,"2"); 50 | boolean f=PtokenDao.getPtoken(1, "1"); 51 | System.out.println(f); 52 | } 53 | @Test 54 | public void test4(){ 55 | Session session=sessionfactory.openSession(); 56 | String hql="UPDATE User u SET u.userState=:state WHERE u.userId=:id"; 57 | Query queryupdate=session.createQuery(hql).setInteger("state",3).setLong("id", 7); 58 | queryupdate.executeUpdate(); 59 | /* String sql="UPDATE tb_user u SET u.user_state=5 WHERE u.user_id=7;"; 60 | session.createSQLQuery(sql);*/ 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /marmot-sso/target/classes/JedisPool-Conf.properties: -------------------------------------------------------------------------------- 1 | #单机 host 2 | redis.host=10.10.88.223 3 | #单机 port 4 | redis.port=6888 5 | #超时时间 毫秒 6 | jedis.pooltimeout=1000 -------------------------------------------------------------------------------- /marmot-sso/target/classes/app.properties: -------------------------------------------------------------------------------- 1 | c3p0.driverClass=com.mysql.jdbc.Driver 2 | c3p0.jdbcUrl=jdbc:mysql://127.0.0.1:3306/sso?useUnicode=true&characterEncoding=UTF8 3 | c3p0.user=root 4 | c3p0.password= 5 | c3p0.minPoolSize=10 6 | c3p0.maxPoolSize=30 7 | c3p0.autoCommitOnClose=false 8 | c3p0.checkoutTimeout=1000 9 | c3p0.acquireRetryAttempts=2 10 | -------------------------------------------------------------------------------- /marmot-sso/target/classes/c3p0.properties: -------------------------------------------------------------------------------- 1 | c3p0.driverClass=com.mysql.jdbc.Driver 2 | c3p0.jdbcUrl=jdbc:mysql://127.0.0.1:3306/sso?useUnicode=true&characterEncoding=UTF8 3 | c3p0.user=root 4 | c3p0.password= 5 | c3p0.minPoolSize=10 6 | c3p0.maxPoolSize=30 7 | c3p0.autoCommitOnClose=false 8 | c3p0.checkoutTimeout=1000 9 | c3p0.acquireRetryAttempts=2 10 | -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/controller/AppController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/controller/AppController.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/controller/BaseController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/controller/BaseController.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/controller/SsoController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/controller/SsoController.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/dao/AppDao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/dao/AppDao.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/dao/BaseDao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/dao/BaseDao.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/dao/UserDao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/dao/UserDao.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/dao/impl/AppDaoImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/dao/impl/AppDaoImpl.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/dao/impl/BaseDaoImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/dao/impl/BaseDaoImpl.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/dao/impl/UserDaoImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/dao/impl/UserDaoImpl.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/dao/redis/JedisPoolFactory.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/dao/redis/JedisPoolFactory.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/dao/redis/PtokenDao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/dao/redis/PtokenDao.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/dao/redis/TicketDao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/dao/redis/TicketDao.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/dao/redis/UrlDao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/dao/redis/UrlDao.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/dao/redis/UserStateDao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/dao/redis/UserStateDao.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/dto/AppEnum.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/dto/AppEnum.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/dto/CheckOut.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/dto/CheckOut.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/dto/IntercepData.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/dto/IntercepData.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/dto/JsonDto.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/dto/JsonDto.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/interceptor/Interceptor.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/interceptor/Interceptor.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/model/App.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/model/App.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/model/Group.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/model/Group.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/model/Url.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/model/Url.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/model/User.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/model/User.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/model/UserGroup.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/model/UserGroup.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/service/AppService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/service/AppService.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/service/UserService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/service/UserService.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/service/impl/AppServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/service/impl/AppServiceImpl.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/service/impl/UserServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/service/impl/UserServiceImpl.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/util/DesUtil.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/util/DesUtil.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/util/HttpClientUtil.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/util/HttpClientUtil.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/com/sohu/util/InterceptorUtil.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/classes/com/sohu/util/InterceptorUtil.class -------------------------------------------------------------------------------- /marmot-sso/target/classes/hibernate/hibernate.cfg.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | org.hibernate.dialect.MySQLDialect 10 | 11 | 12 | true 13 | 14 | 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /marmot-sso/target/classes/spring/spring-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 55 | -------------------------------------------------------------------------------- /marmot-sso/target/classes/spring/spring-mvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 34 | -------------------------------------------------------------------------------- /marmot-sso/target/classes/spring/spring-service.xml: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /marmot-sso/target/m2e-jee/web-resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Build-Jdk: 1.7.0_45 3 | Built-By: wenbozhang 4 | Created-By: Maven Integration for Eclipse 5 | 6 | -------------------------------------------------------------------------------- /marmot-sso/target/m2e-jee/web-resources/META-INF/maven/SSO/SSO/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven Integration for Eclipse 2 | #Sun Mar 06 20:39:15 CST 2016 3 | version=0.0.1-SNAPSHOT 4 | groupId=SSO 5 | m2e.projectName=SSO 6 | m2e.projectLocation=E\:\\MyEclipseProject\\SSO 7 | artifactId=SSO 8 | -------------------------------------------------------------------------------- /marmot-sso/target/test-classes/com/sohu/service/test/AppServiceTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/test-classes/com/sohu/service/test/AppServiceTest.class -------------------------------------------------------------------------------- /marmot-sso/target/test-classes/com/sohu/service/test/UserServiceTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/test-classes/com/sohu/service/test/UserServiceTest.class -------------------------------------------------------------------------------- /marmot-sso/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/admin/manageUser_jsp.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/admin/manageUser_jsp.class -------------------------------------------------------------------------------- /marmot-sso/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/applogin_jsp.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/applogin_jsp.class -------------------------------------------------------------------------------- /marmot-sso/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/develop/manageAdmin_jsp.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/develop/manageAdmin_jsp.class -------------------------------------------------------------------------------- /marmot-sso/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/login_jsp.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/login_jsp.class -------------------------------------------------------------------------------- /marmot-sso/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/logout_jsp.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/logout_jsp.class -------------------------------------------------------------------------------- /marmot-sso/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/sso_005fadmin/index_jsp.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knitmesh/marmot-sso/f1000c251560d040b0563db588d2f1e0b84b1676/marmot-sso/target/tmp/jsp/org/apache/jsp/WEB_002dINF/jsp/sso_005fadmin/index_jsp.class --------------------------------------------------------------------------------