基于Guillotina的hydra身份提供者
项目描述
此插件旨在通过Guillotina为hydra提供身份提供者。
它还实现了hydra的登录和同意流程。
端点
GET /@users
POST /@users {'id', 'username', 'password', 'phone', 'email', 'data', 'allowed_scopes'}
DELETE /@users/{userid}
GET /@users/{userid}
GET /@hydra-login
POST /@hydra-login
GET /@hydra-consent
POST /@hydra-consent
POST /@hydra-join
GET /@hydra-user
PATCH /@hydra-user
配置
配置取决于您的登录前端实现。使用可以渲染HTML并将其作为认证端点的应用程序可以使流程更加简单。
请参阅仓库中的angular应用程序示例和集成测试流程,以了解它是如何工作的。
测试需要一个运行以下配置的hydra实例
OAUTH2_ISSUER_URL=https://:4444
OAUTH2_CONSENT_URL=https://:8080/@hydra-consent
OAUTH2_LOGIN_URL=https://:8080/@hydra-login
DATABASE_URL=postgres://hydra:secret@postgresd:5432/hydra?sslmode=disable
SYSTEM_SECRET=youReallyNeedToChangeThis
OAUTH2_SHARE_ERROR_DEBUG=1
OIDC_SUBJECT_TYPES_SUPPORTED=public,pairwise
OIDC_SUBJECT_TYPE_PAIRWISE_SALT=你真的需要更改这个
然后你需要配置 guillotina
auth_providers:
hydra:
configuration:
client_id: auth-code-client
client_secret: secret
base_url: https://:4444/
authorize_url: https://:4444/oauth2/auth
access_token_url: https://:4444/oauth2/token
state: true
scope: openid offline
hydra:
db:
dsn: postgres://hydra:secret@localhost:5432/hydra
pool_size: 20
# hydra admin url should be internal, protected!
admin_url: https://:4445/
allow_registration: false
recaptcha_private_key: null
recaptcha_public_key: null
将 oauth 客户端添加到 hydra
curl -XPUT https://:4445/clients/auth-code-client -d '{
"client_id": "auth-code-client",
"client_name": "",
"redirect_uris": [
"https://:8080/@callback/hydra"
],
"grant_types": [
"authorization_code",
"refresh_token"
],
"response_types": [
"code",
"id_token"
],
"scope": "openid offline",
"owner": "",
"policy_uri": "",
"allowed_cors_origins": [],
"tos_uri": "",
"client_uri": "",
"logo_uri": "",
"contacts": [],
"client_secret_expires_at": 0,
"subject_type": "public",
"jwks": {
"keys": null
},
"token_endpoint_auth_method": "client_secret_post",
"userinfo_signed_response_alg": "none"
}'
有关使用流程的示例,请参阅 https://github.com/guillotinaweb/guillotina_hydraidp/blob/master/integration_tests.py
这仅仅是 API 实现。你仍然需要实现前端!
作用域格式
使用作用域来授予对 guillotina 容器的访问权限。
作用域的格式为:[容器 ID]:[类型]:[值]。
例如,为了授予用户访问容器 cms 作为用户的权限,作用域应该是 cms:role:guillotina.Member
其他示例:- cms:role:guillotina.Reader - cms:permission:guillotina.AccessContent
开发前端
启动持久层
docker-compose up redis postgres hydra-migrate hydra hydra-proxy
启动 idp
virtualenv . source bin/activate g -c config-pg.yaml
启动 ngapp
cd loginapp ng serve
打开浏览器
https://:4200
1.0.3 (2018-10-27)
添加事件 [bloodbare]
1.0.2 (2018-10-25)
加入 RSA 公钥 [bloodbare]
1.0.1 (2018-10-22)
能够作为一个常规登录端点工作 [vangheem]
提供 angular 登录应用 [bloodbare]
1.0.0 (2018-10-09)
初始
项目详情
guillotina_hydraidp-1.0.3.tar.gz 的散列
| 算法 | 散列摘要 | |
|---|---|---|
| SHA256 | 0d1194ae32ee085bf62d487dfabb51439b83ec7d95fa324f84377d8e2e2e2afb |
|
| MD5 | 7db874460b18c1e34dd9d002d4a62c25 |
|
| BLAKE2b-256 | a0f8b20f02fc6c0fd299de930a8ef7b35c5c01dcf8365f2ca5a838bbf065e227 |