1. Go to this page and download the library: Download fillup/zfauthsaml library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
return array(
'identity_provider' => 'ZfAuthSaml\Provider\Identity\SamlIdentityProvider',
'role_providers' => array(
// format: user_role(role_id(varchar), parent(varchar))
'BjyAuthorize\Provider\Role\Config' => array(
'guest' => array(),
'user' => array(),
// List any groups that from SMAL that you want to identify with
// in your application. You could also load them from a database.
// The SamlIdentityProvider will only return roles that are defined
// here and are part of the user's identity from the IdP
),
),
'guards' => array(
// Setup your rules for various controllers/actions, these are just some examples.
'BjyAuthorize\Guard\Controller' => array(
array('controller' => 'Application\Controller\Index', 'roles' => array('users')),
array('controller' => 'zfauthsaml', 'roles' => array('users')),
// Make sure you allow guests access to these two actions so they can actually login:
array('controller' => 'zfauthsaml', 'action' => array('login','return'), 'roles' => array('guest')),
),
),
'unauthorized_strategy' => 'ZfAuthSaml\View\RedirectionStrategy',
);