From: Ben Darnell Date: Mon, 12 Apr 2010 23:06:39 +0000 (-0700) Subject: Use the original request's protocol as the openid realm instead of hard-coding X-Git-Tag: v1.0.0~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc00b61751bc5be9505db03408db93a9cd00f7f0;p=thirdparty%2Ftornado.git Use the original request's protocol as the openid realm instead of hard-coding http. --- diff --git a/tornado/auth.py b/tornado/auth.py index f67d9e548..ab5948e54 100644 --- a/tornado/auth.py +++ b/tornado/auth.py @@ -37,7 +37,7 @@ class GoogleHandler(tornado.web.RequestHandler, tornado.auth.GoogleMixin): self.get_authenticated_user(self.async_callback(self._on_auth)) return self.authenticate_redirect() - + def _on_auth(self, user): if not user: raise tornado.web.HTTPError(500, "Google auth failed") @@ -100,12 +100,12 @@ class OpenIdMixin(object): url = urlparse.urljoin(self.request.full_url(), callback_uri) args = { "openid.ns": "http://specs.openid.net/auth/2.0", - "openid.claimed_id": + "openid.claimed_id": "http://specs.openid.net/auth/2.0/identifier_select", - "openid.identity": + "openid.identity": "http://specs.openid.net/auth/2.0/identifier_select", "openid.return_to": url, - "openid.realm": "http://" + self.request.host + "/", + "openid.realm": self.request.protocol + "://" + self.request.host + "/", "openid.mode": "checkid_setup", } if ax_attrs: @@ -352,7 +352,7 @@ class TwitterMixin(OAuthMixin): self.get_authenticated_user(self.async_callback(self._on_auth)) return self.authorize_redirect() - + def _on_auth(self, user): if not user: raise tornado.web.HTTPError(500, "Twitter auth failed") @@ -439,7 +439,7 @@ class TwitterMixin(OAuthMixin): callback=callback) else: http.fetch(url, callback=callback) - + def _on_twitter_request(self, callback, response): if response.error: _log.warning("Error response %s fetching %s", response.error, @@ -488,7 +488,7 @@ class FriendFeedMixin(OAuthMixin): self.get_authenticated_user(self.async_callback(self._on_auth)) return self.authorize_redirect() - + def _on_auth(self, user): if not user: raise tornado.web.HTTPError(500, "FriendFeed auth failed") @@ -559,7 +559,7 @@ class FriendFeedMixin(OAuthMixin): callback=callback) else: http.fetch(url, callback=callback) - + def _on_friendfeed_request(self, callback, response): if response.error: _log.warning("Error response %s fetching %s", response.error, @@ -605,7 +605,7 @@ class GoogleMixin(OpenIdMixin, OAuthMixin): self.get_authenticated_user(self.async_callback(self._on_auth)) return self.authenticate_redirect() - + def _on_auth(self, user): if not user: raise tornado.web.HTTPError(500, "Google auth failed") @@ -681,7 +681,7 @@ class FacebookMixin(object): self.get_authenticated_user(self.async_callback(self._on_auth)) return self.authenticate_redirect() - + def _on_auth(self, user): if not user: raise tornado.web.HTTPError(500, "Facebook auth failed")