일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
- 소스트리
- 반복문
- 싱글톤
- springSecurity
- codingtest
- 시큐리티 로그인
- 리눅스
- 2차원배열
- springboot
- html
- StyleSheet
- programmers
- 목록
- 스프링 부트
- 시큐리티 로그아웃
- sql
- javascript
- 시큐리티로그인
- input태그
- 로그인
- Spring boot
- gradle
- 코딩테스트
- css
- security
- 프로그래머스
- 시큐리티
- java
- Linux
- JAVA11
- Today
- Total
목록lectureNote (73)
JAVAIARY

1. DB 생성 -- 시큐리티 권한 테이블 create table user_auth ( user_id varchar(16) not null, auth varchar(50) not null ); -- 시큐리티 권한테이블 fk생성 alter table user_auth add FOREIGN KEY(user_id) REFERENCES tb_user(user_id) ON DELETE CASCADE; 권한테이블에 아이디에 맞는 권한을 설정해 넣어준다. ex ) -- 관리자 INSERT INTO public.user_auth (user_id, auth) VALUES('admin', 'ROLE_ADMIN'); 2. Mybatis 설정 1) Mapper 생성 select tb_user.user_id, user_pw, ..
@AllArgsConstructor : 모든 변수가 포함된 생성자 @NoArgsConstructor : 변수가 없는 생성자. 기본 생성자 @Builder : 원하는 변수만을 넣어 만든 생성자 @Getter : private 변수를 받아올 수 있게 해주는 getter생성 @Setter : private 변수에 assign 할 수 있게 해주는 setter 생성 @Data : 위 다섯 가지 기능을 모두 가지고 있음 필요에 따라 5가지를 각각 나누어 사용하는 것이 바람직함 (불필요한 getter / setter 남용은 객체 변경의 위험이 있기 때문에 안정성이 떨어짐) 따라서 무조건 @Data를 쓰는 것은 지양하여야 함

1. 로그인 처리 로그인 한 사용자에게 부여된 권한 (Authentication) 객체를 이용해 사용자가 가진 모든 권한을 문자열로 체크하여 사용자가 권한을 가졌다면 로그인 후 바로 권한 페이지로 이동할 수 있게 해 주기 1) AuthenticationSuccessHandler 구현 @Log4j public class CustomLoginSuccessHandler implements AuthenticationSuccessHandler { @Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication auth) throws IOException, Servle..

1. 커스텀 로그인 페이지 1) 로그인 페이지 추가 가지고 있던 로그인 폼을 수정해서 사용하였다. form 태그의 action 속성을 "/login"으로 변경 아이디와 비밀번호를 받는 input 태그의 name 속성을 각각 username 과 password 로 변경 error 와 logout 메시지를 출력해 줄 칸 생성 csrf.token 값 저장을 위한 input 태그 생성 2) CommonController 작성 @GetMapping("/loginForm") public void loginInput(String error, String logout, Model model) { log.info("error: " + error); log.info("logout: " + logout); if (error..

0. 기본 페이지 생성 @Log4j @RequestMapping("/sample/*") @Controller public class SampleController { @GetMapping("/all") public void doAll() { log.info("do all can access everybody"); } @GetMapping("/member") public void doMember() { log.info("logined member"); } @GetMapping("/admin") public void doAdmin() { log.info("admin only"); } } 1. 접근 제한 설정 security-context.xml pattern : uri 패턴 access : 권한 체크 /sa..

1. project 생성 2. 의존성 추가 (pom.xml) ⓐ 스프링 시큐리티 관련 - spring-security-web - spring-security-config - spring-security-core - spring-security-taglibs ⓑ 롬복 - projectlombok org.springframework.security spring-security-web 5.6.0 org.springframework.security spring-security-config 5.6.0 org.springframework.security spring-security-core 5.6.0 org.springframework.security spring-security-taglibs 5.6.0 org.p..
나의 애플리케이션(Client) 소셜로그인(서비스)제공자(Resource Server) (+Authorization Server) 정보 소유자(Resource Server) Client ID : 개발된 애플리케이션 식별 아이디 Client Secret : 개발된 애플리케이션의 비밀번호 Authorized redirect URIs(Callback URL) 1. [리소스 오너]는 [클라이언트]에 접속하고 [클라이언트]는 [리소스오너]에게 소셜 로그인 버튼을 제공 ex. 구글로 로그인하기, 네이버로 로그인하기 등.... 해당 버튼들의 URL은 다음과 같음 https://resource.server/?client_id=클라이언트아이디&scope=접근권한범위2,3&redirect_uri=콜백kurl 2. [리소스..
DAO 클래스는 기본적으로 CRUD만 담당 컨트롤러는 요청을 받으면 처리 명령을 내려주는 담당 그러면 나머지 업무는??? 서비스에서 분리하여 담당하게 된다. 그래서 DAO는 좀더 데이터에 가깝고 단어도 딱딱하다. 비즈니스 로직을 다루는 서비스쪽은 DAO에 비해 메서드명이 사용자 친화적이고, 다양한 일을 한 번에 처리하는데 특화됨. 간단한 로직이라면 DAO클래스만으로도 구현이 가능하겠지만, 한 가지 동작으로 (EX. 계좌 출금) 여러가지 일(EX. 계좌 잔액 계산 및 업데이트, 문자알림 서비스 등 ) 을 처리하려면 비즈니스 로직이 따로 분리된 서비스가 필수가 됨. 예시 DAO package kr.co.heart.dao; import java.util.HashMap; import java.util.List;..