-
Notifications
You must be signed in to change notification settings - Fork 8
[10주차/여니] 워크북 제출합니다 #60
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: yunny/main
Are you sure you want to change the base?
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> signUp2( | ||
| @RequestBody @Valid MemberReqDTO.JoinDTO dto | ||
| ) { | ||
| return ApiResponse.onSuccess(MemberSuccessCode.FOUND, memberCommandService.signUp(dto)); | ||
| } | ||
|
|
||
| // 로그인 | ||
| @PostMapping("/login") | ||
| public ApiResponse<MemberResDTO.LoginDTO> login2( | ||
| @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.
'로그인/회원가입'과 같이 권한 관련 코드들은 Member가 아닌, 따로 Auth 패키지를 파서 관리하기도 한답니다!
참고해주세요!
| .authorizeHttpRequests(requests -> requests | ||
| .requestMatchers(allowUris).permitAll() | ||
| .requestMatchers("/swagger-ui/index.html").hasRole("ADMIN") | ||
| .anyRequest().authenticated() | ||
| ) | ||
| .addFilterBefore(jwtAuthFilter(), UsernamePasswordAuthenticationFilter.class) | ||
| .formLogin(AbstractHttpConfigurer::disable) | ||
| .csrf(AbstractHttpConfigurer::disable) | ||
| .logout(logout -> logout | ||
| .logoutUrl("/logout") | ||
| .logoutSuccessUrl("/login?logout") | ||
| .permitAll() | ||
| ) | ||
| .exceptionHandling(exception -> exception.authenticationEntryPoint(authenticationEntryPoint())) |
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를 사용한다면 세션 비활성화를 명시적으로 적어주는 것도 좋아보이네요!
http
.sessionManagement(session ->
session.sessionCreationPolicy(SessionCreationPolicy.STATELESS));| jwt: | ||
| token: | ||
| secretKey: ${JWT_SECRET_KEY} | ||
| expiration: | ||
| access: ${JWT_EXPIRATION_ACCESS} |
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.
잘 가려놓으셨군요 bb
✅ 실습 체크리스트
✅ 컨벤션 체크리스트
📌 주안점