
https://github.com/kenchan0130/docker-simplesamlphp/workflows/CI/badge.svg](https://github.com/kenchan0130/docker-simplesamlphp/actions?query=workflow%3ACI)
用于开发和测试的即插即用型SAML 2.0身份提供商(IdP) Docker容器。
基于SimpleSAMLphp构建,以https://hub.docker.com/_/php/%E4%B8%BA%E5%9F%BA%E7%A1%80%E3%80%82
SimpleSAMLphp以调试日志级别将日志输出到stdout,Apache将错误日志和访问日志输出到stdout。
禁止在生产环境中使用。此镜像仅用于测试。
shdocker run --name=idp \ -p 8080:8080 \ -e SIMPLESAMLPHP_SP_ENTITY_ID=http://app.example.com \ -e SIMPLESAMLPHP_SP_ASSERTION_CONSUMER_SERVICE=http://localhost/simplesaml/module.php/saml/sp/saml2-acs.php/test-sp \ -e SIMPLESAMLPHP_SP_SINGLE_LOGOUT_SERVICE=http://localhost/simplesaml/module.php/saml/sp/saml2-logout.php/test-sp \ -d kenchan0130/simplesamlphp
ymlversion: "3" services: idp: image: kenchan0130/simplesamlphp container_name: idp ports: - "8080:8080" environment: SIMPLESAMLPHP_SP_ENTITY_ID: http://app.example.com SIMPLESAMLPHP_SP_ASSERTION_CONSUMER_SERVICE: http://localhost/simplesaml/module.php/saml/sp/saml2-acs.php/test-sp SIMPLESAMLPHP_SP_SINGLE_LOGOUT_SERVICE: http://localhost/simplesaml/module.php/saml/sp/saml2-logout.php/test-sp
IdP中配置了两个静态用户,信息如下:
| 用户名 | 密码 |
|---|---|
| user1 | password |
| user2 | password |
还有一个管理员用户:
| 用户名 | 密码 |
|---|---|
| admin | secret |
| 名称 | 必填/可选 | 描述 |
|---|---|---|
SIMPLESAMLPHP_SP_ENTITY_ID | 必填 | 服务提供者(SP)的实体ID。 |
SIMPLESAMLPHP_SP_ASSERTION_CONSUMER_SERVICE | 必填 | SP的断言消费者服务URL。 |
SIMPLESAMLPHP_SP_SINGLE_LOGOUT_SERVICE | 可选 | SP的单点登出URL。 |
SIMPLESAMLPHP_IDP_ADMIN_PASSWORD | 可选 | IdP管理员密码。默认值为secret。 |
SIMPLESAMLPHP_IDP_SECRET_SALT | 可选 | IdP生成安全哈希时使用的秘密盐。默认值为defaultsecretsalt。 |
SIMPLESAMLPHP_IDP_SESSION_DURATION_SECONDS | 可选 | IdP会话持续时间(秒)。 |
SIMPLESAMLPHP_IDP_BASE_URL | 可选 | 用于覆盖基础URL。在反向代理后设置https://基础URL时很有用。如果设置此变量,请以斜杠/结尾,例如:https://my.proxy.com/。默认值为空字符串。 |
如需自定义IdP用户,可通过挂载配置文件定义自己的用户。
php<?php // 这些属性模拟Azure AD的属性 $test_user_base = array( 'http://schemas.microsoft.com/identity/claims/tenantid' => 'ab4f07dc-b661-48a3-a173-d0103d6981b2', 'http://schemas.microsoft.com/identity/claims/objectidentifier' => '', 'http://schemas.microsoft.com/identity/claims/displayname' => '', 'http://schemas.microsoft.com/ws/2008/06/identity/claims/groups' => array(), 'http://schemas.microsoft.com/identity/claims/identityprovider' => 'https://sts.windows.net/da2a1472-abd3-47c9-95a4-4a0068312122/', 'http://schemas.microsoft.com/claims/authnmethodsreferences' => array('http://schemas.microsoft.com/ws/2008/06/identity/authenticationmethod/password', 'http://schemas.microsoft.com/claims/multipleauthn'), 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress' => '', 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname' => '', 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname' => '', 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name' => '' ); $config = array( 'admin' => array( 'core:AdminPassword', ), 'example-userpass' => array( 'exampleauth:UserPass', 'user1:password' => array_merge($test_user_base, array( 'http://schemas.microsoft.com/identity/claims/objectidentifier' => 'f2d75402-e1ae-40fe-8cc9-98ca1ab9cd5e', 'http://schemas.microsoft.com/identity/claims/displayname' => 'User1 Taro', 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress' => 'user1@example.com', 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname' => 'Taro', 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname' => 'User1', 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name' => 'user1@example.com' )), 'user2:password' => array_merge($test_user_base, array( 'http://schemas.microsoft.com/identity/claims/objectidentifier' => 'f2a94916-2fcb-4b68-9eb1-5436309006a3', 'http://schemas.microsoft.com/identity/claims/displayname' => 'User2 Taro', 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress' => 'user2@example.com', 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname' => 'Taro', 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname' => 'User2', 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name' => 'user2@example.com' )), ), );
将此代码保存为authsources.php后,可通过卷挂载自定义IdP用户:
docker run命令
shdocker run --name=idp \ -p 8080:8080 \ -e SIMPLESAMLPHP_SP_ENTITY_ID=http://app.example.com \ -e SIMPLESAMLPHP_SP_ASSERTION_CONSUMER_SERVICE=http://localhost/simplesaml/module.php/saml/sp/saml2-acs.php/test-sp \ -e SIMPLESAMLPHP_SP_SINGLE_LOGOUT_SERVICE=http://localhost/simplesaml/module.php/saml/sp/saml2-logout.php/test-sp \ -v $PWD/authsources.php:/var/www/simplesamlphp/config/authsources.php \ -d kenchan0130/simplesamlphp
docker-compose
ymlversion: "3" services: idp: image: kenchan0130/simplesamlphp container_name: idp ports: - "8080:8080" environment: SIMPLESAMLPHP_SP_ENTITY_ID: http://app.example.com SIMPLESAMLPHP_SP_ASSERTION_CONSUMER_SERVICE: http://localhost/simplesaml/module.php/saml/sp/saml2-acs.php/test-sp SIMPLESAMLPHP_SP_SINGLE_LOGOUT_SERVICE: http://localhost/simplesaml/module.php/saml/sp/saml2-logout.php/test-sp volumes: - authsources.php:/var/www/simplesamlphp/config/authsources.php
有关详细属性,请参见SimpleSAMLphp身份提供商快速入门#认证模块。
如需自定义SP远程元数据引用,可通过挂载配置文件进行定义。
php<?php /* 数组的索引是此SP的实体ID */ $metadata['entity-id-1'] = array( 'AssertionConsumerService' => 'http://localhost/simplesaml/module.php/saml/sp/saml2-acs.php/test-sp', ForceAuthn => true ); $metadata['entity-id-2'] = array( 'AssertionConsumerService' => 'http://localhost/saml/acs', 'SingleLogoutService' => 'http://localhost/saml/logout' );
将此代码保存为saml20-sp-remote.php后,可通过卷挂载自定义:
docker run命令
shdocker run --name=idp \ -p 8080:8080 \ -v saml20-sp-remote.php:/var/www/simplesamlphp/metadata/saml20-sp-remote.php \ -d kenchan0130/simplesamlphp
docker-compose
ymlversion: "3" services: idp: image: kenchan0130/simplesamlphp container_name: idp ports: - "8080:8080" volumes: - saml20-sp-remote.php:/var/www/simplesamlphp/metadata/saml20-sp-remote.php
有关详细属性,请参见SP远程元数据引用#SAML 2.0选项。
MIT
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
docker search 限制
站内搜不到镜像
离线 save/load
插件要用 plugin install
WSL 拉取慢
安全与 digest
新手拉取配置
镜像合规机制
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
域名连通性排查
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务