kisso = cookie sso
基于 Cookie 的 SSO 中间件,它是一把快速开发 java Web 登录系统(SSO)的瑞士军刀。欢迎大家使用 kisso !!
-
前后分离可选:请求 Header 票据模式, 请求 Cookie 模式
使用文档
// 生成 jwt 票据,访问请求头设置‘ accessToken=票据内容 ’String jwtToken = SSOToken.create().setId(1).setIssuer("admin").getToken();// 解析票据SSOToken ssoToken = SSOToken.parser(jwtToken);// Cookie 模式设置SSOHelper.setCookie(request, response, new SSOToken().setId(String.valueOf(1)).setIssuer("admin"));// 权限拦截器类 SSOSpringInterceptor// 注解不拦截 @Login(action = Action.Skip)// yml 配置 kisso.config....
默认 HS512 算法
// HS512 密钥,配置参数 kisso.config.sign-keySSOHelper.getHS512SecretKey()
切换 RS512 算法
- 1,配置算法 kisso.config.sign-algorithm = RS512
- 2,配置私钥公钥证书,默认放置 resources 目录即可
// RSA 密钥,配置参数 kisso.config.rsa-jks-store// 其它参数 CN=Server,OU=Unit,O=Organization,L=City,S=State,C=US// RSA 生成 jks 密钥$ keytool -genkeypair -alias jwtkey -keyalg RSA -dname "CN=llt" -keypass keypassword -keystore key.jks -storepass jkspassword// RSA 生成证书// RSA 公钥,配置参数 kisso.config.rsa-cert-store$ keytool -export -alias jwtkey -file public.cert -keystore key.jks -storepass jkspassword