Lightweight Java Permission Authentication Framework with SSO and OAuth2.0 – Open Source

Lightweight Java Permission Authentication Framework with SSO and OAuth2.0 – Open Source

2022-09-02 0 1,177
Resource Number 37493 Last Updated 2025-02-24
¥ 0 USD Upgrade VIP
Download Notice Demo
Can't download? Please contact customer service to submit a link error!
Value-added Service: Installation Guide Environment Configuration Secondary Development Template Modification Source Code Installation

Product Details 商品属性

  • Language: Java
  • Database: 其他
  • License: License-Free
  • Source Code: Fully Open Source
  • Specification: Full Website Source
  • Delivery: Automatic (instant download after payment)
This issue recommends a lightweight Java permission authentication framework called Sa-Token.

Sa-Token is a lightweight Java permission authentication framework, mainly to solve: login authentication, permission authentication, Session session, single sign-on, OAuth2.0, microservice network authentication and a series of permissions related issues.

Overview of Sa-Token functions:
Login authentication – single-end login, multi-end login, mutually exclusive login, no login within seven days
Permission authentication: Permission authentication, role authentication, and session level-2 authentication
Session Session: All-end shared Session, single-end exclusive Session, and customized session
Kick a user offline: Kick a user offline based on the account id and Token value
Account blocking – designated days of blocking, permanent blocking, set unblocking time
Persistence layer extension – can integrate Redis, Memcached and other professional cache middleware, restart data without loss
Distributed session – Provides two distributed session solutions for jwt integration and shared data centers
Microservice authentication – Route blocking authentication for common gateways such as Gateway, ShenYu, and Zuul
Single sign-on – Three single sign-on modes are built in: cross-domain, shared Redis or not
OAuth2.0 authentication — Based on RFC-6749 standard, OAuth2.0 standard process of authorization authentication, support openid mode
Level 2 authentication: Re-authentication on the basis of login to ensure security
Basic Authentication – A line of code accesses Http Basic authentication
Standalone Redis – Separate the permission cache from the business cache
Temporary Token authentication – Solves the problem of short-term Token authorization
Simulate other accounts – manipulate any user status data in real time
Temporary Identity switching – Temporarily switching the session identity to another account
Separation of front and back – APP, small program and other terminals that do not support cookies
The same terminal is mutually exclusive login – like QQ mobile phone computer online at the same time, but the two mobile phones are mutually exclusive login
Multi-account authentication system – for example, the user table and admin table of a mall project are authenticated separately
Fancy token generation – built-in six Token styles, also can: custom Token generation strategy, custom Token prefix
Annotated authentication – elegantly separates authentication from business code
Route interception authentication – Based on route interception authentication, the restful mode can be adapted
Automatic renewal – Provides two Token expiration policies, which can be flexibly used together and can be automatically renewed
Session governance – Provides a convenient and flexible session query interface
Remember Me mode – Adapt [Remember me] mode, restart the browser without verification
Password encryption – Provides password encryption module, can fast MD5, SHA1, SHA256, AES, RSA encryption
Global listener – performs some AOP operations when a user logs in, logs out, gets kicked off, and so on
Out of the box – Provides SpringMVC, WebFlux and other common web framework starter integration package, true out of the box
Sa-Token function structure:

Introducing Dependencies (1 of 4):

  • SpringMVC Environment

Maven dependency

<dependency><groupId>cn.dev33</groupId><artifactId>sa-token-spring-boot-starter</artifactId><version>1.27.0</version></dependency>

Gradle dependency

implementation 'cn.dev33:sa-token-spring-boot-starter:1.27.0'
  • WebFlux Environment(Reactor)

Mavendependency

<dependency>    <groupId>cn.dev33</groupId>    <artifactId>sa-token-reactor-spring-boot-starter</artifactId>    <version>1.27.0</version></dependency>

Gradledependency

implementation 'cn.dev33:sa-token-reactor-spring-boot-starter:1.27.0'
  • ServletContainer environment

Mavendependency

<dependency>    <groupId>cn.dev33</groupId>    <artifactId>sa-token-servlet</artifactId>    <version>1.27.0</version></dependency>

Gradledependency

implementation 'cn.dev33:sa-token-servlet:1.27.0'
  • else

Mavendependency

<dependency>    <groupId>cn.dev33</groupId>    <artifactId>sa-token-core</artifactId>    <version>1.27.0</version></dependency>

Gradledependency

implementation 'cn.dev33:sa-token-core:1.27.0'

give a typical example:

The API design of Sa-Token is very simple, taking login authentication as an example, you only need to:

// The account of the current session is written during login :idStpUtil.login(10001);// Then call the following method where you want to verify the login:// If the current session is not logged in, this line of code will throw a `NotLoginException` exception StpUtil.checkLogin();

At this point, we have completed the login authentication with Sa-Token!

Permission authentication example (Only sessions with user:add permissions can enter the request)

@SaCheckPermission("user:add")@RequestMapping("/user/insert")public String insert(SysUser user) {// ... return "User increase";}

Kick an account offline (throws a NotLoginException when the other party accesses the system again))

// Example Kick session 10001 offline StpUtil.kickout(10001);

In Sa-Token, most functions can be done with a single line of code:

StpUtil.login(10001);                     //Mark the account for which the current session is logged in idStpUtil.getLogiGet the account ID of the current session login StpUtil.isLogin();/span> Get the account ID of the current session login StpUtGet whether the current session is logged in, returns or false StpUtil.logout();span> Get whether the current session is logged in, returnstrue//Log out of the current session StpUtKick the session with account ckout);                   //Translate the account as);           或falseStpUtil.hasPermissiQuery whether the current account has the specified permission, returns Get the Session with account IDass="hljs-literStpUtil.getTokenValueByLoginId(();前账号Get the Session of the current account ID StpUtil.getGet the token value with account IDyLoginId(enValueByLoginId(();                     //); ID is10001的SessionStpUtil.getTokenValueByLGet the token value with account IDfy device identifier for login, commonly used for 'same-device mutual exclusion login' StpUtil.kickout(span>);    //Get the account ID as10001, "PVerify whether the current session is within the validity period of secondary authentication; if verification fails, an exception is thrown Temporarily switch the current session identity to another accountp">//Who is using Sa-Token: Line (different ends are not affected) StpUtil.openSafe(120);                    //Enable two-factor authentication for the current session, valid for120StpUtil.checkSafe();//Verify whether the current session is within the validity period of secondary authentication; if verification fails, an exception will be thrown. StpUtil.switchTo(10044);                  //Temporarily switch the current session identity to another account.

Who is using Sa-Token:

Lightweight Java Permission Authentication Framework with SSO and OAuth2.0 – Open Source

Lightweight Java Permission Authentication Framework with SSO and OAuth2.0 – Open Source

You can read more on your own。


If you need project recommendations and resources, please send private letters to the author

资源下载此资源为免费资源立即下载
Telegram:@John_Software
☆☆☆☆☆0 pts · 0 reviews
Updated 2025-02-24

Q&A

No questions yet. Ask the seller!

Reviews

No reviews yet. Share your experience after purchase.

Disclaimer: This article is published by a third party and represents the views of the author only and has nothing to do with this website. This site does not make any guarantee or commitment to the authenticity, completeness and timeliness of this article and all or part of its content, please readers for reference only, and please verify the relevant content. The publication or republication of articles by this website for the purpose of conveying more information does not mean that it endorses its views or confirms its description, nor does it mean that this website is responsible for its authenticity.

TopTinker Admin Panel & RBAC Lightweight Java Permission Authentication Framework with SSO and OAuth2.0 – Open Source https://toptinker.com/37493.html

商家类型:个人(声明)

Share free open-source source code

Q&A
  • 1. Automatic: After making an online payment, click the (Download) link to download the source code; 2. Manual: Contact the seller or the official to check if the template is consistent. Then, place an order and make payment online. The seller ships the goods, and both parties inspect and confirm that there are no issues. TopTinker will then settle the payment for the seller. Note: Please ensure to place your order and make payment through TopTinker. If you do not place your order and make payment through TopTinker, and the seller sends fake source code or encounters any issues, TopTinker will not assist in resolving them, nor can we guarantee your funds!
View details
  • 1. Default transaction cycle for source code: The seller manually ships the goods within 1-3 days. The amount paid by the user will be held in escrow by TopTinker until 7 days after the transaction is completed and both parties confirm that there are no issues. TopTinker will then settle with the seller. In case of any disputes, TopTinker will have staff to assist in handling until the dispute is resolved or a refund is made! If the buyer places an order and makes payment not through TopTinker, any issues and disputes have nothing to do with TopTinker, and TopTinker will not be responsible for any liabilities!
View details
  • 1. TopTinker will permanently archive the transaction process between both parties and snapshots of the traded goods to ensure the authenticity, validity, and security of the transaction! 2. TopTinker cannot guarantee services such as "permanent package updates" and "permanent technical support" after the merchant's commitment. Buyers are advised to identify these services on their own. If necessary, they can contact TopTinker for assistance; 3. When both website demonstration and image demonstration exist in the source code, and the text descriptions of the website and images are inconsistent, the text description of the image shall prevail as the basis for dispute resolution (excluding special statements or agreements); 4. If there is no statement such as "no legal basis for refund" or similar content, any indication on the product that "once sold, no refunds will be supported" or other similar declarations shall be deemed invalid; 5. Before the buyer places an order and makes payment, the transaction details agreed upon by both parties via WhatsApp or email can also serve as the basis for dispute resolution (in case of any inconsistency between the agreement and the description of the conflict, the agreement shall prevail); 6. Since chat records and email records can serve as the basis for dispute resolution, both parties should only communicate with each other through the contact information left on the system when contacting each other, in order to prevent the other party from denying their own commitments. 7. Although the probability of disputes is low, it is essential to retain important information such as chat records, text messages, and email records, in case a dispute arises, so that TopTinker can intervene quickly.
View details
  • 1. As a third-party intermediary platform, TopTinker solely protects transaction security and the rights and interests of both buyers and sellers based on the transaction contract (product description, agreed content before the transaction); 2. For online trading projects not on the TopTinker platform, any consequences are unrelated to this platform; regardless of the reason why the seller requests an offline transaction, please contact the administrator to report.
View details

Related Source code

TopTinker Customer Service

24-hour online professional services