In this article, I will discuss the Spring Security Filter versus Nest.js's Guard. The Spring Security Filter is responsible for managing incoming request authorizations. It is composed of multiple filters that work in a specific order, similar to the "Guard" feature in Nest.js.
In Nest.js, each guard has a specific role, making it easy to understand, and it is executed iteratively through the use of the "UseGuards" method. The clear context of each guard also helps with understanding. Additionally, the Guard has access to the ExecutionContext, providing further context.
Spring Security Filter operates in a similar manner, with access to context and iterative filtering. However, it has its own advantages, such as the straightforward chaining method. This method allows developers to manage all filters in a single code block, but it may become less readable if some developers put too many HTTP security lines in a single function.
'Web > Spring' 카테고리의 다른 글
Unable to load class 'javax.persistence.Entity'. (0) | 2023.02.05 |
---|---|
Spring bean scope (0) | 2023.01.28 |
스프링에서 싱글톤으로 관리하는 빈의 생성주기 (0) | 2023.01.26 |
스프링 컨테이너 (0) | 2023.01.24 |