|
2 | 2 | from dataclasses import dataclass |
3 | 3 | from typing import Any, Literal |
4 | 4 |
|
5 | | -from pydantic import AnyHttpUrl, AnyUrl, BaseModel, Field, RootModel, ValidationError |
| 5 | +from pydantic import AnyUrl, BaseModel, Field, RootModel, ValidationError |
6 | 6 | from starlette.datastructures import FormData, QueryParams |
7 | 7 | from starlette.requests import Request |
8 | 8 | from starlette.responses import RedirectResponse, Response |
|
29 | 29 | class AuthorizationRequest(BaseModel): |
30 | 30 | # See https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.1 |
31 | 31 | client_id: str = Field(..., description="The client ID") |
32 | | - redirect_uri: AnyHttpUrl | None = Field( |
| 32 | + redirect_uri: AnyUrl | None = Field( |
33 | 33 | None, description="URL to redirect to after authorization" |
34 | 34 | ) |
35 | 35 |
|
@@ -68,8 +68,8 @@ def best_effort_extract_string( |
68 | 68 | return None |
69 | 69 |
|
70 | 70 |
|
71 | | -class AnyHttpUrlModel(RootModel[AnyHttpUrl]): |
72 | | - root: AnyHttpUrl |
| 71 | +class AnyUrlModel(RootModel[AnyUrl]): |
| 72 | + root: AnyUrl |
73 | 73 |
|
74 | 74 |
|
75 | 75 | @dataclass |
@@ -116,7 +116,7 @@ async def error_response( |
116 | 116 | if params is not None and "redirect_uri" not in params: |
117 | 117 | raw_redirect_uri = None |
118 | 118 | else: |
119 | | - raw_redirect_uri = AnyHttpUrlModel.model_validate( |
| 119 | + raw_redirect_uri = AnyUrlModel.model_validate( |
120 | 120 | best_effort_extract_string("redirect_uri", params) |
121 | 121 | ).root |
122 | 122 | redirect_uri = client.validate_redirect_uri(raw_redirect_uri) |
|
0 commit comments