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
)
| 129 | handler.redirect(endpoint + "?" + urllib.parse.urlencode(args)) |
| 130 | |
| 131 | async def get_authenticated_user( |
| 132 | self, http_client: Optional[httpclient.AsyncHTTPClient] = None |
| 133 | ) -> Dict[str, Any]: |
| 134 | """Fetches the authenticated user data upon redirect. |
| 135 | |
| 136 | This method should be called by the handler that receives the |
| 137 | redirect from the `authenticate_redirect()` method (which is |
| 138 | often the same as the one that calls it; in that case you would |
| 139 | call `get_authenticated_user` if the ``openid.mode`` parameter |
| 140 | is present and `authenticate_redirect` if it is not). |
| 141 | |
| 142 | The result of this method will generally be used to set a cookie. |
| 143 | |
| 144 | .. versionchanged:: 6.0 |
| 145 | |
| 146 | The ``callback`` argument was removed. Use the returned |
| 147 | awaitable object instead. |
| 148 | """ |
| 149 | handler = cast(RequestHandler, self) |
| 150 | # Verify the OpenID response via direct request to the OP |
| 151 | args = { |
| 152 | k: v[-1] for k, v in handler.request.arguments.items() |
| 153 | } # type: Dict[str, Union[str, bytes]] |
| 154 | args["openid.mode"] = "check_authentication" |
| 155 | url = self._OPENID_ENDPOINT # type: ignore |
| 156 | if http_client is None: |
| 157 | http_client = self.get_auth_http_client() |
| 158 | resp = await http_client.fetch( |
| 159 | url, method="POST", body=urllib.parse.urlencode(args) |
| 160 | ) |
| 161 | return self._on_authentication_verified(resp) |
| 162 | |
| 163 | def _openid_args( |
| 164 | self, |
nothing calls this directly
no test coverage detected