stellarbit / saml2
来自SimpleSAMLphp的SAML2 PHP库
3.4.4
2022-11-08 11:25 UTC
Requires
- php: >=5.4
- ext-dom: *
- ext-openssl: *
- ext-zlib: *
- psr/log: ~1.0
- robrichards/xmlseclibs: ^3.0.4
- webmozart/assert: ^1.4
Requires (Dev)
- mockery/mockery: ~0.9
- phpmd/phpmd: ~2.6
- phpunit/phpunit: ~5.7
- sebastian/phpcpd: ~2.0
- sensiolabs/security-checker: ~4.1
- simplesamlphp/simplesamlphp-test-framework: 0.0.11
- squizlabs/php_codesniffer: ~3.2
This package is auto-updated.
Last update: 2024-09-08 15:23:54 UTC
README
这是一个用于SAML2相关功能的PHP库。它从SimpleSAMLphp中提取出来,由OpenConext使用。这个库最初是由UNINETT和SURFnet合作开发的,但任何人都可以贡献。
在您使用它之前
除非您非常熟悉SAML2规范,否则请勿使用此库。
如果您不熟悉SAML2规范,只是想使用SAML2连接应用程序,您可能应该使用SimpleSAMLphp。
请注意,在SimpleSAMLphp之外,HTTP Artifact绑定和SOAP客户端不工作。
选择哪个版本?
最新发布的版本(3.x
范围)是唯一支持的版本。
所有其他分支(2.x
及更早版本)不再受支持,将不会收到任何维护或(安全)修复。请勿使用这些版本。
使用方法
- 使用Composer安装,在您的项目中运行以下命令
composer require simplesamlphp/saml2:^3.0
-
通过扩展和实现
SAML2\Compat\AbstractContainer
并提供所需的外部依赖项,然后将它注入到ContainerSingleton中(见以下示例)。 -
请确保您已经阅读了下面的安全部分.
-
随意使用。示例
// Use Composers autoloading require 'vendor/autoload.php'; // Implement the Container interface (out of scope for example) require 'container.php'; SAML2\Compat\ContainerSingleton::setContainer($container); // Set up an AuthnRequest $request = new SAML2\AuthnRequest(); $request->setId($container->generateId()); $request->setIssuer('https://sp.example.edu'); $request->setDestination('https://idp.example.edu'); // Send it off using the HTTP-Redirect binding $binding = new SAML2\HTTPRedirect(); $binding->send($request);
安全
- 如果您需要创建一个DOMDocument实例,请使用
SAML2\DOMDocumentFactory
从字符串(SAML2\DOMDocumentFactory::fromString($theXmlAsString)
)、文件(SAML2\DOMDocumentFactory::fromFile($pathToTheFile)
)或一个新实例(SAML2\DOMDocumentFactory::create()
)创建DOMDocuments。这样做是为了保护您免受XXE处理漏洞以及XML实体扩展攻击的侵害。
许可
此库在LGPL许可证版本2.1下授权。有关更多详细信息,请参阅LICENSE。