temp/saml2

SimpleSAMLphp 的 SAML2 PHP 库

v0.4.1 2014-02-26 11:19 UTC

This package is not auto-updated.

Last update: 2024-09-24 06:31:37 UTC


README

SAML2 相关功能的 PHP 库。从 SimpleSAMLphp 中提取,由 OpenConext 使用。这个库是 UNINETT 和 SURFnet 的合作成果。

使用前请阅读

除非您非常熟悉 SAML2 规范,否则请勿使用此库。

如果您不熟悉 SAML2 规范,但希望使用 SAML2 连接到您的应用程序,您可能应该使用 SimpleSAMLphp

虽然这个库标记为稳定,但它目前对开发者不够友好,其 API 未来可能会有很大变化。然而,它是各方合作的一个起点。所以请告诉我们您希望看到 PHP SAML2 库中的哪些功能。

请注意,HTTP Artifact 绑定和 SOAP 客户端在 SimpleSAMLphp 外部无法工作

使用方法

  • 使用 Composer 安装,在您的 composer.json 中添加以下内容
{
    "require": {
        "simplesamlphp/saml2": "0.1.*"
    }
}

然后运行 composer update

  • 通过扩展和实现 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(SAML2_Utils::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);

许可证

此库根据 LGPL 许可证版本 2.1 许可。更多详情请见 LICENSE