# security-oauth2-example **Repository Path**: ranfusheng/security-oauth2-example ## Basic Information - **Project Name**: security-oauth2-example - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-03-28 - **Last Updated**: 2023-12-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # oauth2例子 ### 服务介绍 1. auth:认证授权服务器(端口号:8001) 2. resource-server-1:资源服务器1(端口号:8002) 3. resource-server-2:资源服务器2(端口号:8003) 4. client-1 客户端1(端口号:8004) 5. client-2 客户端2(端口号:8005) ### 单点登陆使用说明 1. 启动mysql,并创建database(example_oauth2); 2. 若使用redis存储token,则需要启动redis,端口号6379; 3. 启动各服务; 4. 调用client1/client2的接口(如调用localhost:8004/hello),此时会转发到认证授权服务器的登陆接口; 5. 登陆(admin可以访问resource1和resource2,user只能通过客户端访问resource2); 6. 此时client1/client2均可以访问(如调用localhost:8005/hello),无需再次登陆。 7. **注:用户名密码自己加密后存储到数据库中**,初始化数据sql在auth服务的text下。 ### 版本依赖 1. spring-boot:2.2.5.RELEASE 2. spring-cloud:Hoxton.SR3 3. hutool:5.5.6 4. druid:1.2.4