Skip to content
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

backend/argument-resolver/ #3

Open
utterances-bot opened this issue Jul 31, 2024 · 2 comments
Open

backend/argument-resolver/ #3

utterances-bot opened this issue Jul 31, 2024 · 2 comments

Comments

@utterances-bot
Copy link

스프링에서 Argument Resolver 기반 어노테이션으로 인증 책임을 분리해보자!

현재 포스트는 harmony 팀 크루 "haon"이 작성했습니다. Argument Resolver…

https://kakaotech-harmony.netlify.app/backend/argument-resolver/

Copy link
Contributor

인터셉터와 리졸버 중 어느 계층에서 인증처리를 구현할지에 대해서 많은 고민과 생각이 묻어나는 글이었습니다. 어노테이션을 인자에서 작성하는게 가능하군요.
용도별로 분류해봤을때 공통으로 적용되어야 하는 로직은 인터셉터, 부분적으로 적용이 필요한 로직은 리졸버 정도로 이해가 갑니다.
어떤경우에 인터셉터가 필요할까 아래와 같은 시나리오를 상상해봤습니다.

  • CSRF 공격을 방어하기 위해 사용자 요청이 유효한 url인지 검사하는 로직을 서버에서 수행해야 합니다.
  • 전역에러처리가 필요합니다. (요청지연, 큰데이터 등)

Copy link
Contributor

msung99 commented Aug 1, 2024

레오 말씀이 맞습니다! 인터셉터는 공통 로직, 리졸버는 부분 적용이 가능합니다.

말씀하신대로 CSRF, 전역에러처리도 처리 가능하며, 스프링 생태계에선 요청 로그를 기록하기 위해 인터셉터를 활용하기도 합니다 ㅎㅎ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants