@nocobase/plugin-saml (0.21.12)
Published 2024-04-16 14:13:54 +08:00 by sealday
Installation
@nocobase:registry=
npm install @nocobase/plugin-saml@0.21.12
"@nocobase/plugin-saml": "0.21.12"
About this package
SAML
提供SAML2.0 SSO登录功能。
依赖
@nocobase/auth
认证插件,提供认证相关功能,表、模型、函数复用等。
使用方法
以Google WorkSpace IdP为例
将Google设置为IdP
Google管理控制台 - 应用 - Web应用和移动应用
![](https://s2.loli.net/2023/05/18/O7UYh9pjePrKzTq.png)
进行应用设置之后,复制SSO网址、实体ID和证书。
![](https://s2.loli.net/2023/05/18/Mpwk3dAIvShmUCe.png)
在Nocobase上新增认证器
插件设置 - 认证 - 新增 - SAML
![](https://s2.loli.net/2023/05/18/EpXsJ1BM5lju2mY.png)
将刚才复制的信息依次进行填写
- SSO URL: SSO网址
- Public Certificate: 证书
- idP Issuer: 实体id
- http: 如果是本地http测试可以勾选
之后复制Usage
中的SP Issuer/EntityID
和ACS URL
.
在Google上填写SP信息
回到Google控制台,在服务提供商详细信息页面,输入刚才复制的ACS网址和实体ID,并勾选已签署响应。
在属性映射位置,添加映射,映射对应属性,Nocobase可供映射的字段有:
- email(必填)
- phone (仅对scope支持phone的平台生效,如阿里云)
- nickname
- username
- firstName
- lastName
用户名使用规则优先级: nickname
> username
> firstName lastName
> nameID
nameID
为SAML协议携带,无需映射,将作为用户唯一标识保存。
在有email或nameID为email的情况下,登录时将尝试匹配已有用户,否则创建新用户。
Dependencies
Development Dependencies
ID | Version |
---|---|
@ant-design/icons | ~5.3.6 |
@nocobase/schema | 0.21.12 |
@node-saml/node-saml | ^4.0.2 |
antd | 5.16.1 |
react | ~18.2.0 |
react-i18next | ^11.15.1 |
react-router-dom | ^6.11.2 |
Peer Dependencies
ID | Version |
---|---|
@nocobase/actions | 0.21.12 |
@nocobase/auth | 0.21.12 |
@nocobase/client | 0.21.12 |
@nocobase/database | 0.21.12 |
@nocobase/plugin-auth | 0.21.12 |
@nocobase/sdk | 0.21.12 |
@nocobase/server | 0.21.12 |
@nocobase/test | 0.21.12 |
Keywords
Authentication