Configuring security in Spring via namespace

The namespace configuration in the Spring Framework is available from the 2.0 onward versions, which is the basic requirement to start using security in the application. It's made available from the Config module, which we just discussed. To add the namespace, we will need to add the following code block in the application context file as an additional configuration information:

    <beans xmlns="http://www.springframework.org/schema/beans" 
      xmlns:security="http://www.springframework.org/schema/security" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xsi:schemaLocation=
"http://www.springframework.org/schema/security http://www.springframework.org/schema/security
/spring-security.xsd"> <!-the bean definition goes here--> </beans>

The namespace is designed around the dependencies in such a way that it enables the use of simplified syntax in the application to integrate the security mechanism. It supports using security in the following areas:

  • URL-based security: This sets the filters and all related beans that are used to apply authentication for the resources through securing their URLs.
  • Method-level Security: This is used to secure the service layer by setting up the mechanism to secure the methods to ensure the limited access by the authenticated users only.
  • AuthenticationManager: This sets AuthenticationManager, which is the key interface involved in providing authentication services to handle the requests. It is an instance of the ProviderManager class that is the default implementation which requests AuthenticationProviderS configured to perform the authentication by queuing them. AuthenticationManager is involved in the decision of how the work is to be done.
  • Sets AccessDecisionManager: On the configuration of the namespace, AccessDecisionManager gets implicitly registered, which provides the access decisions, URL access, and method-level security.
  • Sets AuthenticationProvider: This sets AuthenticationProvider, which takes the decision about which AuthenticationManager will be chosen to perform the authentication for the users.
  • UserDetailsService: This is the central interface in Spring Security that is used by authentication providers to obtain the information about the authentication object, as discussed earlier.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.143.4