- 基于oauth的单点登录
- 用户信息管理:租户->用户两层体系
- ACL权限管理
<dependency>
<groupId>xin.manong</groupId>
<artifactId>hylian-client</artifactId>
<version>${hylian.version}</version>
</dependency>
-
方式1:启动单点登录servlet filter
- 应用入口增加注解:xin.manong.hylian.client.annotation.EnableHylianGuard
@EnableHylianGuard public class Application { /** * 应用入口 * * @param args 参数 */ public static void main(String[] args) { SpringApplication.run(Application.class); } }
- application.yml增加配置信息
hylian: client: appId: xxx #应用ID appSecret: xxxxxx #应用秘钥 serverURL: http://hylian-server/ #单点登录服务地址 filter: filterOrder: 1 #过滤器顺序,默认-1000 includePatterns: #拦截URL列表,默认拦截/* - /* excludePatterns: #拦截排除URL列表 - /xxx - /favicon.ico
-
方式2:启动单点登录spring拦截器
- 应用入口增加注解:xin.manong.hylian.client.annotation.EnableHylianInterceptor
@EnableHylianInterceptor public class Application { /** * 应用入口 * * @param args 参数 */ public static void main(String[] args) { SpringApplication.run(Application.class); } }
- 编写spring MVC配置,引入拦截器
@Configuration public class InterceptorConfig implements WebMvcConfigurer { @Resource private HylianInterceptor interceptor; @Override protected void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(interceptor).addPathPatterns("/**"). excludePathPatterns("/login", "/favicon.ico"); } }
- application.yml增加配置信息
hylian: client: appId: xxx #应用ID appSecret: xxxxxx #应用秘钥 serverURL: http://hylian-server/ #单点登录服务地址