代码说明

This commit is contained in:
lijiazhuo
2025-11-27 17:27:06 +08:00
parent 63d7031374
commit e71e02a733
3 changed files with 8 additions and 44 deletions

View File

@ -68,6 +68,13 @@ public class LiuChengController {
// }
//治安审查
@PostMapping("/liucheng")
public String tuisong(@RequestBody JSONObject datass) {

View File

@ -11,6 +11,7 @@ import org.springframework.stereotype.Component;
@Component
public class TongBu {
//dp费税计划
@Scheduled(cron = "0 0 2 26 * ?") // 设置cron表达式表示在每个月26号凌晨一点触发任务
public static void mains() {
/*JSONObject jsonObject = new JSONObject();

View File

@ -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);
}
}