| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
- 시큐리티
- input태그
- 시큐리티 로그인
- springSecurity
- Linux
- 로그인
- security
- java
- 코딩테스트
- 리눅스
- gradle
- javascript
- springboot
- 소스트리
- programmers
- 시큐리티로그인
- StyleSheet
- 시큐리티 로그아웃
- JAVA11
- 싱글톤
- 목록
- Spring boot
- html
- css
- 스프링 부트
- 2차원배열
- sql
- codingtest
- 반복문
- 프로그래머스
- Today
- Total
목록lectureNote (75)
JAVAIARY
표현식 설명 hasRole( [role] ) hasAuthority( [authority] ) 해당 권한이 있으면 true hasAnyRole( [role,role2]) hasAnyAuthority([authority]) 여러 권한들 중에서 하나라도 해당하는 권한이 있으면 true principal 현재 사용자 정보를 의미 permitAll 모든 사용자에게 허용 denyAll 모든 사용자에게 거부 isAnomymous( ) 익명의 사용자의 경우(로그인을 하지 않은 경우도 해당) isAuthenticated( ) 인증된 사용자면 true isFullyAuthenticated( ) Remember-me로 인증된 것이 아닌 인증된 사용자인 경우 true 대부분 true/false 리턴 조건문 형식과 비슷 /s..
1. taglib 추가 2. 불러올 정보 태그로 불러오기 admin.jsp /sample/admin page principal : MemberVO : 사용자이름 : 사용자아이디 : 사용자 권한 리스트 : 로그아웃 property="principal.member"를 통해 반환되는 것은 UserDetailsService에서 반환된 객체 = CustomUserDetailsService 에서 dto를 담아 반환된 (생성된)CustomUser() 객체 @Override public UserDetails loadUserByUsername(String user_id) throws UsernameNotFoundException { MemberDto dto=null; log.warn("Load User By UserNa..
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..