Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

fix firewall to answer all login entry points in v1.0 branch #36

Open
wants to merge 1 commit into
base: v1.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions Security/Firewall/TwitterListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,22 @@ class TwitterListener extends AbstractAuthenticationListener
{
protected function attemptAuthentication(Request $request)
{
if (true === $this->options['use_twitter_anywhere']) {
if (null === $identity = $request->cookies->get('twitter_anywhere_identity')) {
throw new AuthenticationException(sprintf('Identity cookie "twitter_anywhere_identity" was not sent.'));
}
if (false === $pos = strpos($identity, ':')) {
throw new AuthenticationException(sprintf('The submitted identity "%s" is invalid.', $identity));
}

return $this->authenticationManager->authenticate(TwitterAnywhereToken::createUnauthenticated(substr($identity, 0, $pos), substr($identity, $pos + 1)));
} else {
return $this->authenticationManager->authenticate(new TwitterUserToken());
if($request->getSession()->get("oauth_token", null) && $request->get("oauth_token", null) &&
$request->getSession()->get("oauth_token", null) === $request->get("oauth_token", null))
{
if (true === $this->options['use_twitter_anywhere']) {
if (null === $identity = $request->cookies->get('twitter_anywhere_identity')) {
throw new AuthenticationException(sprintf('Identity cookie "twitter_anywhere_identity" was not sent.'));
}
if (false === $pos = strpos($identity, ':')) {
throw new AuthenticationException(sprintf('The submitted identity "%s" is invalid.', $identity));
}

return $this->authenticationManager->authenticate(TwitterAnywhereToken::createUnauthenticated(substr($identity, 0, $pos), substr($identity, $pos + 1)));
} else {
return $this->authenticationManager->authenticate(new TwitterUserToken());
}
}
return null;
}
}