๐๐ SPRING CERTIFICATION QUESTION: Is security a cross-cutting concern? How is it implemented internally?
๐๐ SPRING CERTIFICATION QUESTION: Is security a cross-cutting concern? How is it implemented internally?
Answer:
Security concern pertains to lots of layers of an application and therefore is considered to be a cross-cutting.
Depending on what is secured, Spring Security framework internals differ:
- Method invocation is declarative and is implemented using AOP proxies (proxy object wraps secured one and applies implemented advices at particular join-points).
- Web-layer security is implemented using a hierarchy of ๐ ๐ข๐ฅ๐ญ๐๐ซ instances.
Web-layer filter security hierarchy is the following:
A single instance of ๐๐๐ฅ๐๐ ๐๐ญ๐ข๐ง๐ ๐ ๐ข๐ฅ๐ญ๐๐ซ๐๐ซ๐จ๐ฑ๐ฒ is installed into the servlet container's filter chain.
This filter is ๐ง๐จ๐ญ a Spring bean, its lifecycle is managed by the servlet container.
Usually, this filter is created by the Spring Security framework itself.
๐๐๐ฅ๐๐ ๐๐ญ๐ข๐ง๐ ๐ ๐ข๐ฅ๐ญ๐๐ซ๐๐ซ๐จ๐ฑ๐ฒ delegates filtering functionality to a single instance of ๐ ๐ข๐ฅ๐ญ๐๐ซ๐๐ก๐๐ข๐ง๐๐ซ๐จ๐ฑ๐ฒ which ๐ข๐ฌ a Spring bean,
thus lifecycle of it is managed by ๐๐ฉ๐ฉ๐ฅ๐ข๐๐๐ญ๐ข๐จ๐ง๐๐จ๐ง๐ญ๐๐ฑ๐ญ.
๐ ๐ข๐ฅ๐ญ๐๐ซ๐๐ก๐๐ข๐ง๐๐ซ๐จ๐ฑ๐ฒ holds a list of ๐๐๐๐ฎ๐ซ๐ข๐ญ๐ฒ๐ ๐ข๐ฅ๐ญ๐๐ซ๐๐ก๐๐ข๐ง which contain all security logic.
Only ๐จ๐ง๐ security filter chain can process a single web request.
#spring #certificationquestion #vcp
The Security Filter Chain ๐ https://lnkd.in/epdCeihttps://docs.spring.io/spring-security/site/docs/3.1.4.RELEASE/reference/security-filter-chain.html