| 1 | from typing import Any |
| 2 | |
| 3 | from .base import AuthenticationBase |
| 4 | |
| 5 | |
| 6 | |
| 7 | class PushedAuthorizationRequests(AuthenticationBase): |
| 8 | """Pushed Authorization Request (PAR) endpoint""" |
| 9 | |
| 10 | def pushed_authorization_request( |
| 11 | self, response_type: str, redirect_uri: str, **kwargs |
| 12 | ) -> Any: |
| 13 | """Send a Pushed Authorization Request (PAR). |
| 14 | |
| 15 | Args: |
| 16 | response_type (str): Indicates to Auth0 which OAuth 2.0 flow you want to perform. |
| 17 | redirect_uri (str): The URL to which Auth0 will redirect the browser after authorization has been granted |
| 18 | by the user. |
| 19 | **kwargs: Other fields to send along with the PAR. |
| 20 | For RAR requests, authorization_details parameter should be added in a proper format. See:https://datatracker.ietf.org/doc/html/rfc9396 |
| 21 | For JAR requests, requests parameter should be send with the JWT as the value. See: https://datatracker.ietf.org/doc/html/rfc9126#name-the-request-request-paramet |
| 22 | |
| 23 | See: https://www.rfc-editor.org/rfc/rfc9126.html |
| 24 | """ |
| 25 | return self.authenticated_post( |
| 26 | f"{self.protocol}://{self.domain}/oauth/par", |
| 27 | data={ |
| 28 | "client_id":self.client_id, |
| 29 | "client_secret":self.client_secret, |
| 30 | "response_type": response_type, |
| 31 | "redirect_uri": redirect_uri, |
| 32 | **kwargs, |
| 33 | }, |
| 34 | headers={"Content-Type": "application/x-www-form-urlencoded"}, |
| 35 | ) |