mehr-als-nix / zf2-saml
ZF-2 的 SAML 认证模块。
dev-develop
2016-10-15 13:40 UTC
Requires
- php: >=5.5
- onelogin/php-saml: ~2.10
- zendframework/zend-crypt: ~2.3
- zendframework/zend-http: ~2.3
- zendframework/zend-mvc: ~2.3
- zendframework/zend-servicemanager: ~2.3
- zendframework/zend-session: ~2.3
- zfcampus/zf-api-problem: ~1.0
- zfcampus/zf-content-negotiation: ~1.0
Requires (Dev)
- phpunit/phpunit: ~4.0
- squizlabs/php_codesniffer: ^2.3.1
- zendframework/zend-i18n: ~2.3
- zendframework/zend-log: ~2.3
- zendframework/zend-modulemanager: ~2.3
- zendframework/zend-serializer: ~2.3
- zendframework/zend-test: ~2.3
This package is auto-updated.
Last update: 2024-08-29 03:37:26 UTC
README
为 ZF2 的 SAML 认证模块。
此模块内部使用 onelogin/php-saml
并将功能封装在服务中。
安装
只需在您的 composer.json
中引入 mehr-als-nix/zf-saml
。
在 application.config.php
中启用它
'modules' => array (
// ---8<---
'ZF\ApiProblem',
'ZF\ContentNegotiation',
'MehrAlsNix\ZF\SAML',
// --->8---
),
配置
将 saml.local.php.dist
复制到 config/autoload/saml.local.php
服务
MehrAlsNix\ZF\SAML\Service\SAML2Auth
提供一个 OneLogin_Saml2_Auth
的实例
MehrAlsNix\ZF\SAML\Service\SAML2AuthnRequest
提供一个 OneLogin_Saml2_AuthnRequest
的实例
MehrAlsNix\ZF\SAML\Service\SAML2Metadata
提供一个 OneLogin_Saml2_Metadata
的实例
MehrAlsNix\ZF\SAML\Service\SAML2Response
提供一个 OneLogin_Saml2_Response
的实例
MehrAlsNix\ZF\SAML\Service\SAML2Settings
提供一个 OneLogin_Saml2_Settings
的实例
API 保护
假设 $this->samlAuth
包含一个 OneLogin_Saml2_Auth
的实例,那么您将能够保护您的 API。
if (!$this->samlAuth->isAuthenticated()) {
$this->getResponse()->setStatusCode(401);
return;
}