-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update springboot and springcloud version and add generator plateform
- Loading branch information
Showing
191 changed files
with
9,202 additions
and
6,827 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
.history | ||
.idea | ||
target | ||
node_modules | ||
.DS_Store | ||
dist | ||
dist-ssr | ||
*.local | ||
target | ||
*.iml | ||
yarn* | ||
pnpm* | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"> | ||
<parent> | ||
<artifactId>micro-service-plus</artifactId> | ||
<groupId>top.kuanghua</groupId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>auth-pom</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>top.kuanghua</groupId> | ||
<artifactId>common-pom</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.jsonwebtoken</groupId> | ||
<artifactId>jjwt</artifactId> | ||
<version>0.9.0</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.github.xiaoymin</groupId> | ||
<artifactId>knife4j-aggregation-spring-boot-starter</artifactId> | ||
<version>2.0.9</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
128 changes: 64 additions & 64 deletions
128
...ua/tyauth/controller/TokenController.java → ...a/authpom/controller/TokenController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,64 @@ | ||
package top.kuanghua.tyauth.controller; | ||
|
||
import io.jsonwebtoken.Claims; | ||
import io.swagger.annotations.Api; | ||
import io.swagger.annotations.ApiOperation; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.*; | ||
import top.kuanghua.khcomomon.entity.ResResult; | ||
import top.kuanghua.tyauth.service.TokenService; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* @Title: TokenController | ||
* @Description: | ||
* @Auther: kuanghua | ||
* @create 2021/1/31 16:31 | ||
*/ | ||
|
||
@RestController | ||
@RequestMapping("token") | ||
@Api(tags = "token相关") | ||
@Slf4j | ||
public class TokenController { | ||
|
||
@Autowired | ||
private TokenService tokenService; | ||
|
||
/* | ||
* 解析token | ||
* */ | ||
@ApiOperation("获取token信息") | ||
@PostMapping("parseToken") | ||
public ResResult parseToken(@RequestParam("jwtToken") String jwtToken) { | ||
Claims claims = this.tokenService.parseToken(jwtToken); | ||
return new ResResult().success(claims); | ||
} | ||
|
||
/* | ||
* 生成token | ||
* */ | ||
@ApiOperation("生成token") | ||
@PostMapping("generateToken") | ||
//@RequestHeader("authorize_token") String authorize_token | ||
public ResResult generateToken(@RequestBody Map tokenMap) { | ||
String generateToken = this.tokenService.generateToken(tokenMap); | ||
return new ResResult().success(generateToken); | ||
} | ||
|
||
/* | ||
* 更新token | ||
* */ | ||
@ApiOperation("更新token") | ||
@PostMapping("updateToken") | ||
public ResResult updateToken(@RequestBody Map map) { | ||
String updateToken = this.tokenService.updateToken(map); | ||
// System.out.println("生成信息的token"+updateToken); | ||
// System.out.println("生成信息的token"+map.toString()); | ||
return new ResResult().success(updateToken); | ||
} | ||
} | ||
|
||
package top.kuanghua.authpom.controller; | ||
|
||
import io.jsonwebtoken.Claims; | ||
import io.swagger.annotations.Api; | ||
import io.swagger.annotations.ApiOperation; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.*; | ||
import top.kuanghua.authpom.service.TokenService; | ||
import top.kuanghua.commonpom.entity.ResResult; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* @Title: TokenController | ||
* @Description: | ||
* @Auther: kuanghua | ||
* @create 2021/1/31 16:31 | ||
*/ | ||
|
||
@RestController | ||
@RequestMapping("token") | ||
@Api(tags = "token相关") | ||
@Slf4j | ||
public class TokenController { | ||
|
||
@Autowired | ||
private TokenService tokenService; | ||
|
||
/* | ||
* 解析token | ||
* */ | ||
@ApiOperation("获取token信息") | ||
@PostMapping("parseToken") | ||
public ResResult parseToken(@RequestParam("jwtToken") String jwtToken) { | ||
Claims claims = this.tokenService.parseToken(jwtToken); | ||
return new ResResult().success(claims); | ||
} | ||
|
||
/* | ||
* 生成token | ||
* */ | ||
@ApiOperation("生成token") | ||
@PostMapping("generateToken") | ||
//@RequestHeader("authorize_token") String authorize_token | ||
public ResResult generateToken(@RequestBody Map tokenMap) { | ||
String generateToken = this.tokenService.generateToken(tokenMap); | ||
return new ResResult().success(generateToken); | ||
} | ||
|
||
/* | ||
* 更新token | ||
* */ | ||
@ApiOperation("更新token") | ||
@PostMapping("updateToken") | ||
public ResResult updateToken(@RequestBody Map map) { | ||
String updateToken = this.tokenService.updateToken(map); | ||
// System.out.println("生成信息的token"+updateToken); | ||
// System.out.println("生成信息的token"+map.toString()); | ||
return new ResResult().success(updateToken); | ||
} | ||
} | ||
|
||
|
50 changes: 50 additions & 0 deletions
50
auth-pom/src/main/java/top/kuanghua/authpom/service/TokenService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package top.kuanghua.authpom.service; | ||
|
||
import io.jsonwebtoken.Claims; | ||
import org.springframework.stereotype.Service; | ||
import top.kuanghua.authpom.utils.JwtUtilsSelf; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* @Title: TokenService | ||
* @Description: | ||
* @Auther: kuanghua | ||
* @create 2021/1/31 16:19 | ||
*/ | ||
@Service | ||
public class TokenService { | ||
|
||
private static final String AUTHORIZE_TOKEN = "AUTHORIZE_TOKEN"; | ||
|
||
public String generateToken(Map map) { | ||
try { | ||
return JwtUtilsSelf.createJWT(map, null); | ||
} catch (Exception e) { | ||
throw new RuntimeException("token生成有误"); | ||
} | ||
} | ||
|
||
/* | ||
* 更新token | ||
* */ | ||
public String updateToken(Map map) { | ||
try { | ||
String updateToken = JwtUtilsSelf.createJWT(map, null); | ||
return updateToken; | ||
} catch (Exception e) { | ||
throw new RuntimeException("token更新有误"); | ||
} | ||
} | ||
/* | ||
* 解析token | ||
* */ | ||
public Claims parseToken(String jwtToken) { | ||
try { | ||
Claims claims = JwtUtilsSelf.parseJWT(jwtToken); | ||
return claims; | ||
} catch (Exception e) { | ||
throw new RuntimeException("token解析错误"); | ||
} | ||
} | ||
} |
Oops, something went wrong.