Skip to content

Commit

Permalink
[steam] Fix "realm and return_to do not match" when using HTTP (#433)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilumos authored Jun 9, 2020
1 parent ef25e72 commit 9e090fe
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ class Provider extends AbstractProvider
*/
const OPENID_NS = 'http://specs.openid.net/auth/2.0';

/**
* @var string
*/
const OPENID_ERROR = 'openid_error';

/**
* {@inheritdoc}
*/
Expand All @@ -80,7 +85,9 @@ protected function getAuthUrl($state)
public function user()
{
if (!$this->validate()) {
throw new OpenIDValidationException('Failed to validate openID login');
$error = $this->getParams()['openid.error'] ?? 'unknown error';

throw new OpenIDValidationException('Failed to validate OpenID login: '.$error);
}

return $this->mapUserToObject($this->getUserByToken($this->steamId));
Expand Down Expand Up @@ -144,7 +151,7 @@ private function buildUrl()
'openid.ns' => self::OPENID_NS,
'openid.mode' => 'checkid_setup',
'openid.return_to' => $this->redirectUrl,
'openid.realm' => sprintf('https://%s', $realm),
'openid.realm' => sprintf('%s://%s', $this->request->getScheme(), $realm),
'openid.identity' => 'http://specs.openid.net/auth/2.0/identifier_select',
'openid.claimed_id' => 'http://specs.openid.net/auth/2.0/identifier_select',
];
Expand Down Expand Up @@ -222,6 +229,7 @@ public function getParams()
'openid.sig' => $this->request->get(self::OPENID_SIG),
'openid.ns' => self::OPENID_NS,
'openid.mode' => 'check_authentication',
'openid.error' => $this->request->get(self::OPENID_ERROR),
];

$signedParams = explode(',', $this->request->get(self::OPENID_SIGNED));
Expand Down

0 comments on commit 9e090fe

Please sign in to comment.