mehr-als-nix / zf2-saml
SAML Authentication module for ZF-2.
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-10-29 04:04:03 UTC
README
SAML authentication module for ZF2.
This module uses onelogin/php-saml
internally and wrap the function in services.
Installation
Just require mehr-als-nix/zf-saml
in your composer.json
.
Enable it in application.config.php
'modules' => array (
// ---8<---
'ZF\ApiProblem',
'ZF\ContentNegotiation',
'MehrAlsNix\ZF\SAML',
// --->8---
),
Configuration
Copy saml.local.php.dist
to config/autoload/saml.local.php
Services
MehrAlsNix\ZF\SAML\Service\SAML2Auth
Provides an instance of OneLogin_Saml2_Auth
MehrAlsNix\ZF\SAML\Service\SAML2AuthnRequest
Provides an instance of OneLogin_Saml2_AuthnRequest
MehrAlsNix\ZF\SAML\Service\SAML2Metadata
Provides an instance of OneLogin_Saml2_Metadata
MehrAlsNix\ZF\SAML\Service\SAML2Response
Provides an instance of OneLogin_Saml2_Response
MehrAlsNix\ZF\SAML\Service\SAML2Settings
Provides an instance of OneLogin_Saml2_Settings
API protection
Assume $this->samlAuth
contains an instance of OneLogin_Saml2_Auth
, then
you would be able to protect your API.
if (!$this->samlAuth->isAuthenticated()) {
$this->getResponse()->setStatusCode(401);
return;
}