-
Notifications
You must be signed in to change notification settings - Fork 0
Spring Security를 이용하여 로그인/로그아웃 기능 추가 #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
EunJuOh33
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
에러나서 수정함
| @Override | ||
| public void configure(AuthenticationManagerBuilder auth) throws Exception { | ||
| .antMatchers("/samplesecurity/all").permitAll() | ||
| .antMatchers("/samplesecurity/admin").access("hasRole('ROLE_ADMIN')") | ||
| .antMatchers("/samplesecurity/member").access("hasRole('ROLE_MEMBER')"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all 경로는 접근 제한 없음
admin 경로는 'ROLE_ADMIN' 라는 권한이 있는 사용자만 접근 가능
member 경로는 'ROLE_MEMBER'라는 권한이 있는 사용자만 접근 가능
| import lombok.extern.log4j.Log4j; | ||
|
|
||
| @Controller | ||
| @RequestMapping("/samplesecurity/*") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sample 경로로 연습한 적이 있어서 이번에는 samplesecurity경로를 만들었다..
| .antMatchers("/samplesecurity/admin").access("hasRole('ROLE_ADMIN')") | ||
| .antMatchers("/samplesecurity/member").access("hasRole('ROLE_MEMBER')"); | ||
|
|
||
| http.formLogin().loginPage("/customLogin").loginProcessingUrl("/login"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
관리자나 회원이 아닌데 admin, member 페이지로 접근할 경우 customLogin.jsp 페이지로 이동. URI 는 login
| .antMatchers("/samplesecurity/member").access("hasRole('ROLE_MEMBER')"); | ||
|
|
||
| http.formLogin().loginPage("/customLogin").loginProcessingUrl("/login"); | ||
| http.formLogin().loginPage("/customLogin").loginProcessingUrl("/login").successHandler(loginSuccessHandler()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
추가
요약
게시물에 파일을 업로드 할 수 있게 만든다.
관련 이슈
작업 내용
특이 사항