In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the operation method of github single sign-on in SpringBootSecurity, the content is very detailed, interested friends can refer to it, I hope it can be helpful to you.
Single sign on (SSO)
Finally, let's learn about single sign-on for oauth3.0. Previously introduced the definition of single sign-on, single sign-on (Single Sign On), referred to as SSO, is one of the more popular enterprise business integration solutions. SSO is defined as that in multiple application systems, users only need to log in once to access all the applications that trust each other.
For single sign-on, the official documentation address for the springcloud G version is as follows:
Https://cloud.spring.io/spring-cloud-static/Greenwich.SR3/single/spring-cloud.html#_single_sign_on
There are many examples of single sign-on, the most common is that after we log in to Baidu, functional websites such as Baidu disk, Baidu know and Baidu translation will automatically log in to Baidu's account, and after qq or Wechat login, other Tencent games and other app can also log in with one click, and so on. There are many examples. For third-party authorized applications, single sign-on is not required, but for account sharing between different services and software in the same enterprise, single sign-on is a necessary function.
SSO is simply implemented using github
Spring cloud oauth supports sso, and it is very easy to use and configure. You can use a third-party authorization service, such as GitHub, or you can build your own authorization service. Let's implement a simple sso in github.
First of all, go to github to register, the address is as follows:
Https://github.com/settings/applications/new
Instead of registering ourselves here, we use the registered id and secret key demonstrated in the official documentation:
ClientId and clientSecret are:
Bd1c0a783ccdd1c9b9e4
1a9030fbca47a5b2c28e92f19050bb77824b5ad1
The configuration of the sso client is the same as shown in the image above. Let's create two new projects with dependencies that introduce only web and oauth:
A @ EnableOAuth3Sso annotation needs to be added to the startup class of the project:
Create two simple interfaces:
Finally, there is the configuration of the configuration file, which is basically the same as the example on the official website:
Here the two projects are basically the same, and the code and configuration of the other project are the same. Security does not write any configuration classes, just use the default.
test
Start two projects and access the / user interface of one of them:
Will jump directly to the login page of github:
You can take a look at the address in the address bar above, it will be very familiar. You can enter your github account here, and then click Log in, which will automatically jump back to the / user address we originally visited:
As you can see, our own project automatically logged in successfully and returned the current user data, which is actually the github account.
Now that the first project above has successfully logged in and accessed the interface, let's directly access the second project:
You can see that the second project is not redirected to login, but is directly logged in, and the account information is the same as that of the previous project. This is a demonstration of simple sso.
Code address: https://gitee.com/blueses/spring-boot-security 37 38
On the SpringBootSecurity github single sign-on operation method to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.