feat: Nice CI DTO - 공개키

dev
gitea-관리자 1 year ago
parent c6a3166183
commit f942f124ff

@ -65,6 +65,17 @@ public class NiceCiService extends EgovAbstractServiceImpl implements INiceCiSer
return webClient.exchange(HOST + API_GENERATE_TOKEN, HttpMethod.POST, JsonUtils.toJson(reqDTO), TokenResponse.class, getHeaderMap());
}
/**
* Authorization : Basic + Base64Encoding(access_token:current_timestamp:client_id)
* - access_token : access_token
* - client_id : access_token client_id
* - current_timestamp
* Date currentDate = new Date();
* long current_timestamp = currentDate.getTime() /1000
* @param token
* @return
*/
public TokenResponse revokeToken(final String token){
Map<String,String> map = new HashMap<>();
map.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE);

@ -3,18 +3,15 @@ package kr.xit.biz.ens.model.nice;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
import java.util.List;
import javax.validation.Valid;
import javax.validation.constraints.Digits;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import kr.xit.biz.common.ApiConstants;
import kr.xit.core.model.IApiResponse;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.hibernate.validator.constraints.Length;
/**
* <pre>
@ -33,20 +30,15 @@ import lombok.experimental.SuperBuilder;
*/
public class NiceCiDTO {
//--------------------------------------------------------------------------------
// 기관용 Token
//--------------------------------------------------------------------------------
/**
* <pre>
* Token(50 )
* url : /digital/niceid/oauth/oauth/token
* content-type : application/x-www-form-urlencoded
* Authorization : Basic + Base64Encoding(access_token:current_timestamp:client_id)
* - access_token : access_token
* - client_id : access_token client_id
* - current_timestamp
* Date currentDate = new Date();
* long current_timestamp = currentDate.getTime() /1000
* </pre>
*/
@Schema(name = "Token", description = "기관용 Token(50년 유효) 발급 요청 파라메터 DTO")
@Schema(name = "TokenRequest", description = "기관용 Token(50년 유효) 발급 요청 파라메터 DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@ -83,23 +75,15 @@ public class NiceCiDTO {
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class TokenResponse implements IApiResponse {
@Schema(requiredMode = RequiredMode.REQUIRED)
private DataHeader dataHeader;
private ResponseDataHeader dataHeader;
@Schema(requiredMode = RequiredMode.REQUIRED)
private DataBody dataBody;
private TokenResDataBody dataBody;
}
/**
* <pre>
* Token
*
* url : /digital/niceid/oauth/oauth/token/revokeById
* Authorization : Basic + Base64Encoding(access_token:current_timestamp:client_id)
* - access_token : access_token
* - client_id : access_token client_id
* - current_timestamp
* Date currentDate = new Date();
* long current_timestamp = currentDate.getTime() /1000
* </pre>
*/
@Schema(name = "TokenRevokeResponse", description = "기관용 Token 폐기 요청 결과 DTO")
@ -111,58 +95,27 @@ public class NiceCiDTO {
public static class TokenRevokeResponse implements IApiResponse {
@Schema(requiredMode = RequiredMode.REQUIRED)
private DataHeader dataHeader;
}
/**
* dataHeader
*/
@Schema(name = "DataHeader", description = "TokenResponse dataHeader DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class DataHeader {
/**
*
* : 1200,
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "응답코드", example = "1200")
@NotBlank
private String GW_RSLT_CD;
/**
*
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "응답메세지", example = "오류없음")
@NotBlank
private String GW_RSLT_MSG;
/**
* TRAN_ID
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "TRAN_ID", example = "20230906120000")
private String TRAN_ID;
private ResponseDataHeader dataHeader;
}
/**
* dataHeader
* dataBody
*/
@Schema(name = "DataBody", description = "TokenResponse dataBody DTO")
@Schema(name = "TokenResDataBody", description = "TokenResponse dataBody DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class DataBody {
public static class TokenResDataBody {
//-----------------------------------------------------------------------
// 토근 발급 요청시 필수
// 토근 발급 요청시 필수값
//-----------------------------------------------------------------------
/**
* <pre>
* : token
* API access_token
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "사용자 엑세스 토큰 값", example = " ")
@NotBlank
@ -184,15 +137,17 @@ public class NiceCiDTO {
private int expires_in;
/**
* <pre>
* scope : token
* : default
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "요청한 scope 값", example = "default")
@NotBlank
private String scope;
//-----------------------------------------------------------------------
// 토큰 폐기 요청시 필수
// 토큰 폐기 요청시 필수
//-----------------------------------------------------------------------
/**
* token
@ -202,4 +157,223 @@ public class NiceCiDTO {
@NotBlank
private boolean result;
}
//--------------------------------------------------------------------------------
// 기관용 Token
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
// 공개키 : publickey
//--------------------------------------------------------------------------------
/**
* <pre>
*
* </pre>
*/
@Schema(name = "PublickeyRequest", description = "공개키 요청 파라메터 DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class PublickeyRequest {
@Schema(requiredMode = RequiredMode.REQUIRED)
private RequestDataHeader dataHeader;
/**
* clinet_credentials
*/
@Schema(requiredMode = RequiredMode.REQUIRED)
private PublickeyReqDataBody grant_type;
}
/**
* <pre>
*
* </pre>
*/
@Schema(name = "PublickeyResponse", description = "공개키 발급 요청 결과 DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class PublickeyResponse implements IApiResponse {
@Schema(requiredMode = RequiredMode.REQUIRED)
private ResponseDataHeader dataHeader;
@Schema(requiredMode = RequiredMode.REQUIRED)
private PublickeyResDataBody dataBody;
}
/**
* Request dataHeader
*/
@Schema(name = "PublickeyReqDataBody", description = "Publickey Request DataBody DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class PublickeyReqDataBody {
/**
* (YYYYMMDDHH24MISS)
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "공개키 요청일시", example = "2023090612122259")
@Size(min = 14, max = 14, message = "요청일시(req_dtim)는 필수 입니다(14자리)")
private String req_dtim;
}
@Schema(name = "PublickeyResDataBody", description = "Publickey Response dataBody DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class PublickeyResDataBody {
/**
* dataBody (P000 , ) : 8
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "정상처리여부", example = "P000")
private String rsp_cd;
/**
* <pre>
* rsp_cd "EAPI"
* 200
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "res_msg", example = " ")
private String rsp_msg;
/**
* <pre>
* rsp_cd P000 : 4
* - 0000:
* - 0001:
* - 0003:
* - 0099:
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "res_msg", example = "0000")
private String result_cd;
/**
* <pre>
* : 16
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "사이트코드", example = " ")
private String site_code;
/**
* <pre>
* : 50
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "공개키버전", example = " ")
private String key_version;
/**
* <pre>
* : 1000
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "공개키", example = " ")
private String public_key;
/**
* <pre>
* (YYYYMMDDHH24MISS) : 14
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "공개키만료일시", example = "0000")
private String valid_dtim;
}
//--------------------------------------------------------------------------------
// 공개키 : publickey
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
/**
* Request dataHeader
*/
@Schema(name = "RequestDataHeader", description = "RequestDataHeader dataHeader DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class RequestDataHeader {
/**
* <pre>
* TRAN_ID : return
* : 24
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "TRAN_ID", example = "20230906120000")
@Max(value = 24, message = "TRAN_ID는 24자를 넘을 수 없습니다.")
private String TRAN_ID;
/**
* CNTY_ID : return
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "CNTY_ID", example = "kr")
@Max(value = 2, message = "CNTY_ID는 2자를 넘을 수 없습니다.")
private String CNTY_ID;
}
/**
* Response dataHeader
*/
@Schema(name = "ResponseDataHeader", description = "ResponseDataHeader dataHeader DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class ResponseDataHeader {
/**
* <pre>
* : 4
* : 1200,
* </pre>
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "응답코드", example = "1200")
@NotBlank
private String GW_RSLT_CD;
/**
* : 200
*/
@Schema(requiredMode = RequiredMode.REQUIRED, title = "응답메세지", example = "오류없음")
@Size(min = 1, max = 200)
private String GW_RSLT_MSG;
/**
* <pre>
* TRAN_ID : return
* : 24
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "TRAN_ID", example = "20230906120000")
private String TRAN_ID;
/**
* <pre>
* CNTY_ID : return
* 2
* </pre>
*/
@Schema(requiredMode = RequiredMode.AUTO, title = "CNTY_ID", example = "kr")
private String CNTY_ID;
}
}

Loading…
Cancel
Save