Commit 9d7d1c65 authored by maqing's avatar maqing

获取token解密失败问题

parent 5b82c8d8
...@@ -3,6 +3,7 @@ package com.hungraim.ltc.controller; ...@@ -3,6 +3,7 @@ package com.hungraim.ltc.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hungraim.ltc.util.CsoftSecurityUtil; import com.hungraim.ltc.util.CsoftSecurityUtil;
import com.hungraim.ltc.util.Result; import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
...@@ -24,6 +25,8 @@ import java.util.Map; ...@@ -24,6 +25,8 @@ import java.util.Map;
@AllArgsConstructor @AllArgsConstructor
public class AuthController { public class AuthController {
final static String FALSE="false";
private final RedisTemplate redisTemplate; private final RedisTemplate redisTemplate;
private final TokenEndpoint tokenEndpoint; private final TokenEndpoint tokenEndpoint;
...@@ -31,6 +34,9 @@ public class AuthController { ...@@ -31,6 +34,9 @@ public class AuthController {
@SneakyThrows @SneakyThrows
public Result<OAuth2AccessToken> postAccessToken(Principal principal, @RequestParam Map<String, String> parameters) { public Result<OAuth2AccessToken> postAccessToken(Principal principal, @RequestParam Map<String, String> parameters) {
String password = parameters.get("password"); String password = parameters.get("password");
if(FALSE.equals(password)){
return Result.failed(ResultCode.USER_LOGIN_ERROR);
}
String decrypt = CsoftSecurityUtil.decryptRSADefault(password); String decrypt = CsoftSecurityUtil.decryptRSADefault(password);
parameters.put("password", decrypt); parameters.put("password", decrypt);
OAuth2AccessToken oAuth2AccessToken = tokenEndpoint.postAccessToken(principal, parameters).getBody(); OAuth2AccessToken oAuth2AccessToken = tokenEndpoint.postAccessToken(principal, parameters).getBody();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment