Spring Security basics : How to configure your first security-config.xml
To get up and running with basic Spring Security your application needs a entry in the web.xml and security-config.xml.
So lets have a look at the configuration needed to enable Spring Security in your application and what they really mean.
Step 1:
The first entry you need to make is in the web.xml
From Spring’s documentation “This provides a hook into the Spring Security web infrastructure.
DelegatingFilterProxyis a Spring Framework class which delegates to a filter implementation which is defined as a Spring bean in your application context. In this case, the bean is named “springSecurityFilterChain”, which is an internal infrastructure bean created by the namespace to handle web security.”
Step 2:
Create security-config.xml, all the spring security setting will be configured using this file.
Step 3: Use auto-config, this configuration actually adds quite a few services to the application because we have used the auto-config attribute. For example, form-based login processing is automatically enabled.
Step 4: Configure URl’s for security based on User roles
Step 5: Add some mock users to check/test the login form user authentication.
Thats all you require to get basic security for you application, try it with the mock user credentials.





Comments
Post a Comment