1. Go to this page and download the library: Download ae/oneloginsaml-bundle 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/ */
ae / oneloginsaml-bundle example snippets
php
$bundles = array(
// ...
new AE\OneLoginSamlBundle\AEOneLoginSamlBundle(),
)
php
namespace AppBundle\Entity;
use AE\OneLoginSamlBundle\Security\User\SamlUserInterface;
class User implements SamlUserInterface
{
protected $username;
protected $email;
// ...
public function setSamlAttributes(array $attributes)
{
$this->email = $attributes['mail'][0];
}
}
php
$email = $this->getUser()->getEmail();
php
namespace AppBundle\Security;
use AppBundle\Entity\User;
use AE\OneLoginSamlBundle\Security\Authentication\Token\SamlTokenInterface;
use AE\OneLoginSamlBundle\Security\User\SamlUserFactoryInterface;
class UserFactory implements SamlUserFactoryInterface
{
public function createUser(SamlTokenInterface $token)
{
$attributes = $token->getAttributes();
$user = new User();
$user->setRoles(array('ROLE_USER'));
$user->setUsername($token->getUsername());
$user->setPassword('notused');
$user->setEmail($attributes['mail'][0]);
$user->setName($attributes['cn'][0]);
return $user;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.