소스 정리
parent
7a16c87bc2
commit
ddfbd4f5fc
@ -0,0 +1,44 @@
|
||||
package com.xit.biz.cmm.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.util.stream.Collectors.toMap;
|
||||
|
||||
@AllArgsConstructor
|
||||
public enum AddressType {
|
||||
STREET("STREET"), // 도로명
|
||||
LOT("LOT");
|
||||
// 지번
|
||||
private final String code;
|
||||
|
||||
/**
|
||||
* Serialization을 위해 반드시 필요
|
||||
* 미정의시 JSON parser 에러 발생 - throw HttpMessageNotReadableException
|
||||
* @param symbol String
|
||||
* @return RoleType
|
||||
*/
|
||||
@JsonCreator
|
||||
public static AddressType fromString(String symbol){
|
||||
return stringToEnum.get(symbol);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserialization을 위해 반드시 필요
|
||||
* 미정의시 JSON parser 에러 발생 - throw HttpMessageNotReadableException
|
||||
* @return String
|
||||
*/
|
||||
@JsonValue
|
||||
public String getCode(){
|
||||
return code;
|
||||
}
|
||||
|
||||
private static final Map<String, AddressType> stringToEnum = Stream.of(values())
|
||||
.collect(toMap(Objects::toString, e -> e));
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.xit.biz.sample.ignore;
|
||||
package com.xit.biz.sample._ignore;
|
||||
|
||||
import com.xit.biz.sample.Greeting;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
@ -1,18 +0,0 @@
|
||||
package com.xit.biz.sample.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DefaultDto {
|
||||
private String msg;
|
||||
private boolean result;
|
||||
private List<Integer> stringFlux;
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package com.xit.biz.sample.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class PersonDto {
|
||||
String name;
|
||||
int age;
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
//package com.xit.core.oauth2.config.security;
|
||||
//
|
||||
//import com.xit.core.oauth2.oauth.token.JwtTokenProvider;
|
||||
//import org.springframework.beans.factory.annotation.Value;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//
|
||||
////@Configuration
|
||||
//public class JwtConfig {
|
||||
// @Value("${jwt.secret}")
|
||||
// private String secret;
|
||||
//
|
||||
// @Bean
|
||||
// public JwtTokenProvider jwtProvider() {
|
||||
// return new JwtTokenProvider(secret);
|
||||
// }
|
||||
//}
|
@ -1,4 +1,4 @@
|
||||
package com.xit.core.oauth2.oauth.interceptor;
|
||||
package com.xit.core.oauth2.oauth;
|
||||
|
||||
import com.xit.core.annotation.Secured;
|
||||
import com.xit.core.annotation.SecurityPolicy;
|
@ -1,4 +1,4 @@
|
||||
package com.xit.core.oauth2.oauth.token;
|
||||
package com.xit.core.oauth2.oauth;
|
||||
|
||||
import com.xit.core.constant.ErrorCode;
|
||||
import com.xit.core.constant.XitConstants;
|
@ -1,7 +1,7 @@
|
||||
package com.xit.core.oauth2.oauth.filter;
|
||||
package com.xit.core.oauth2.oauth;
|
||||
|
||||
//import com.xit.core.oauth2.oauth.token.JwtToken;
|
||||
import com.xit.core.oauth2.oauth.token.JwtTokenProvider;
|
||||
import com.xit.core.oauth2.oauth.JwtTokenProvider;
|
||||
import com.xit.core.oauth2.utils.HeaderUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
@ -1,12 +1,12 @@
|
||||
package com.xit.core.oauth2.oauth.exception;
|
||||
|
||||
public class TokenValidFailedException extends RuntimeException {
|
||||
|
||||
public TokenValidFailedException() {
|
||||
super("Failed to generate Token.");
|
||||
}
|
||||
|
||||
private TokenValidFailedException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
//package com.xit.core.oauth2.oauth.exception;
|
||||
//
|
||||
//public class TokenValidFailedException extends RuntimeException {
|
||||
//
|
||||
// public TokenValidFailedException() {
|
||||
// super("Failed to generate Token.");
|
||||
// }
|
||||
//
|
||||
// private TokenValidFailedException(String message) {
|
||||
// super(message);
|
||||
// }
|
||||
//}
|
||||
|
@ -1,92 +0,0 @@
|
||||
//package com.xit.core.oauth2.oauth.token;
|
||||
//
|
||||
//import com.xit.core.constant.XitConstants;
|
||||
//import io.jsonwebtoken.*;
|
||||
//import lombok.Getter;
|
||||
//import lombok.RequiredArgsConstructor;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//
|
||||
//import java.security.Key;
|
||||
//import java.util.Date;
|
||||
//
|
||||
///**
|
||||
// * Token
|
||||
// * SignatureAlgorithm.HS256
|
||||
// *
|
||||
// *
|
||||
// * @see JwtTokenProvider
|
||||
// */
|
||||
//@Slf4j
|
||||
//@RequiredArgsConstructor
|
||||
//public class JwtToken {
|
||||
//
|
||||
// @Getter
|
||||
// private final String token;
|
||||
// private final Key key;
|
||||
//
|
||||
// JwtToken(String id, Date expiry, Key key) {
|
||||
// this.key = key;
|
||||
// this.token = generateJwtRefreshToken(id, expiry);
|
||||
// }
|
||||
//
|
||||
// JwtToken(String id, String role, Date expiry, Key key) {
|
||||
// this.key = key;
|
||||
// this.token = generateJwtAccessToken(id, role, expiry);
|
||||
// }
|
||||
//
|
||||
// private String generateJwtRefreshToken(String id, Date expiry) {
|
||||
// return Jwts.builder()
|
||||
// .setSubject(id)
|
||||
// .signWith(key, SignatureAlgorithm.HS256)
|
||||
// .setExpiration(expiry)
|
||||
// .compact();
|
||||
// }
|
||||
//
|
||||
// private String generateJwtAccessToken(String id, String role, Date expiry) {
|
||||
// return Jwts.builder()
|
||||
// .claim(XitConstants.JwtToken.AUTHORITIES_KEY.getValue(), role)
|
||||
// .setSubject(id)
|
||||
// .signWith(key, SignatureAlgorithm.HS256)
|
||||
// .setExpiration(expiry)
|
||||
// .compact();
|
||||
// }
|
||||
//
|
||||
// public boolean validate() {
|
||||
// return this.getTokenClaims() != null;
|
||||
// }
|
||||
//
|
||||
// public Claims getTokenClaims() {
|
||||
// try {
|
||||
// return Jwts.parserBuilder()
|
||||
// .setSigningKey(key)
|
||||
// .build()
|
||||
// .parseClaimsJws(token)
|
||||
// .getBody();
|
||||
// } catch (SecurityException e) {
|
||||
// log.info("Invalid JWT signature.");
|
||||
// } catch (MalformedJwtException e) {
|
||||
// log.info("Invalid JWT token.");
|
||||
// } catch (ExpiredJwtException e) {
|
||||
// log.info("Expired JWT token.");
|
||||
// } catch (UnsupportedJwtException e) {
|
||||
// log.info("Unsupported JWT token.");
|
||||
// } catch (IllegalArgumentException e) {
|
||||
// log.info("JWT token compact of handler are invalid.");
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public Claims getExpiredTokenClaims() {
|
||||
// try {
|
||||
// Jwts.parserBuilder()
|
||||
// .setSigningKey(key)
|
||||
// .build()
|
||||
// .parseClaimsJws(token)
|
||||
// .getBody();
|
||||
// } catch (ExpiredJwtException e) {
|
||||
// log.info("Expired JWT token.");
|
||||
// return e.getClaims();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//}
|
@ -1,16 +0,0 @@
|
||||
package com.xit.core.support.jpa;
|
||||
|
||||
import com.xit.core.oauth2.oauth.entity.ProviderType;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
public class EnumFindUtils {
|
||||
|
||||
public static ProviderType fromProviderType(String code) {
|
||||
return Arrays.stream(ProviderType.values())
|
||||
.filter(r -> Objects.equals(r.name(), code))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package com.xit.core.support.mybatis.paging.jackson2;
|
||||
|
||||
import com.fasterxml.jackson.core.Version;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
|
||||
import com.xit.core.support.mybatis.paging.domain.PageList;
|
||||
|
||||
/**
|
||||
* Converter의 ObjectMapper 확장
|
||||
* ResponseBody 사용시 호출
|
||||
* Converter 실행시 Paging 정보 추가 return
|
||||
* page, limit(row/page), totalCount, offset(쿼리조회시작row), startRow, prePage, nextPage, endRow, totalPages
|
||||
* boolean 값 : firstPage, lastPage, hasPrePage, hasNextPage
|
||||
* @author minuk
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PageListJsonMapper extends ObjectMapper{
|
||||
|
||||
public PageListJsonMapper() {
|
||||
//JSON data pretty 정렬
|
||||
enable(SerializationFeature.INDENT_OUTPUT);
|
||||
SimpleModule module = new SimpleModule("PageListJSONModule", new Version(1, 0, 0, null, null, null));
|
||||
//module.addSerializer(PageList.class, new PageListJsonSerializer(this));
|
||||
module.addSerializer(PageList.class, new PageListJsonSerializer());
|
||||
registerModule(module);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue