-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception thrown when user needs to be re-authenticated #73
Comments
Dug deeper. When the security component compares the serialized user object (from session) with a fresh one on a new request, and the comparison fails for whatever reason, the token will be set to unauthenticated, which makes sense. This should essentially log the user out and force a re-authentication. When you have code in your app that checks for authorization, like the However, an This exception is being thrown because when the However, the real problem here is that even if it DID have the manager object, the validation would FAIL because the Cas token was already used. I don't know the solution here. I may open a bug report w/ security component to get some feedback on these findings. |
OK, looks like this can be resolved. I believe all that needs to happen is the authentication provider first check for the existence of the manager object, which it needs for validation. If it doesn't exist, then throw an Doing so will actually trigger the entire authentication process for the user, by running our firewall entry point, exactly what we want. |
Hello, I got the same error. public function serialize()
{
return serialize(array($this->credentials, $this->manager, parent::serialize()));
}
public function unserialize($str)
{
list($this->credentials, $this->provider, $parentStr) = unserialize($str);
parent::unserialize($parentStr);
} |
Looks like #16 references this issue, but the "fix" doesn't appear to actually be a fix. I think there's a real bug present when a user needs to be re-authenticated.
My user class implements
EquatableInterface
and I have a methodisEqualTo
which determines if the serializedUser
object is the same as the refreshedUser
object. The behavior of comparing these two objects is described towards the bottom of this Cookbook page.When the user has indeed changed, like a new role being added, my
isEqualTo
method properly returns false. However, I then get the following exception:Looks like the
$token
that's passed toauthenticate
onSsoAuthenticationProvider
does not have its$manager
property set. Not sure why, I've been struggling to understand the complexities of the Security component for a few days now.The text was updated successfully, but these errors were encountered: