temp
This commit is contained in:
32
urbanLifelineServ/auth/pom.xml
Normal file
32
urbanLifelineServ/auth/pom.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.xyzh</groupId>
|
||||
<artifactId>urban-lifeline</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.xyzh</groupId>
|
||||
<artifactId>auth</artifactId>
|
||||
<version>${urban-lifeline.version}</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.xyzh.apis</groupId>
|
||||
<artifactId>api-auth</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.xyzh.common</groupId>
|
||||
<artifactId>common-auth</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.xyzh.auth;
|
||||
|
||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableDubbo // 启用 Dubbo 服务
|
||||
@ComponentScan(basePackages = {
|
||||
"org.xyzh.auth", // 当前auth模块
|
||||
"org.xyzh.common" // 公共模块
|
||||
})
|
||||
public class AuthApp {
|
||||
private static final Logger logger = LoggerFactory.getLogger(AuthApp.class);
|
||||
|
||||
public static void main(String[] args) {
|
||||
logger.info("======================== AuthApp 启动中 =========================");
|
||||
SpringApplication.run(AuthApp.class, args);
|
||||
logger.info("======================== AuthApp 启动成功 =========================");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package org.xyzh.auth.config;
|
||||
|
||||
import io.swagger.v3.oas.models.Components;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.info.Contact;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import io.swagger.v3.oas.models.info.License;
|
||||
import io.swagger.v3.oas.models.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import io.swagger.v3.oas.models.servers.Server;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* OpenAPI 配置类 - Auth 服务
|
||||
* 配置 Swagger/OpenAPI 文档,方便 Apifox 导入接口和对象进行测试
|
||||
*
|
||||
* @author yslg
|
||||
*/
|
||||
@Configuration
|
||||
public class OpenApiConfig {
|
||||
|
||||
@Bean
|
||||
public OpenAPI authOpenAPI() {
|
||||
return new OpenAPI()
|
||||
.info(new Info()
|
||||
.title("认证服务 API 文档")
|
||||
.description("""
|
||||
认证服务接口文档,包括登录、登出、Token刷新等功能。
|
||||
|
||||
## 使用说明
|
||||
1. 访问 Swagger UI: http://localhost:8081/urban-lifeline/auth/swagger-ui.html
|
||||
2. 访问 OpenAPI JSON: http://localhost:8081/urban-lifeline/auth/v3/api-docs
|
||||
3. 在 Apifox 中导入 OpenAPI JSON 进行接口测试
|
||||
""")
|
||||
.version("1.0.0")
|
||||
.contact(new Contact()
|
||||
.name("yslg")
|
||||
.email("3401275564@qq.com"))
|
||||
.license(new License()
|
||||
.name("Apache 2.0")
|
||||
.url("https://www.apache.org/licenses/LICENSE-2.0.html")))
|
||||
.servers(List.of(
|
||||
new Server().url("http://localhost:8081/urban-lifeline/auth").description("本地开发环境")
|
||||
))
|
||||
.addSecurityItem(new SecurityRequirement().addList("Bearer Authentication"))
|
||||
.components(new Components()
|
||||
.addSecuritySchemes("Bearer Authentication",
|
||||
new SecurityScheme()
|
||||
.type(SecurityScheme.Type.HTTP)
|
||||
.scheme("bearer")
|
||||
.bearerFormat("JWT")
|
||||
.description("请输入JWT Token,格式:Bearer {token}")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package org.xyzh.auth.service.impl;
|
||||
|
||||
import org.xyzh.api.auth.service.AuthService;
|
||||
import org.xyzh.common.core.domain.LoginDomain;
|
||||
import org.xyzh.common.core.domain.LoginParam;
|
||||
import org.xyzh.common.core.domain.ResultDomain;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @description AuthServiceImpl.java文件描述 认证服务实现类
|
||||
* @filename AuthServiceImpl.java
|
||||
* @author yslg
|
||||
* @copyright yslg
|
||||
* @since 2025-11-09
|
||||
*/
|
||||
public class AuthServiceImpl implements AuthService{
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(AuthServiceImpl.class);
|
||||
|
||||
@Override
|
||||
public ResultDomain<LoginDomain> getCaptcha(LoginParam arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultDomain<LoginDomain> getLoginByToken(String arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultDomain<Boolean> isTokenValid(String arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultDomain<LoginDomain> login(LoginParam arg0, HttpServletRequest arg1) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultDomain<LoginDomain> logout(HttpServletRequest arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultDomain<LoginDomain> refreshToken(HttpServletRequest arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
36
urbanLifelineServ/auth/src/main/resources/application.yml
Normal file
36
urbanLifelineServ/auth/src/main/resources/application.yml
Normal file
@@ -0,0 +1,36 @@
|
||||
server:
|
||||
port: 8081
|
||||
servlet:
|
||||
context-path: /urban-lifeline/auth
|
||||
|
||||
springdoc:
|
||||
api-docs:
|
||||
# 启用 API 文档
|
||||
enabled: true
|
||||
# API 文档路径
|
||||
path: /v3/api-docs
|
||||
swagger-ui:
|
||||
# 启用 Swagger UI
|
||||
enabled: true
|
||||
# Swagger UI 路径
|
||||
path: /swagger-ui.html
|
||||
# 尝试请求超时时间(毫秒)
|
||||
try-it-out-enabled: true
|
||||
# 显示请求执行时间
|
||||
show-common-extensions: true
|
||||
# 显示请求头部
|
||||
show-extensions: true
|
||||
# 显示模型
|
||||
show-request-duration: true
|
||||
# 过滤开关
|
||||
filter: true
|
||||
# 标签排序
|
||||
tags-sorter: alpha
|
||||
# 操作排序
|
||||
operations-sorter: alpha
|
||||
# 分组配置(可选)
|
||||
group-configs:
|
||||
- group: 'default'
|
||||
display-name: '认证服务 API'
|
||||
paths-to-match: '/**'
|
||||
|
||||
Reference in New Issue
Block a user