Closed wax13003 closed 6 years ago
Seems like your user getRoles is returning null and by UserInterface it should return array
Thanks, I have checked my User Entity, it has getRoles, and my user table has the roles field. May I know how to check the error with null given by getRoles? Thanks, I am following the steps by https://www.lightsaml.com/SP-Bundle/Getting-started/
/**
@ORM\Entity() */ class User implements UserInterface, \Serializable { /**
/**
/**
/**
/**
solved
How? What was the problem?
came with an error below:
Catchable Fatal Error: Argument 1 passed to LightSaml\SpBundle\Security\Authentication\Token\SamlSpToken::__construct() must be of the type array, null given,
When I checked the token created in SamlSpTokenFactory, didn't create the roles while that could not be null in SamlSpToken->__construct. Could anyone help me with this?
in vendor/lightsaml/sp-bundle/src/LightSaml/SpBundle/Security/Authentication/Token/SamlSpToken.php (line 27) SamlSpToken->__construct(null, 'main', array('username' => 'johndoe', 'email' => 'john@doe.com'), object(User)) in vendor/lightsaml/sp-bundle/src/LightSaml/SpBundle/Security/Authentication/Token/SamlSpTokenFactory.php (line 34) $token = new SamlSpToken( $user instanceof UserInterface ? $user->getRoles() : [], $providerKey, $attributes, $user ); return $token; }} SamlSpTokenFactory->create('main', array('username' => 'johndoe', 'email' => 'john@doe.com'), object(User), object(SamlSpResponseToken)) in vendor/lightsaml/sp-bundle/src/LightSaml/SpBundle/Security/Authentication/Provider/LightsSamlSpAuthenticationProvider.php (line 137) $result = $this->tokenFactory->create( $this->providerKey, $attributes, $user, $token ); } else { $result = new SamlSpToken( $user instanceof UserInterface ? $user->getRoles() : [], $this->providerKey, $attributes,