From aaf4422311747a8f9c08665fe86d0d401ca05c82 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期一, 25 十一月 2024 13:25:43 +0800 Subject: [PATCH] 1 --- /dev/null | 74 ------------------------------------- .gitignore | 1 2 files changed, 1 insertions(+), 74 deletions(-) diff --git a/.gitignore b/.gitignore index 08a2bba..c350549 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,4 @@ /docker-compose/mysql/data /docker-compose/nacos/logs/nacos_gc.log.0.current /docker-compose/redis/data/dump.rdb +/bak diff --git a/se-auth/pom.xml b/se-auth/pom.xml deleted file mode 100644 index 6dad247..0000000 --- a/se-auth/pom.xml +++ /dev/null @@ -1,73 +0,0 @@ -<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"> - <parent> - <groupId>com.se</groupId> - <artifactId>se</artifactId> - <version>3.6.4</version> - </parent> - <modelVersion>4.0.0</modelVersion> - - <artifactId>se-auth</artifactId> - - <description> - se-auth璁よ瘉鎺堟潈涓績 - </description> - - <dependencies> - - <!-- SpringCloud Alibaba Nacos --> - <dependency> - <groupId>com.alibaba.cloud</groupId> - <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> - </dependency> - - <!-- SpringCloud Alibaba Nacos Config --> - <dependency> - <groupId>com.alibaba.cloud</groupId> - <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> - </dependency> - - <!-- SpringCloud Alibaba Sentinel --> - <dependency> - <groupId>com.alibaba.cloud</groupId> - <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> - </dependency> - - <!-- SpringBoot Web --> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> - - <!-- SpringBoot Actuator --> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-actuator</artifactId> - </dependency> - - <!-- SE Common Security--> - <dependency> - <groupId>com.se</groupId> - <artifactId>se-common-security</artifactId> - </dependency> - </dependencies> - - <build> - <finalName>${project.artifactId}</finalName> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>repackage</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - -</project> diff --git a/se-auth/se-auth.iml b/se-auth/se-auth.iml deleted file mode 100644 index 489f425..0000000 --- a/se-auth/se-auth.iml +++ /dev/null @@ -1,173 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> - <component name="FacetManager"> - <facet type="Spring" name="Spring"> - <configuration /> - </facet> - <facet type="web" name="Web"> - <configuration> - <webroots /> - </configuration> - </facet> - </component> - <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> - <output url="file://$MODULE_DIR$/target/classes" /> - <output-test url="file://$MODULE_DIR$/target/test-classes" /> - <content url="file://$MODULE_DIR$"> - <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> - <excludeFolder url="file://$MODULE_DIR$/target" /> - </content> - <orderEntry type="jdk" jdkName="jdk-1.8" jdkType="JavaSDK" /> - <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery:2021.0.5.0" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-alibaba-commons:2021.0.5.0" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-client:2.2.0" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-auth-plugin:2.2.0" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-encryption-plugin:2.2.0" level="project" /> - <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.15" level="project" /> - <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.13.5" level="project" /> - <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.13.5" level="project" /> - <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.13.5" level="project" /> - <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpasyncclient:4.1.5" level="project" /> - <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.16" level="project" /> - <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore-nio:4.4.16" level="project" /> - <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.14" level="project" /> - <orderEntry type="library" name="Maven: io.prometheus:simpleclient:0.15.0" level="project" /> - <orderEntry type="library" name="Maven: io.prometheus:simpleclient_tracer_otel:0.15.0" level="project" /> - <orderEntry type="library" name="Maven: io.prometheus:simpleclient_tracer_common:0.15.0" level="project" /> - <orderEntry type="library" name="Maven: io.prometheus:simpleclient_tracer_otel_agent:0.15.0" level="project" /> - <orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.30" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba.spring:spring-context-support:1.0.11" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-commons:3.1.7" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.security:spring-security-crypto:5.7.11" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-context:3.1.7" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-config:2021.0.5.0" level="project" /> - <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.36" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-starter-alibaba-sentinel:2021.0.5.0" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-transport-simple-http:1.8.6" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-transport-common:1.8.6" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-datasource-extension:1.8.6" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.83_noneautotype" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-annotation-aspectj:1.8.6" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-core:1.8.6" level="project" /> - <orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.7" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-circuitbreaker-sentinel:2021.0.5.0" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-reactor-adapter:1.8.6" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-spring-webflux-adapter:1.8.6" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-spring-webmvc-adapter:1.8.6" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-parameter-flow-control:1.8.6" level="project" /> - <orderEntry type="library" name="Maven: com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4.2" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-cluster-server-default:1.8.6" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-cluster-common-default:1.8.6" level="project" /> - <orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.101.Final" level="project" /> - <orderEntry type="library" name="Maven: io.netty:netty-common:4.1.101.Final" level="project" /> - <orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.101.Final" level="project" /> - <orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.101.Final" level="project" /> - <orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.101.Final" level="project" /> - <orderEntry type="library" name="Maven: io.netty:netty-transport-native-unix-common:4.1.101.Final" level="project" /> - <orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.101.Final" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba.csp:sentinel-cluster-client-default:1.8.6" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-alibaba-sentinel-datasource:2021.0.5.0" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.7.18" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.7.18" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.7.18" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.7.18" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.7.18" level="project" /> - <orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.12" level="project" /> - <orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.12" level="project" /> - <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.17.2" level="project" /> - <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.17.2" level="project" /> - <orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.36" level="project" /> - <orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-core:5.3.33" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.3.33" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.7.18" level="project" /> - <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.13.5" level="project" /> - <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.5" level="project" /> - <orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.13.5" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.7.18" level="project" /> - <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.83" level="project" /> - <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.83" level="project" /> - <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.83" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-web:5.3.33" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-beans:5.3.33" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.3.33" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-aop:5.3.33" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-context:5.3.33" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-expression:5.3.33" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-actuator:2.7.18" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-actuator-autoconfigure:2.7.18" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-actuator:2.7.18" level="project" /> - <orderEntry type="library" name="Maven: io.micrometer:micrometer-core:1.9.17" level="project" /> - <orderEntry type="library" name="Maven: org.hdrhistogram:HdrHistogram:2.1.12" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: org.latencyutils:LatencyUtils:2.0.3" level="project" /> - <orderEntry type="module" module-name="se-common-security" /> - <orderEntry type="module" module-name="se-api-system" /> - <orderEntry type="module" module-name="se-common-core" /> - <orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-openfeign:3.1.8" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-openfeign-core:3.1.8" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.7.18" level="project" /> - <orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form-spring:3.8.0" level="project" /> - <orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form:3.8.0" level="project" /> - <orderEntry type="library" name="Maven: commons-fileupload:commons-fileupload:1.5" level="project" /> - <orderEntry type="library" name="Maven: io.github.openfeign:feign-core:11.10" level="project" /> - <orderEntry type="library" name="Maven: io.github.openfeign:feign-slf4j:11.10" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-loadbalancer:3.1.7" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-loadbalancer:3.1.7" level="project" /> - <orderEntry type="library" name="Maven: io.projectreactor.addons:reactor-extra:3.4.10" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-cache:2.7.18" level="project" /> - <orderEntry type="library" name="Maven: com.stoyanr:evictor:1.0.0" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.3.33" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba:transmittable-thread-local:2.14.4" level="project" /> - <orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:2.0.0" level="project" /> - <orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.3.1" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.7.18" level="project" /> - <orderEntry type="library" name="Maven: com.zaxxer:HikariCP:4.0.3" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.3.33" level="project" /> - <orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.3.1" level="project" /> - <orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.13" level="project" /> - <orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.1.1" level="project" /> - <orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:2.0.0" level="project" /> - <orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:6.0.0" level="project" /> - <orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:2.7.18" level="project" /> - <orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.2.5.Final" level="project" /> - <orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" /> - <orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.3.Final" level="project" /> - <orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba.fastjson2:fastjson2:2.0.43" level="project" /> - <orderEntry type="library" name="Maven: io.jsonwebtoken:jjwt:0.9.1" level="project" /> - <orderEntry type="library" name="Maven: javax.xml.bind:jaxb-api:2.3.1" level="project" /> - <orderEntry type="library" name="Maven: javax.activation:javax.activation-api:1.2.0" level="project" /> - <orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.12.0" level="project" /> - <orderEntry type="library" name="Maven: commons-io:commons-io:2.13.0" level="project" /> - <orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml:4.1.2" level="project" /> - <orderEntry type="library" name="Maven: org.apache.poi:poi:4.1.2" level="project" /> - <orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.4" level="project" /> - <orderEntry type="library" name="Maven: org.apache.commons:commons-math3:3.6.1" level="project" /> - <orderEntry type="library" name="Maven: com.zaxxer:SparseBitSet:1.2" level="project" /> - <orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml-schemas:4.1.2" level="project" /> - <orderEntry type="library" name="Maven: org.apache.xmlbeans:xmlbeans:3.1.0" level="project" /> - <orderEntry type="library" name="Maven: org.apache.commons:commons-compress:1.19" level="project" /> - <orderEntry type="library" name="Maven: com.github.virtuald:curvesapi:1.06" level="project" /> - <orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:4.0.1" level="project" /> - <orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.6.2" level="project" /> - <orderEntry type="module" module-name="se-common-redis" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-redis:2.7.18" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:2.7.18" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.data:spring-data-keyvalue:2.7.18" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.7.18" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-tx:5.3.33" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.3.33" level="project" /> - <orderEntry type="library" name="Maven: io.lettuce:lettuce-core:6.1.10.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: io.projectreactor:reactor-core:3.4.34" level="project" /> - <orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.4" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-bootstrap:3.1.7" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter:3.1.7" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.security:spring-security-rsa:1.0.11.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.69" level="project" /> - <orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.69" level="project" /> - <orderEntry type="library" name="Maven: org.bouncycastle:bcutil-jdk15on:1.69" level="project" /> - </component> -</module> \ No newline at end of file diff --git a/se-auth/src/main/java/com/se/auth/SeAuthApplication.java b/se-auth/src/main/java/com/se/auth/SeAuthApplication.java deleted file mode 100644 index a584b9f..0000000 --- a/se-auth/src/main/java/com/se/auth/SeAuthApplication.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.se.auth; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; -import com.se.common.security.annotation.EnableRyFeignClients; - -/** - * 璁よ瘉鎺堟潈涓績 - * - * @author admin - */ -@EnableRyFeignClients -@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class }) -public class SeAuthApplication -{ - public static void main(String[] args) - { - SpringApplication.run(SeAuthApplication.class, args); - System.out.println(" 鎺堟潈涓績鍚姩鎴愬姛 "); - } -} diff --git a/se-auth/src/main/java/com/se/auth/controller/HealthController.java b/se-auth/src/main/java/com/se/auth/controller/HealthController.java deleted file mode 100644 index d032018..0000000 --- a/se-auth/src/main/java/com/se/auth/controller/HealthController.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.se.auth.controller; - -import com.se.common.core.web.controller.BaseController; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@SuppressWarnings("ALL") -public class HealthController extends BaseController { - @GetMapping("/health") - public long test() { - return System.currentTimeMillis(); - } -} diff --git a/se-auth/src/main/java/com/se/auth/controller/TokenController.java b/se-auth/src/main/java/com/se/auth/controller/TokenController.java deleted file mode 100644 index 3f34d1f..0000000 --- a/se-auth/src/main/java/com/se/auth/controller/TokenController.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.se.auth.controller; - -import javax.servlet.http.HttpServletRequest; - -import com.se.auth.form.LoginBody; -import com.se.auth.form.RegisterBody; -import com.se.auth.service.SysLoginService; -import com.se.common.core.utils.AesUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.web.bind.annotation.*; -import com.se.common.core.domain.R; -import com.se.common.core.utils.JwtUtils; -import com.se.common.core.utils.StringUtils; -import com.se.common.security.auth.AuthUtil; -import com.se.common.security.service.TokenService; -import com.se.common.security.utils.SecurityUtils; -import com.se.system.api.model.LoginUser; - -/** - * token 鎺у埗 - * - * @author admin - */ -@RestController -public class TokenController { - @Autowired - private TokenService tokenService; - - @Autowired - private SysLoginService sysLoginService; - - @Value("${enableEncrypt}") - boolean enableEncrypt; - - @PostMapping("login") - public R<?> login(@RequestBody LoginBody form) throws Exception { - if (enableEncrypt && !StringUtils.isEmpty(form.getPassword())) { - form.setPassword(AesUtils.decrypt(form.getPassword())); - } - // 鐢ㄦ埛鐧诲綍 - LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword()); - // 鑾峰彇鐧诲綍token - return R.ok(tokenService.createToken(userInfo)); - } - - @GetMapping("validate") - @PostMapping("validate") - public R<Object> validate(HttpServletRequest request) { - try { - boolean flag = false; - String token = SecurityUtils.getToken(request); - if (!StringUtils.isNotEmpty(token)) { - String userName = JwtUtils.getUserName(token); - flag = !StringUtils.isEmpty(userName); - } - - return R.ok(flag); - } catch (Exception ex) { - return R.fail(ex.getMessage()); - } - } - - @DeleteMapping("logout") - public R<?> logout(HttpServletRequest request) { - String token = SecurityUtils.getToken(request); - if (StringUtils.isNotEmpty(token)) { - String username = JwtUtils.getUserName(token); - // 鍒犻櫎鐢ㄦ埛缂撳瓨璁板綍 - AuthUtil.logoutByToken(token); - // 璁板綍鐢ㄦ埛閫�鍑烘棩蹇� - sysLoginService.logout(username); - } - return R.ok(); - } - - @PostMapping("refresh") - public R<?> refresh(HttpServletRequest request) { - LoginUser loginUser = tokenService.getLoginUser(request); - if (StringUtils.isNotNull(loginUser)) { - // 鍒锋柊浠ょ墝鏈夋晥鏈� - tokenService.refreshToken(loginUser); - return R.ok(); - } - return R.ok(); - } - - /*@PostMapping("register") - public R<?> register(@RequestBody RegisterBody registerBody) - { - // 鐢ㄦ埛娉ㄥ唽 - sysLoginService.register(registerBody.getUsername(), registerBody.getPassword()); - return R.ok(); - }*/ -} diff --git a/se-auth/src/main/java/com/se/auth/form/LoginBody.java b/se-auth/src/main/java/com/se/auth/form/LoginBody.java deleted file mode 100644 index e94dd82..0000000 --- a/se-auth/src/main/java/com/se/auth/form/LoginBody.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.se.auth.form; - -/** - * 鐢ㄦ埛鐧诲綍瀵硅薄 - * - * @author admin - */ -public class LoginBody -{ - /** - * 鐢ㄦ埛鍚� - */ - private String username; - - /** - * 鐢ㄦ埛瀵嗙爜 - */ - private String password; - - public String getUsername() - { - return username; - } - - public void setUsername(String username) - { - this.username = username; - } - - public String getPassword() - { - return password; - } - - public void setPassword(String password) - { - this.password = password; - } -} diff --git a/se-auth/src/main/java/com/se/auth/form/RegisterBody.java b/se-auth/src/main/java/com/se/auth/form/RegisterBody.java deleted file mode 100644 index b0cdbe1..0000000 --- a/se-auth/src/main/java/com/se/auth/form/RegisterBody.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.se.auth.form; - -/** - * 鐢ㄦ埛娉ㄥ唽瀵硅薄 - * - * @author admin - */ -public class RegisterBody extends LoginBody -{ - -} diff --git a/se-auth/src/main/java/com/se/auth/service/SysLoginService.java b/se-auth/src/main/java/com/se/auth/service/SysLoginService.java deleted file mode 100644 index e053531..0000000 --- a/se-auth/src/main/java/com/se/auth/service/SysLoginService.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.se.auth.service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import com.se.common.core.constant.CacheConstants; -import com.se.common.core.constant.Constants; -import com.se.common.core.constant.SecurityConstants; -import com.se.common.core.constant.UserConstants; -import com.se.common.core.domain.R; -import com.se.common.core.enums.UserStatus; -import com.se.common.core.exception.ServiceException; -import com.se.common.core.text.Convert; -import com.se.common.core.utils.DateUtils; -import com.se.common.core.utils.StringUtils; -import com.se.common.core.utils.ip.IpUtils; -import com.se.common.redis.service.RedisService; -import com.se.common.security.utils.SecurityUtils; -import com.se.system.api.RemoteUserService; -import com.se.system.api.domain.SysUser; -import com.se.system.api.model.LoginUser; - -/** - * 鐧诲綍鏍¢獙鏂规硶 - * - * @author admin - */ -@Component -public class SysLoginService -{ - @Autowired - private RemoteUserService remoteUserService; - - @Autowired - private SysPasswordService passwordService; - - @Autowired - private SysRecordLogService recordLogService; - - @Autowired - private RedisService redisService; - - /** - * 鐧诲綍 - */ - public LoginUser login(String username, String password) - { - // 鐢ㄦ埛鍚嶆垨瀵嗙爜涓虹┖ 閿欒 - if (StringUtils.isAnyBlank(username, password)) - { - recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "鐢ㄦ埛/瀵嗙爜蹇呴』濉啓"); - throw new ServiceException("鐢ㄦ埛/瀵嗙爜蹇呴』濉啓"); - } - // 瀵嗙爜濡傛灉涓嶅湪鎸囧畾鑼冨洿鍐� 閿欒 - if (password.length() < UserConstants.PASSWORD_MIN_LENGTH - || password.length() > UserConstants.PASSWORD_MAX_LENGTH) - { - recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "鐢ㄦ埛瀵嗙爜涓嶅湪鎸囧畾鑼冨洿"); - throw new ServiceException("鐢ㄦ埛瀵嗙爜涓嶅湪鎸囧畾鑼冨洿"); - } - // 鐢ㄦ埛鍚嶄笉鍦ㄦ寚瀹氳寖鍥村唴 閿欒 - if (username.length() < UserConstants.USERNAME_MIN_LENGTH - || username.length() > UserConstants.USERNAME_MAX_LENGTH) - { - recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "鐢ㄦ埛鍚嶄笉鍦ㄦ寚瀹氳寖鍥�"); - throw new ServiceException("鐢ㄦ埛鍚嶄笉鍦ㄦ寚瀹氳寖鍥�"); - } - // IP榛戝悕鍗曟牎楠� - String blackStr = Convert.toStr(redisService.getCacheObject(CacheConstants.SYS_LOGIN_BLACKIPLIST)); - if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) - { - recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "寰堥仐鎲撅紝璁块棶IP宸茶鍒楀叆绯荤粺榛戝悕鍗�"); - throw new ServiceException("寰堥仐鎲撅紝璁块棶IP宸茶鍒楀叆绯荤粺榛戝悕鍗�"); - } - // 鏌ヨ鐢ㄦ埛淇℃伅 - R<LoginUser> userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER); - - if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) - { - recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "鐧诲綍鐢ㄦ埛涓嶅瓨鍦�"); - throw new ServiceException("鐧诲綍鐢ㄦ埛锛�" + username + " 涓嶅瓨鍦�"); - } - - if (R.FAIL == userResult.getCode()) - { - throw new ServiceException(userResult.getMsg()); - } - - LoginUser userInfo = userResult.getData(); - SysUser user = userResult.getData().getSysUser(); - if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) - { - recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "瀵逛笉璧凤紝鎮ㄧ殑璐﹀彿宸茶鍒犻櫎"); - throw new ServiceException("瀵逛笉璧凤紝鎮ㄧ殑璐﹀彿锛�" + username + " 宸茶鍒犻櫎"); - } - if (UserStatus.DISABLE.getCode().equals(user.getStatus())) - { - recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "鐢ㄦ埛宸插仠鐢紝璇疯仈绯荤鐞嗗憳"); - throw new ServiceException("瀵逛笉璧凤紝鎮ㄧ殑璐﹀彿锛�" + username + " 宸插仠鐢�"); - } - passwordService.validate(user, password); - recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "鐧诲綍鎴愬姛"); - recordLoginInfo(user.getUserId()); - return userInfo; - } - - /** - * 璁板綍鐧诲綍淇℃伅 - * - * @param userId 鐢ㄦ埛ID - */ - public void recordLoginInfo(Long userId) - { - SysUser sysUser = new SysUser(); - sysUser.setUserId(userId); - // 鏇存柊鐢ㄦ埛鐧诲綍IP - sysUser.setLoginIp(IpUtils.getIpAddr()); - // 鏇存柊鐢ㄦ埛鐧诲綍鏃堕棿 - sysUser.setLoginDate(DateUtils.getNowDate()); - remoteUserService.recordUserLogin(sysUser, SecurityConstants.INNER); - } - - public void logout(String loginName) - { - recordLogService.recordLogininfor(loginName, Constants.LOGOUT, "閫�鍑烘垚鍔�"); - } - - /** - * 娉ㄥ唽 - */ - public void register(String username, String password) - { - // 鐢ㄦ埛鍚嶆垨瀵嗙爜涓虹┖ 閿欒 - if (StringUtils.isAnyBlank(username, password)) - { - throw new ServiceException("鐢ㄦ埛/瀵嗙爜蹇呴』濉啓"); - } - if (username.length() < UserConstants.USERNAME_MIN_LENGTH - || username.length() > UserConstants.USERNAME_MAX_LENGTH) - { - throw new ServiceException("璐︽埛闀垮害蹇呴』鍦�2鍒�20涓瓧绗︿箣闂�"); - } - if (password.length() < UserConstants.PASSWORD_MIN_LENGTH - || password.length() > UserConstants.PASSWORD_MAX_LENGTH) - { - throw new ServiceException("瀵嗙爜闀垮害蹇呴』鍦�5鍒�20涓瓧绗︿箣闂�"); - } - - // 娉ㄥ唽鐢ㄦ埛淇℃伅 - SysUser sysUser = new SysUser(); - sysUser.setUserName(username); - sysUser.setNickName(username); - sysUser.setPassword(SecurityUtils.encryptPassword(password)); - R<?> registerResult = remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER); - - if (R.FAIL == registerResult.getCode()) - { - throw new ServiceException(registerResult.getMsg()); - } - recordLogService.recordLogininfor(username, Constants.REGISTER, "娉ㄥ唽鎴愬姛"); - } -} diff --git a/se-auth/src/main/java/com/se/auth/service/SysPasswordService.java b/se-auth/src/main/java/com/se/auth/service/SysPasswordService.java deleted file mode 100644 index 8efc6ab..0000000 --- a/se-auth/src/main/java/com/se/auth/service/SysPasswordService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.se.auth.service; - -import java.util.concurrent.TimeUnit; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import com.se.common.core.constant.CacheConstants; -import com.se.common.core.constant.Constants; -import com.se.common.core.exception.ServiceException; -import com.se.common.redis.service.RedisService; -import com.se.common.security.utils.SecurityUtils; -import com.se.system.api.domain.SysUser; - -/** - * 鐧诲綍瀵嗙爜鏂规硶 - * - * @author admin - */ -@Component -@SuppressWarnings("ALL") -public class SysPasswordService -{ - @Autowired - private RedisService redisService; - - private int maxRetryCount = CacheConstants.PASSWORD_MAX_RETRY_COUNT; - - private Long lockTime = CacheConstants.PASSWORD_LOCK_TIME; - - @Autowired - private SysRecordLogService recordLogService; - - /** - * 鐧诲綍璐︽埛瀵嗙爜閿欒娆℃暟缂撳瓨閿悕 - * - * @param username 鐢ㄦ埛鍚� - * @return 缂撳瓨閿甼ey - */ - private String getCacheKey(String username) - { - return CacheConstants.PWD_ERR_CNT_KEY + username; - } - - public void validate(SysUser user, String password) - { - String username = user.getUserName(); - - Integer retryCount = redisService.getCacheObject(getCacheKey(username)); - - if (retryCount == null) - { - retryCount = 0; - } - - /*if (retryCount >= Integer.valueOf(maxRetryCount).intValue()) - { - String errMsg = String.format("瀵嗙爜杈撳叆閿欒%s娆★紝甯愭埛閿佸畾%s鍒嗛挓", maxRetryCount, lockTime); - recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL,errMsg); - throw new ServiceException(errMsg); - }*/ - - if (!matches(user, password)) - { - retryCount = retryCount + 1; - recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, String.format("瀵嗙爜杈撳叆閿欒%s娆�", retryCount)); - redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES); - throw new ServiceException("鐢ㄦ埛涓嶅瓨鍦�/瀵嗙爜閿欒"); - } - else - { - clearLoginRecordCache(username); - } - } - - public boolean matches(SysUser user, String rawPassword) - { - return SecurityUtils.matchesPassword(rawPassword, user.getPassword()); - } - - public void clearLoginRecordCache(String loginName) - { - if (redisService.hasKey(getCacheKey(loginName))) - { - redisService.deleteObject(getCacheKey(loginName)); - } - } -} diff --git a/se-auth/src/main/java/com/se/auth/service/SysRecordLogService.java b/se-auth/src/main/java/com/se/auth/service/SysRecordLogService.java deleted file mode 100644 index 51c1893..0000000 --- a/se-auth/src/main/java/com/se/auth/service/SysRecordLogService.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.se.auth.service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import com.se.common.core.constant.Constants; -import com.se.common.core.constant.SecurityConstants; -import com.se.common.core.utils.StringUtils; -import com.se.common.core.utils.ip.IpUtils; -import com.se.system.api.RemoteLogService; -import com.se.system.api.domain.SysLogininfor; - -/** - * 璁板綍鏃ュ織鏂规硶 - * - * @author admin - */ -@Component -public class SysRecordLogService -{ - @Autowired - private RemoteLogService remoteLogService; - - /** - * 璁板綍鐧诲綍淇℃伅 - * - * @param username 鐢ㄦ埛鍚� - * @param status 鐘舵�� - * @param message 娑堟伅鍐呭 - * @return - */ - public void recordLogininfor(String username, String status, String message) - { - SysLogininfor logininfor = new SysLogininfor(); - logininfor.setUserName(username); - logininfor.setIpaddr(IpUtils.getIpAddr()); - logininfor.setMsg(message); - // 鏃ュ織鐘舵�� - if (StringUtils.equalsAny(status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, Constants.REGISTER)) - { - logininfor.setStatus(Constants.LOGIN_SUCCESS_STATUS); - } - else if (Constants.LOGIN_FAIL.equals(status)) - { - logininfor.setStatus(Constants.LOGIN_FAIL_STATUS); - } - remoteLogService.saveLogininfor(logininfor, SecurityConstants.INNER); - } -} diff --git a/se-auth/src/main/resources/banner.txt b/se-auth/src/main/resources/banner.txt deleted file mode 100644 index 269848e..0000000 --- a/se-auth/src/main/resources/banner.txt +++ /dev/null @@ -1,3 +0,0 @@ -Spring Boot Version: ${spring-boot.version} -Spring Application Name: ${spring.application.name} -SeAuthApplication锛屽凡缁忓惎鍔� \ No newline at end of file diff --git a/se-auth/src/main/resources/bootstrap.yml b/se-auth/src/main/resources/bootstrap.yml deleted file mode 100644 index 71d5269..0000000 --- a/se-auth/src/main/resources/bootstrap.yml +++ /dev/null @@ -1,28 +0,0 @@ -# Tomcat -server: - port: 9200 - -# Spring -spring: - application: - # 搴旂敤鍚嶇О - name: se-auth - profiles: - # 鐜閰嶇疆 - active: dev - cloud: - nacos: - username: nacos - password: nAcos_!9#_admIn - discovery: - # 鏈嶅姟娉ㄥ唽鍦板潃 - server-addr: 127.0.0.1:8848 - config: - # 閰嶇疆涓績鍦板潃 - server-addr: 127.0.0.1:8848 - # 閰嶇疆鏂囦欢鏍煎紡 - file-extension: yml - # 鍏变韩閰嶇疆 - shared-configs: - - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} -enableEncrypt: true \ No newline at end of file diff --git a/se-auth/src/main/resources/logback.xml b/se-auth/src/main/resources/logback.xml deleted file mode 100644 index f1b8cf8..0000000 --- a/se-auth/src/main/resources/logback.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<configuration scan="true" scanPeriod="60 seconds" debug="false"> - <!-- 鏃ュ織瀛樻斁璺緞 --> - <property name="log.path" value="logs/se-auth" /> - <!-- 鏃ュ織杈撳嚭鏍煎紡 --> - <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" /> - - <!-- 鎺у埗鍙拌緭鍑� --> - <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> - <encoder> - <pattern>${log.pattern}</pattern> - </encoder> - </appender> - - <!-- 绯荤粺鏃ュ織杈撳嚭 --> - <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${log.path}/info.log</file> - <!-- 寰幆鏀跨瓥锛氬熀浜庢椂闂村垱寤烘棩蹇楁枃浠� --> - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <!-- 鏃ュ織鏂囦欢鍚嶆牸寮� --> - <fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern> - <!-- 鏃ュ織鏈�澶х殑鍘嗗彶 60澶� --> - <maxHistory>60</maxHistory> - </rollingPolicy> - <encoder> - <pattern>${log.pattern}</pattern> - </encoder> - <filter class="ch.qos.logback.classic.filter.LevelFilter"> - <!-- 杩囨护鐨勭骇鍒� --> - <level>INFO</level> - <!-- 鍖归厤鏃剁殑鎿嶄綔锛氭帴鏀讹紙璁板綍锛� --> - <onMatch>ACCEPT</onMatch> - <!-- 涓嶅尮閰嶆椂鐨勬搷浣滐細鎷掔粷锛堜笉璁板綍锛� --> - <onMismatch>DENY</onMismatch> - </filter> - </appender> - - <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${log.path}/error.log</file> - <!-- 寰幆鏀跨瓥锛氬熀浜庢椂闂村垱寤烘棩蹇楁枃浠� --> - <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <!-- 鏃ュ織鏂囦欢鍚嶆牸寮� --> - <fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern> - <!-- 鏃ュ織鏈�澶х殑鍘嗗彶 60澶� --> - <maxHistory>60</maxHistory> - </rollingPolicy> - <encoder> - <pattern>${log.pattern}</pattern> - </encoder> - <filter class="ch.qos.logback.classic.filter.LevelFilter"> - <!-- 杩囨护鐨勭骇鍒� --> - <level>ERROR</level> - <!-- 鍖归厤鏃剁殑鎿嶄綔锛氭帴鏀讹紙璁板綍锛� --> - <onMatch>ACCEPT</onMatch> - <!-- 涓嶅尮閰嶆椂鐨勬搷浣滐細鎷掔粷锛堜笉璁板綍锛� --> - <onMismatch>DENY</onMismatch> - </filter> - </appender> - - <!-- 绯荤粺妯″潡鏃ュ織绾у埆鎺у埗 --> - <logger name="com.se" level="info" /> - <!-- Spring鏃ュ織绾у埆鎺у埗 --> - <logger name="org.springframework" level="warn" /> - - <root level="info"> - <appender-ref ref="console" /> - </root> - - <!--绯荤粺鎿嶄綔鏃ュ織--> - <root level="info"> - <appender-ref ref="file_info" /> - <appender-ref ref="file_error" /> - </root> -</configuration> \ No newline at end of file -- Gitblit v1.9.3