Below we will implement a series of tutorials on spring Security3.
The ultimate goal is to integrate spring Security + SPRING3MVC
Complete a function similar to Mini-web in SpringSide3.
What is Spring security?
Reference spring Security, a secure framework based on spring AOP and servlet filters. It provides a comprehensive security solution that handles both identity recognition and authorization at the Web request level and at the method call level. Based on the spring framework, spring security takes full advantage of dependency injection (Di,dependency injection) and facet-oriented technology.
Information on spring security learning.
The most important, the most complete Chinese material is of course family168 's Chinese document
Spring Security2 Reference Documentation
Spring Security3 Reference Documentation
The attachment contains a good first-entry PDF tutorial.
It is best to take 30 minutes to follow the tutorials on the PDF step-by-step operation.
Although there is no practical application value, it is very helpful for beginners to know SpringSecurity3.
Our project directory structure is ultimately:
The jar package that needs to be added:
We first implement a controller:
Maincontroller.java
Java code package org.liukai.tutorial.controller; import org.apache.log4j.logger; import org.springframework.stereotype.controller; Import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.requestmethod; @Controller @ Requestmapping ("/main") public class maincontroller { protected static logger logger = logger.getlogger ("Controller"); /** * Jump to commonpage page * * @return */ @RequestMapping (value = "/common", method = requestmethod.get)  &NBsp; public string getcommonpage () { logger.debug ("Received request to show common page"); return "Commonpage"; } /** * Skip to Adminpage page * * @return */ @RequestMapping (value = "/admin", Method = requestmethod.get) public string getaadminpage () { logger.debug ("received request To show admin page "); return " Adminpage "," } }
The controller has two mapping mappings:
Reference Main/common
Main/admin
Now we will be able to access the Main/common with the Spring Security3 framework for successful landings.
However, only users with admin privileges can access main/admin.
Let's start with Spring3mvc and SpringSecurity3 in Web. Xml.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.