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 | Set13 | * 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, Map17 | * 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 |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 |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 |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 |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 Map13 | * 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 | List10 | * 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 | List20 | * 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 List15 | * 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 | Set13 | * 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 JsonDto16 | * 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 List14 | * 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 List22 | * 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 List14 | * 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 |Copyright © 2016. All rights reserved
63 |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 | List22 | * 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 |