Spring Security를 이용하여 로그인/로그아웃 기능 추가#24
Open
EunJuOh33 wants to merge 5 commits into
Open
Conversation
EunJuOh33
commented
Feb 22, 2021
Comment on lines
+28
to
+21
| @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')"); |
Owner
Author
There was a problem hiding this comment.
all 경로는 접근 제한 없음
admin 경로는 'ROLE_ADMIN' 라는 권한이 있는 사용자만 접근 가능
member 경로는 'ROLE_MEMBER'라는 권한이 있는 사용자만 접근 가능
| import lombok.extern.log4j.Log4j; | ||
|
|
||
| @Controller | ||
| @RequestMapping("/samplesecurity/*") |
Owner
Author
There was a problem hiding this comment.
sample 경로로 연습한 적이 있어서 이번에는 samplesecurity경로를 만들었다..
EunJuOh33
commented
Feb 22, 2021
| .antMatchers("/samplesecurity/admin").access("hasRole('ROLE_ADMIN')") | ||
| .antMatchers("/samplesecurity/member").access("hasRole('ROLE_MEMBER')"); | ||
|
|
||
| http.formLogin().loginPage("/customLogin").loginProcessingUrl("/login"); |
Owner
Author
There was a problem hiding this comment.
관리자나 회원이 아닌데 admin, member 페이지로 접근할 경우 customLogin.jsp 페이지로 이동. URI 는 login
EunJuOh33
commented
Mar 1, 2021
| .antMatchers("/samplesecurity/member").access("hasRole('ROLE_MEMBER')"); | ||
|
|
||
| http.formLogin().loginPage("/customLogin").loginProcessingUrl("/login"); | ||
| http.formLogin().loginPage("/customLogin").loginProcessingUrl("/login").successHandler(loginSuccessHandler()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
요약
게시물에 파일을 업로드 할 수 있게 만든다.
관련 이슈
작업 내용
특이 사항