My mentor’s article: https://blog.csdn.net/zhou920786312/article/details/119546135
——————————————
Third-party single sign-on access interface solution
illustrate
1. Problem
At present, we have our own oa system. The oa system has a portal page. We need to integrate other systems at a single point on this portal. Each other system has its own single point of login method. For example, other system 1 uses token to integrate the single point, and other system 2 uses session to integrate the single point.
think
If we adapt every other system, we will need to develop all the systems that will be connected in the future. This will not only lead to too much workload, but also fail to unify single sign-in very well.
So my design is to let other systems provide an interface (/autherThirdLogin), and we define the interface url and parameters. In this way, we only need to call
the interface to notify other systems that this user needs to jump to your system.
/autherThirdLogin core design
- Parameters need to be signed to prevent data from being tampered with
- Parameters need to be encrypted to prevent them from being parsed by others.
- It is necessary to invalidate the parameters to prevent others from intercepting the URL and being able to log in directly in the future.
2. Interface design
2.1./autherThirdLogin interface definition
describe
通知其他系统,某个用户需要免登陆跳转到其他系统上
Request URL
http://第三方系统IP:端口/autherThirdLogin
Request method
POST
Request parameters
Request parameters | required | Parameter Type | illustrate |
---|---|---|---|
key | true | String | encrypted data |
Return fields
Return fields | Field Type | illustrate |
---|---|---|
code | int | 0 success, -1 failure |
message | String | failure,sucess |
data | Object | Expand the returned map object |
token | String | token |
sessionId | String | sessionId |
returnLink | String | Jump url |
Request example
http://localhost:8080//autherThirdLogin?key=7khdRKH-GlI_b454egJjhBJpY0NwA6ulY_zWHyQ7fxbKuTSEdtxO_WeogVRiy0QMqQ7HjbPAa31NWCl-24lqplEtqmC2sO6f9bmGq5OLYEgjmUiU5jlcQ9kZN6K2Nx7_RAZK4DnzRIkYHFRdSwGP7flpfqsaL8zuXcBF-7JcX8fhqEee9YjNVQnUkd8c3HE1H9Alf0L8OjGBr0xrz8WKV92kVcBOtY-kVmQ_c6SbmTo1nLnOpkv55OWjChWbVl9SA4F6q3HVem0gJqKPw-aX4dryQRTu1ZHIZhC15KlNsEgpXuYhdSfD2m6eGJBzaK2B
Return example
demo
{
"code": 0,
"message": "sucess",
"data": null,
"token": "123",
"sessionId": "123",
"returnLink": "http://ip:端口/autherThirdLogin2"
}
For examples and demos, refer to demo
Code location
https://download.csdn.net/download/zhou920786312/20934764