-
Notifications
You must be signed in to change notification settings - Fork 8
[10주차/루나] 워크북 제출합니다 #59
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
Conversation
kfdsy0103
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.
10주차 워크북까지 수행하시느라 수고 많으셨어요 루나!
리뷰 확인 후 머지 부탁드려요!
| // 회원가입 | ||
| @PostMapping("/sign-up") | ||
| public ApiResponse<MemberResDTO.JoinDTO> signUp( | ||
| @RequestBody @Valid MemberReqDTO.JoinDTO dto | ||
| ){ | ||
| return ApiResponse.onSuccess(MemberSuccessCode.FOUND, memberCommandService.signup(dto)); | ||
| } | ||
|
|
||
| // 로그인 | ||
| @PostMapping("/login") | ||
| public ApiResponse<MemberResDTO.LoginDTO> login( | ||
| @RequestBody @Valid MemberReqDTO.LoginDTO dto | ||
| ){ | ||
| return ApiResponse.onSuccess(MemberSuccessCode.FOUND, memberQueryService.login(dto)); | ||
| } |
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.
'로그인/회원가입'과 같이 권한 관련 코드들은 따로 Auth 패키지를 만들어 관리하기도 한답니다! 참고해주세요!
| http | ||
| .authorizeHttpRequests(requests -> requests | ||
| .requestMatchers(allowUris).permitAll() | ||
| .requestMatchers("/admin/**").hasRole("ADMIN") | ||
| .anyRequest().authenticated() | ||
| ) | ||
| // 폼로그인 비활성화 | ||
| .formLogin(AbstractHttpConfigurer::disable) | ||
| // JwtAuthFilter를 UsernamePasswordAuthenticationFilter 앞에 추가 | ||
| .addFilterBefore(jwtAuthFilter(), UsernamePasswordAuthenticationFilter.class) | ||
| .csrf(AbstractHttpConfigurer::disable) | ||
| .logout(logout -> logout | ||
| .logoutUrl("/logout") | ||
| .logoutSuccessUrl("/login?logout") | ||
| .permitAll() | ||
| ); |
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.
JWT를 사용한다면 session 비활성화를 명시적으로 적어주는 것도 좋아보여요!
http
.sessionManagement(session ->
session.sessionCreationPolicy(SessionCreationPolicy.STATELESS));
✅ 실습 체크리스트
✅ 컨벤션 체크리스트