Installing Spring Security On Spring MVC Project

These are steps required to install Spring Security for a form authentication implementation on a Spring MVC project.

  1. Maven Dependencies.

  2. Add Spring Security filter to web.xml
    <!-- Spring Security Filter -->
  3. Add a security-context.xml spring beans config file. You can place all your security config on root application context xml but separating it would produce clearer code without namespace prefix clutter
    <!-- On root-context.xml -->
    <import resource="security-context.xml"/>
    <!-- On security-context.xml" -->
    <beans:beans xmlns=""
  4. Add basic HTTP form authentication and provider as seen on Spring reference manual
    <http auto-config='true'>
    	<intercept-url pattern="/**" access="ROLE_USER" />
    	    <user name="jimi" password="jimispassword" authorities="ROLE_USER, ROLE_ADMIN" />
    	    <user name="bob" password="bobspassword" authorities="ROLE_USER" />

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s