代码说明
This commit is contained in:
@ -68,6 +68,13 @@ public class LiuChengController {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//治安审查
|
||||||
@PostMapping("/liucheng")
|
@PostMapping("/liucheng")
|
||||||
public String tuisong(@RequestBody JSONObject datass) {
|
public String tuisong(@RequestBody JSONObject datass) {
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class TongBu {
|
public class TongBu {
|
||||||
|
//dp费税计划
|
||||||
@Scheduled(cron = "0 0 2 26 * ?") // 设置cron表达式,表示在每个月26号凌晨一点触发任务
|
@Scheduled(cron = "0 0 2 26 * ?") // 设置cron表达式,表示在每个月26号凌晨一点触发任务
|
||||||
public static void mains() {
|
public static void mains() {
|
||||||
/*JSONObject jsonObject = new JSONObject();
|
/*JSONObject jsonObject = new JSONObject();
|
||||||
|
|||||||
@ -1,44 +0,0 @@
|
|||||||
package com.example.sso.service;
|
|
||||||
|
|
||||||
import com.auth0.jwt.JWT;
|
|
||||||
import com.auth0.jwt.JWTVerifier;
|
|
||||||
import com.auth0.jwt.algorithms.Algorithm;
|
|
||||||
import com.auth0.jwt.interfaces.DecodedJWT;
|
|
||||||
import com.example.sso.config.SSOConfig;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class SSOService {
|
|
||||||
@Getter @Setter @Autowired private SSOConfig ssoConfig;
|
|
||||||
public String getResponse(String request, String username, HttpSession httpSession) {
|
|
||||||
Algorithm algorithm = Algorithm.HMAC256((String) httpSession.getAttribute("sso_secret"));
|
|
||||||
JWTVerifier verifier = JWT.require(algorithm)
|
|
||||||
.withIssuer("com.jiandaoyun")
|
|
||||||
.build();
|
|
||||||
DecodedJWT decoded = verifier.verify(request);
|
|
||||||
if (!"sso_req".equals(decoded.getClaim("type").asString())) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
|
||||||
calendar.setTime(new Date());
|
|
||||||
calendar.add(Calendar.HOUR_OF_DAY, 1);
|
|
||||||
return JWT.create()
|
|
||||||
.withIssuer("com.jiandaoyun")
|
|
||||||
.withClaim("type", "sso_res")
|
|
||||||
.withClaim("username", username)
|
|
||||||
.withAudience("com.jiandaoyun")
|
|
||||||
.withExpiresAt(calendar.getTime())
|
|
||||||
.sign(algorithm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user