토큰 발급 실패 오류 추가 - 미확인오류추가
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
package com.eactive.eai.authserver.custom;
|
package com.eactive.eai.authserver.custom;
|
||||||
|
|
||||||
|
import java.security.Principal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@@ -28,6 +30,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import com.eactive.eai.adapter.http.dynamic.UnkownMessageLogUtils;
|
||||||
import com.eactive.eai.adapter.http.dynamic.filter.JwtAuthException;
|
import com.eactive.eai.adapter.http.dynamic.filter.JwtAuthException;
|
||||||
import com.eactive.eai.authserver.config.RequestContextData;
|
import com.eactive.eai.authserver.config.RequestContextData;
|
||||||
import com.eactive.eai.authserver.dao.TokenIssuanceLogDAO;
|
import com.eactive.eai.authserver.dao.TokenIssuanceLogDAO;
|
||||||
@@ -42,8 +45,6 @@ import com.eactive.eai.common.util.UUID;
|
|||||||
import com.eactive.eai.data.entity.onl.authserver.TokenIssuanceLog;
|
import com.eactive.eai.data.entity.onl.authserver.TokenIssuanceLog;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
import java.security.Principal;
|
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class DJErpOAuth2Controller {
|
public class DJErpOAuth2Controller {
|
||||||
public static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
public static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||||
@@ -160,6 +161,12 @@ public class DJErpOAuth2Controller {
|
|||||||
clientId, grantType, scopes);
|
clientId, grantType, scopes);
|
||||||
logger.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
logTokenIssuance(false, false, e.getMessage(), null);
|
logTokenIssuance(false, false, e.getMessage(), null);
|
||||||
|
|
||||||
|
Properties logProp = new Properties();
|
||||||
|
logProp.put("clientId", clientId);
|
||||||
|
UnkownMessageLogUtils.logUnkownMessage(this.getClass().getSimpleName(), this.getClass().getSimpleName(),
|
||||||
|
tokenRequest.toString(), logProp, request, response, "RECEAIIRP301", e);
|
||||||
|
|
||||||
String errorJson = MessageUtil.makeJsonErrorMessage(MessageUtil.ERROR_CODE_AUTH_FAIL, e.getMessage());
|
String errorJson = MessageUtil.makeJsonErrorMessage(MessageUtil.ERROR_CODE_AUTH_FAIL, e.getMessage());
|
||||||
int statusCode = NumberUtils.toInt(StringUtils.left(e.getCode(), 3), HttpStatus.UNAUTHORIZED.value());
|
int statusCode = NumberUtils.toInt(StringUtils.left(e.getCode(), 3), HttpStatus.UNAUTHORIZED.value());
|
||||||
return ResponseEntity.status(statusCode).body(errorJson);
|
return ResponseEntity.status(statusCode).body(errorJson);
|
||||||
@@ -169,6 +176,12 @@ public class DJErpOAuth2Controller {
|
|||||||
clientId, grantType, scopes);
|
clientId, grantType, scopes);
|
||||||
logger.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
logTokenIssuance(false, false, e.getMessage(), null);
|
logTokenIssuance(false, false, e.getMessage(), null);
|
||||||
|
|
||||||
|
Properties logProp = new Properties();
|
||||||
|
logProp.put("clientId", clientId);
|
||||||
|
UnkownMessageLogUtils.logUnkownMessage(this.getClass().getSimpleName(), this.getClass().getSimpleName(),
|
||||||
|
tokenRequest.toString(), logProp, request, response, "RECEAIIRP301", e);
|
||||||
|
|
||||||
String errorJson = MessageUtil.makeJsonErrorMessage(MessageUtil.ERROR_CODE_AUTH_FAIL, "Unauthorized. [Unknown]");
|
String errorJson = MessageUtil.makeJsonErrorMessage(MessageUtil.ERROR_CODE_AUTH_FAIL, "Unauthorized. [Unknown]");
|
||||||
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(errorJson);
|
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(errorJson);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user