Fetches the authenticated user data upon redirect. This method should be called by the handler that receives the redirect from the `authenticate_redirect()` method (which is often the same as the one that calls it; in that case you would call `get_authenticated_user`
(
self, http_client: Optional[httpclient.AsyncHTTPClient] = None
)
| 114 | handler.redirect(endpoint + "?" + urllib.parse.urlencode(args)) |
| 115 | |
| 116 | async def get_authenticated_user( |
| 117 | self, http_client: Optional[httpclient.AsyncHTTPClient] = None |
| 118 | ) -> Dict[str, Any]: |
| 119 | """Fetches the authenticated user data upon redirect. |
| 120 | |
| 121 | This method should be called by the handler that receives the |
| 122 | redirect from the `authenticate_redirect()` method (which is |
| 123 | often the same as the one that calls it; in that case you would |
| 124 | call `get_authenticated_user` if the ``openid.mode`` parameter |
| 125 | is present and `authenticate_redirect` if it is not). |
| 126 | |
| 127 | The result of this method will generally be used to set a cookie. |
| 128 | |
| 129 | .. versionchanged:: 6.0 |
| 130 | |
| 131 | The ``callback`` argument was removed. Use the returned |
| 132 | awaitable object instead. |
| 133 | """ |
| 134 | handler = cast(RequestHandler, self) |
| 135 | # Verify the OpenID response via direct request to the OP |
| 136 | args = dict( |
| 137 | (k, v[-1]) for k, v in handler.request.arguments.items() |
| 138 | ) # type: Dict[str, Union[str, bytes]] |
| 139 | args["openid.mode"] = u"check_authentication" |
| 140 | url = self._OPENID_ENDPOINT # type: ignore |
| 141 | if http_client is None: |
| 142 | http_client = self.get_auth_http_client() |
| 143 | resp = await http_client.fetch( |
| 144 | url, method="POST", body=urllib.parse.urlencode(args) |
| 145 | ) |
| 146 | return self._on_authentication_verified(resp) |
| 147 | |
| 148 | def _openid_args( |
| 149 | self, |
nothing calls this directly
no test coverage detected