Commit 119aade8 by 刘宇峰

授权服务

1 parent fe6d6842
......@@ -72,7 +72,7 @@ public class AuthController {
throw ResultException.create("请求参数校验不通过");
}
//验证时间戳
long diff = System.currentTimeMillis() - Long.parseLong(request.getTimestamp());
long diff = System.currentTimeMillis() - request.getTimestamp().getTime();
if (diff < 0 || diff > 5 * 60 * 1000L) {
throw ResultException.create("请求参数timestamp不在系统允许的范围内");
}
......@@ -87,7 +87,7 @@ public class AuthController {
}
}
//验证签名
String signedParams = gatewayService.getAppKey() + gatewayService.getSecret() + request.getTimestamp() + gatewayService.getSecret();
String signedParams = gatewayService.getAppKey() + gatewayService.getSecret() + DateUtils.formatNormal(request.getTimestamp()) + gatewayService.getSecret();
String sign = MD5Util.convert32(signedParams).toLowerCase();
log.info("签名参数:{}", signedParams);
log.info("生成签名:{}", sign);
......
package cn.com.glsx.auth.modules.request;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.util.Date;
/**
* @author huangch
......@@ -25,7 +27,8 @@ public class QueryAccessTokenRequest {
private String sign;
@NotBlank(message = "timestamp不能为空")
private String timestamp;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date timestamp;
private String grantType;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!