diff --git a/src/main/java/com/eactive/eai/authserver/custom/DJErpOAuth2Controller.java b/src/main/java/com/eactive/eai/authserver/custom/DJErpOAuth2Controller.java index 07776a6..b6c47f2 100644 --- a/src/main/java/com/eactive/eai/authserver/custom/DJErpOAuth2Controller.java +++ b/src/main/java/com/eactive/eai/authserver/custom/DJErpOAuth2Controller.java @@ -1,9 +1,11 @@ package com.eactive.eai.authserver.custom; +import java.security.Principal; import java.time.LocalDateTime; import java.util.HashMap; import java.util.HashSet; import java.util.Map; +import java.util.Properties; import java.util.Set; 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.ResponseBody; +import com.eactive.eai.adapter.http.dynamic.UnkownMessageLogUtils; import com.eactive.eai.adapter.http.dynamic.filter.JwtAuthException; import com.eactive.eai.authserver.config.RequestContextData; 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.fasterxml.jackson.databind.ObjectMapper; -import java.security.Principal; - @Controller public class DJErpOAuth2Controller { public static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT); @@ -160,6 +161,12 @@ public class DJErpOAuth2Controller { clientId, grantType, scopes); logger.error(e.getMessage()); 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()); int statusCode = NumberUtils.toInt(StringUtils.left(e.getCode(), 3), HttpStatus.UNAUTHORIZED.value()); return ResponseEntity.status(statusCode).body(errorJson); @@ -169,6 +176,12 @@ public class DJErpOAuth2Controller { clientId, grantType, scopes); logger.error(e.getMessage()); 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]"); return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(errorJson);