src/Saml.php
public function retrieveUserFromAssertion(Assertion $assertion)
    {
        $user = null;
        $role = null;

        foreach ($assertion->getAllAttributeStatements() as $attributeStatement) {
            foreach ($attributeStatement->getAllAttributes() as $attribute) {
                switch ($attribute->getName()) {
                    case 'user_entity':
                        $user = new User(\json_decode($attribute->getFirstAttributeValue(), true));
                        break;
                    case ClaimTypes::ROLE:
                        $role = $attribute->getFirstAttributeValue();
                }
            }
        }

        if ($user instanceof User) {
            $user->setCurrentRole($role);
        }

        return $user;
    }
public function retrieveUserFromAssertion(Assertion $assertion)
    {
        $user = null;
        $role = null;

        foreach ($assertion->getAllAttributeStatements() as $attributeStatement) {
            foreach ($attributeStatement->getAllAttributes() as $attribute) {
                switch ($attribute->getName()) {
                    case 'user_entity':
                        $user = new User(\json_decode($attribute->getFirstAttributeValue(), true));
                        break;
                    case ClaimTypes::ROLE:
                        $role = $attribute->getFirstAttributeValue();
                }
            }
        }

        if ($user instanceof User) {
            $user->setCurrentRole($role);
        }

        return $user;
    }
public function retrieveUserFromAssertion ( Assertion $ assertion ) { $ user = null ; $ role = null ; foreach ( $ assertion -> getAllAttributeStatements ( ) as $ attributeStatement ) { foreach ( $ attributeStatement -> getAllAttributes ( ) as $ attribute ) { switch ( $ attribute -> getName ( ) ) { case 'user_entity' : $ user = new User ( \ json_decode ( $ attribute -> getFirstAttributeValue ( ) , true ) ) ; break ; case ClaimTypes :: ROLE : $ role = $ attribute -> getFirstAttributeValue ( ) ; } } } if ( $ user instanceof User ) { $ user -> setCurrentRole ( $ role ) ; } return $ user ; }
Retrieves a User instance from Response Assertion send by IdP

@param Assertion $assertion

@return User
Retrieves a User instance from Response Assertion send by IdP