728x90 반응형 전체 글195 [Spring Security5] SecurityFilterChain, Filter 이중 호출 해결 (Filter disabled) Multiple HttpSecurity 구성에서 서비스를 이동할 때, 각 서비스에서 사용하는 권한으로 변경하는 필터 AuthorityChangeFilter를 등록하려고 합니다.<p id="SE-cd093979-c8b7-433d-a3ce-f7414916109f" dat.. 2020. 10. 31. [Spring Security5] Multiple HttpSecurity, Multiple Login, accessDenied 설정 한 프로젝트에 여러 개 서비스가 있을 경우, 로그인 화면이 두 개 이상인 경우 다음과 같이 구성합니다.MultipleSecurityConfiguration.java (<a href="https://docs.spring.io/spring-security/site/docs/4.1.5... 2020. 10. 31. [Java8] 중복 데이터 제거를 위한 Stream distinct 중복 데이터를 제거하기 위해 Stream distinct를 사용합니다. 동일한 객체의 판단하는 기준은 Object.equals(Object)의 결과 값이다. String 객체의 경우 equals()가 이미 구현되어 있습니다. - Stream.distinct() : Returns a stream consisting of the distinct elements (according to Object.equals(Object)) of this stream. List strings = Arrays.asList("hello", "world", "hello", "java", "hello"); strings.stream().distinct().forEach(System.out::println); // "hello".. 2020. 10. 31. [SpringBoot] Jackson JsonAlias 설정 및 x-www-form-urlencoded 문제 해결 JsonAlias를 사용하기위해 pom.xml에 Jackson lib를 추가합니다. org.springframework.boot spring-boot-starter-web com.fasterxml.jackson.core jackson-databind com.fasterxml.jackson.core jackson-annotations 2.9.9 com.fasterxml.jackson.core jackson-databind 2.9.9 com.fasterxml.jackson.core jackson-core 2.9.9 @JsonAlias 사용법 @Data public class UserVO { @JsonAlias(value = {"name", "userNm", "userName"} private String n.. 2020. 10. 31. [java] StringBuffer getChars (Chars to String) https://www.tutorialspoint.com/java/lang/stringbuffer_getchars.htm Java.lang.StringBuffer.getChars() Method - Tutorialspoint Java.lang.StringBuffer.getChars() Method Description The java.lang.StringBuffer.getChars() method copy the characters from this sequence into the destination character array dst. The first character to be copied is at index srcBegin. The last character to www.tutorialspoin.. 2020. 10. 31. [spring] @ResponseBody Annotation vs ResponseEntity @ResponseBody annotation을 사용하면 스프링이 반환 객체를 http response body로 변환합니다. ResponseEntity는 @ResponseBody annotation과 유사하게 작동합니다. 그러나 ResponseEntity 객체를 생성할 때 response header를 http response에 추가할 수도 있습니다. responseEntity를 반환 객체로 사용하는 경우 @ResponseBody annotation을 사용할 필요가 없습니다. 예제) @ResponseBody annotation 사용 @ResponseBody @RequestMapping("/getData") public ResJsonVO getData(DataVO param) { try { return t.. 2020. 10. 31. [spring] @Valid를 이용한 validation 체크와 custom annotation으로 validation 1. Valid annotation을 이용한 validation 체크 우선, VO 클래스의 필드에 Validation을 체크하도록 annotation을 설정합니다. 예) @NotEmpty, @Length 등 @Data @EqualsAndHashCode(callSuper = false) public class SiriVO extends PagingCommonVO { private long siriId; @NotEmpty(message = "제목을 입력해주세요.") @Length(min = 0, max = 100, message = "The maximum length of the title value is 100. ") private String title; @CodeValid(message = "사용여부를.. 2020. 10. 31. [java] 임시 비밀번호 생성 (Random vs SecureRandom vs RandomStringUtils) java.util.Random 클래스는 난수를 생성할 때 seed값으로 시간을 이용합니다. 그래서 동일한 시간에 Random 클래스를 사용하여 난수를 사용하면 동일한 값이 리턴됩니다. 예측 가능한 난수를 사용하는 경우 공격자가 SW에서 생성되는 다음 숫자를 예상하여 시스템을 공격할 수 있습니다. 시큐어코딩 가이드 - SW 보안약점 47개 항목 중 적절하지 않은 난수 값 사용 (Use of Insufficiently Random Values)에 해당됩니다. 반면에 java.security.SecureRandom 클래스는 예측할 수 없는 seed를 이용하여 강력한 난수를 생성합니다. 임시 비밀번호 생성 getRamdomPassword(10)를 호출하면 10 글자의 임시비밀번호가 생성됩니다. import ja.. 2020. 10. 31. [MySQL] 다중 테이블 삭제 (join + delete) Delete 쿼리문으로 다수의 테이블의 데이터를 삭제하는 방법을 알아보겠습니다. 1. 테이블 A의 데이터만 삭제 DELETE FROM a USING tableA AS a LEFT JOIN tableB AS b ON a.id = b.id WHERE b.컬럼 = '값' 2. 테이블 B의 데이터만 삭제 DELETE FROM b USING tableA AS a LEFT JOIN tableB AS b ON a.id = b.id WHERE b.컬럼 = '값' 3. 테이블 A, B의 데이터 모두 삭제 DELETE FROM a, b USING tableA AS a LEFT JOIN tableB AS b ON a.id = b.id WHERE b.컬럼 = '값' 2020. 10. 31. [flutter] 앱에서 네트워크 연결 확인 : connectivity 앱에서 네트워크 연결을 확인 하기 위해 connectivity package를 사용합니다. 1. pubspec.yaml 파일에 패키지를 등록 dependencies: connectivity: ^0.4.9+5 pubspec.yaml에 등록 후 flutter pub get 합니다. 2. Import pacakge in Dart code import 'package:connectivity/connectivity.dart'; 예제 코드) import 'dart:io'; import 'package:connectivity/connectivity.dart'; Future checkConnectionStatus() async { var result = await (Connectivity().checkConnectiv.. 2020. 10. 16. 이전 1 ··· 13 14 15 16 17 18 19 20 다음 728x90 반응형