diff --git a/mens-api/src/main/java/kr/xit/ens/kt/service/KtMmsService.java b/mens-api/src/main/java/kr/xit/ens/kt/service/KtMmsService.java index bc54dae..f4711f9 100644 --- a/mens-api/src/main/java/kr/xit/ens/kt/service/KtMmsService.java +++ b/mens-api/src/main/java/kr/xit/ens/kt/service/KtMmsService.java @@ -1,5 +1,6 @@ package kr.xit.ens.kt.service; +import java.net.URLEncoder; import java.util.HashMap; import java.util.Map; import kr.xit.biz.ens.model.cmm.CmmEnsRlaybsnmDTO; @@ -162,18 +163,18 @@ public class KtMmsService extends EgovAbstractServiceImpl implements IKtMmsServi public KtTokenResponse requestToken(final KtMnsRequest paramDTO) { final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(paramDTO.getSignguCode(), paramDTO.getFfnlgCode()); final KtTokenRequest reqDTO = KtTokenRequest.builder() - .clientId(ktMnsInfo.getKtClientId()) - //.clientId(ktMnsInfo.getKtSvcClientId()) - .clientSecret(ktMnsInfo.getKtSvcClientSecret()) - .scope(ktMnsInfo.getKtScope()) + //.clientId(ktMnsInfo.getKtClientId()) + .clientId(URLEncoder.encode(ktMnsInfo.getKtSvcClientId())) + .clientSecret(URLEncoder.encode(ktMnsInfo.getKtSvcClientSecret())) + .scope(URLEncoder.encode(ktMnsInfo.getKtScope())) .build(); CmmEnsUtils.validate(reqDTO); final Map headerMap = new HashMap<>(); headerMap.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE); // headerMap.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE); -// headerMap.put("client-id", "client-id"); -// headerMap.put("client-tp", "10"); + headerMap.put("client-id", ktMnsInfo.getKtClientId()); + headerMap.put("client-tp", ktMnsInfo.getKtClientTp()); // headerMap.put(HttpHeaders.AUTHORIZATION, String.format("%s %s", AUTH_TYPE_BEARER, "access-token")); return webClient.exchange( diff --git a/mens-api/src/main/resources/config/application-ens.yml b/mens-api/src/main/resources/config/application-ens.yml index 253aac6..bedd55e 100644 --- a/mens-api/src/main/resources/config/application-ens.yml +++ b/mens-api/src/main/resources/config/application-ens.yml @@ -40,7 +40,7 @@ contract: kt: dummy: true # vpn 사용 -# host: http://172.16.0.13:10210/ONLWeb + #host: http://172.16.0.13:10210/ONLWeb # 공인 IP host: http://211.43.10.163:10210/ONLWeb # 운영 diff --git a/mens-core/src/main/java/kr/xit/biz/ens/model/cmm/CmmEnsRequestDTO.java b/mens-core/src/main/java/kr/xit/biz/ens/model/cmm/CmmEnsRequestDTO.java index b020777..b92a186 100644 --- a/mens-core/src/main/java/kr/xit/biz/ens/model/cmm/CmmEnsRequestDTO.java +++ b/mens-core/src/main/java/kr/xit/biz/ens/model/cmm/CmmEnsRequestDTO.java @@ -6,7 +6,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema.RequiredMode; import java.io.Serializable; -import javax.validation.constraints.NotEmpty; import javax.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Data; @@ -54,8 +53,7 @@ public class CmmEnsRequestDTO implements Serializable { /** * active profile */ - @Schema(requiredMode = RequiredMode.REQUIRED, title = "profile", example = "dev") - @NotEmpty(message = "profile은 필수 입니다.") + @Schema(requiredMode = RequiredMode.AUTO, title = "profile", example = "dev") @JsonProperty("profile") - private String profile = "prod"; + private String profile; } diff --git a/mens-core/src/main/java/kr/xit/biz/ens/model/kt/KtTokenDTO.java b/mens-core/src/main/java/kr/xit/biz/ens/model/kt/KtTokenDTO.java index 0f57ce2..f4e930e 100644 --- a/mens-core/src/main/java/kr/xit/biz/ens/model/kt/KtTokenDTO.java +++ b/mens-core/src/main/java/kr/xit/biz/ens/model/kt/KtTokenDTO.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.PropertyNamingStrategies; import com.fasterxml.jackson.databind.annotation.JsonNaming; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema.RequiredMode; +import java.net.URLEncoder; import javax.validation.constraints.Size; import kr.xit.biz.ens.model.kt.KtCommonDTO.KtCommonResponse; import kr.xit.core.model.IApiResponse; @@ -68,7 +69,7 @@ public class KtTokenDTO { @Schema(requiredMode = RequiredMode.REQUIRED, title = "권한부여방식", example = "clinet_credentials") @NotEmpty(message = "권한부여방식은 필수 입니다") @Size(max = 100) - private String grantType = "clinet_credentials"; + private String grantType = URLEncoder.encode("client_credentials"); /** * 과태료 코드 @@ -95,7 +96,7 @@ public class KtTokenDTO { @Schema(requiredMode = RequiredMode.REQUIRED, title = "권한범위", example = "ag.api") @NotEmpty(message = "권한범위는 필수 입니다") @Length(max = 100) - private String scope = "ag.api"; + private String scope = URLEncoder.encode("ag.api"); } @Schema(name = "KtTokenResponse", description = "KT MMS 토큰발행 요청 결과 DTO")