Shiro logon authentication and permission control, shiro logon permission Control

Source: Internet
Author: User

Shiro logon authentication and permission control, shiro logon permission Control

1. Implement class inheritance AuthorizingRealm

1. Implementation Method doGetAuthenticationInfo: Fill the defined user entity class with map and realmPrincipals;

2. Implementation Method doGetAuthorizationInfo: Fill in roles and Permissions;

2. Create a subject

The SecurityUtils getSubject method is provided. securityManager. createSubject and SubjectContext are used to confirm that securityManager, session, and PrincipalCollection exist in the map. Finally, defawebwebsubjectfactory creates webDelegatingSubject and saves it to the session.

Iii. logon Verification

Log on to create a logstore. Run the securityManager login command in the DelegatingSubject login method.

4. log out

The DelegatingSubject logout method executes securityManager logout, deletes the subject in the session, and stops the session.

V. About ModularRealmAuthenticator

ModularRealmAuthenticator class setRealms at project startup (defined in step 1,I am not sure why Injection occurs when the project is started.), DoSingleRealmAuthentication method calls doGetAuthorizationInfo of realm

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.