Posts

Showing posts with the label Spring Security

Spring Session

Spring Session provides an API and implementation for managing a user's session information. It also support clustered sessions without being tied to an application container-specific solution. Spring session support  integration with the HttpSession, WebSocket and WebSession. HttpSession : HttpSession replace HttpSession in application container with support of providing sessionId in header to work with RESTFUL APIS . WebSocket : It keeps alive HttpSession when receiving webSocket message. WebSession : WebSession replace Spring WebFlux's WebSession in an application container neutral way. Above thing can be  achieved using Spring Session Core, Spring Session Data Redis, Spring Session JDBC, Spring Session HazelCast. Spring Session Core provides core Spring Session functionality and API. Spring Session Data Redis provides SessionRepository and ReactiveSesssionRepository implementation backed by Redis and Configuration support. Spring Session JDBC provides Ses...

Spring Security Authentication

Image
Spring Security   provides comprehensive support for Authentication. Spring security Authentication has various section like, SecurityContextHolder Object Overview SecurityContextHolder: Spring Security Stores the details of who is authenticated. SecurityContextHolder uses a ThreadLocal to store authenticated user and authenticated principal. SecurityContextHolder uses ThreadLocal. Hence, We can access its details across the method. SecurityContext: It contains the Authentication of the currently authenticated user. Spring Security does not care how the securityContextHolder is populated. If it contains a value, then it is used as the currently authenticated user. The SecurityContext is obtained from the SecurityContextHolder. Authetication: Can be put input to AuthenicationManager to provide the credentials a user has provided to authenticate or the current user from the SecurityContext. The Authentication contains: principal, credentials and authorities.Prin...

Spring Security Filter

Spring Security is a framework that provides key security mechanism authentication, authorization and and protect application against attack. Spring security 5.3.2 requires a Java 8 or higher Run-time Environment. There is not any need to configure a special Java Authentication and Authorization Service (JAAS) policy file or place Spring Security into common classpath locations. All required files are contained within your application. Filter in Spring Security Spring Security Servlet support is based on Servlet Filters. The behavior of Filter is like, Client sends a request to the application and the container creates a FilterChain. FilterChain contains the Filter and Servlet that should processes the HttpServletReques based on path of RequestURI. One Servlet can handle a single HttpServletRequest and HttpServletResponse. More than one filter can prevent downstream Filter or the Servlet from being invoked. Filter can also modify the HttpServletRequest or HttpServletResponse use...