Springsecurity 3.2 Getting Started (10) Customizing permissions control authentication and authorization process

Source: Internet
Author: User
Tags object object

The code implementation of the previous chapter still has some problems, such as the role table, the use of the permission table is not reflected, but has been able to complete the URL interception function, the following will continue to improve the authentication and authorization process.

The process of certification and authorization is as follows:

1, the container starts, the Myinvocationsecuritymetadatasourceservice class executes the Loadresourcedefine () method, extracts all the resources in the database, and the resource URL as the key, and the resource identifier as the value To form the data of the map structure.

2, the user sends the request, if the request is set does not intercept the attribute, then the Mysecurityfilter class executes the Dofilter () method, intercepts the request.

3. Call the GetAttributes (Object object) method of the Myinvocationsecuritymetadatasourceservice class to obtain the permissions (Resource identification) required to access the request.

4. Then call the Myaccessdecisionmanager class's decide () method to verify that the user has access rights. If one is passed, none prompts for access to the resource without permission. If you are not logged in at this time, jump to the login page.

5, when logging in, Myusernamepasswordauthenticationfilter class executes Attemptauthentication () method, obtains the attestation.

6, after the successful login, call the Myuserdetailsservice class of the Loaduserbyusername () method to obtain a userdetail entity, the role of the method to authorize the user.

7, repeat 2, 3, 4 steps to intercept access requests.

Springsecurity 3.2 Getting Started (10) Customizing permissions control authentication and authorization process

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.