# QJChen_SSO_Client
**Repository Path**: QJ-Chen/SSO_Client
## Basic Information
- **Project Name**: QJChen_SSO_Client
- **Description**: QJChen_SSO 单点登录系统客户端
- **Primary Language**: Unknown
- **License**: GPL-3.0
- **Default Branch**: develop
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2023-07-15
- **Last Updated**: 2024-05-12
## Categories & Tags
**Categories**: Uncategorized
**Tags**: SpringBoot, sso
## README
# QAS统一登录平台Client:第三方集成依赖
项目环境:
* 模块基于jdk_1.8开发,支持maven或gradle构建。主要用于QAS客户端与服务端通信使用。
* 该模块主要提供给第三方开发者集成QAS平台时使用。
# 项目简介
### 作者:QJ·Chen
项目基于Spring系列开发,主要用于单点登录,统一用户数据管理。作为毕业设计使用。
## 集成方案
### 1.Springboot2.x集成方案:
#### 1.1 maven方式:
* 引入maven仓库配置:
```
rdc-releases
6204b7f8eba0f7e56424288d
mYauBGNBY24o
rdc-snapshots
6204b7f8eba0f7e56424288d
mYauBGNBY24o
rdc-releases
https://packages.aliyun.com/maven/repository/2189303-release-N4Rxwu/
true
false
rdc-snapshots
https://packages.aliyun.com/maven/repository/2189303-snapshot-7TgIPF/
false
true
```
* 引入依赖
```
com.qjchen
QJChen_SSO_Client
1.0.0
com.qjchen
QJChen_SSO_SDK
1.0.0
```
#### 1.2 Gradle方式
```groovy
allprojects {
repositories {
maven {
url 'https://maven.aliyun.com/repository/public'
}
maven {
credentials {
username '6204b7f8eba0f7e56424288d'
password 'mYauBGNBY24o'
}
url 'https://packages.aliyun.com/maven/repository/2189303-release-N4Rxwu/'
}
maven {
credentials {
username '6204b7f8eba0f7e56424288d'
password 'mYauBGNBY24o'
}
url 'https://packages.aliyun.com/maven/repository/2189303-snapshot-7TgIPF/'
}
}
}
```
#### 1.3 代码集成
* 启动类添加注解
```java
@ComponentScan({"com.qjchen","你自己的包名"})
@SpringBootApplication
public class App(){
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
}
```
* 添加权限拦截器(自定义)
```java
import com.qjchen.qas.interceptor.AuthInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class QasConfig implements WebMvcConfigurer {
/**
* 权限拦截器
*/
@Bean
public AuthInterceptor authInterceptor() {
return new AuthInterceptor();
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(authInterceptor()).addPathPatterns("/**").excludePathPatterns("classpath:/static/**").order(2);
}
}
```
* 在application.properties中添加配置属性
```properties
# 应用接口,Controller中用到
qjc.sso.api=/manage
# 服务端接口,Controller中用到
qjc.sso.server-api=/sso/api
# 跨域配置(开发模式下如不需要启用SSO会用到)
# 客户端地址,IP使用服务器提供真实IP,测试、生产环境下切勿使用127/192/10等内网ip地址
qjc.sso.client-context=http://127.0.0.1:8011/sso_manage
# 服务端地址,一般由平台管理员提供IP使用服务器提供真实IP,测试、生产环境下切勿使用127/192/10等内网ip地址
qjc.sso.server-context=http://127.0.0.1:8010/sso_service
# 跨域配置(开发模式下如不需要启用SSO会用到)
qjc.sso.crossOrigin-context=http://localhost:8080
# 应用编码,创建应用至服务端时设定
qjc.sso.client-app-code=SSO-Manage
# 应用签名,创建应用至服务端时设定
qjc.sso.client-app-signature=19b26a0e565473b3f39fe58770b31d0cfbd031d78e0c9dd4c2615e8ab8d1163d
# 是否启用SSO
qjc.sso.enable=true
```
* 集成完成
### 项目地址
* [Common:公共组件,提供公用模型、依赖、工具。](https://gitee.com/QJ-Chen/SSO_Common.git)
* [Service:服务端,提供登录授权功能。](https://gitee.com/QJ-Chen/SSO_Service.git)
* [Client:客户端,提供给开发者接入QAS,提供默认拦截器功能(接入必须)](https://gitee.com/QJ-Chen/SSO_Client.git)
* [SDK:第三方接入模块,提供给第三方开发者获取服务端数据用,(强烈建议)](https://gitee.com/QJ-Chen/SSO_SDK.git)
* [Manage:官方提供管理中心后端](https://gitee.com/QJ-Chen/SSO_Manage.git)
* [Web:官方提供管理中心前端](https://gitee.com/QJ-Chen/SSO_Web.git)
### 构建
* Gradle:7.6.2
### 依赖
* api 'com.qjchen:QJChen_SSO_Common:1.0.0'
### 更新时间
* 2023年11月29日:QJ·Chen