feat: link local library
This commit is contained in:
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic import BaseModel, HttpUrl, Json
|
||||
|
||||
|
||||
class AdvancedEntityListRequest(BaseModel):
|
||||
page : Optional[int]
|
||||
|
||||
def example(): # pragma: no cover
|
||||
return AdvancedEntityListRequest(
|
||||
page= 1,
|
||||
)
|
||||
|
||||
|
||||
class AdvancedEntityListResponse(BaseModel):
|
||||
iss: HttpUrl
|
||||
iat: int
|
||||
entities: List[Json]
|
||||
page: int
|
||||
total_pages: int
|
||||
total_entries: int
|
||||
next_page_path: str
|
||||
prev_page_path: str
|
||||
|
||||
def example(): # pragma: no cover
|
||||
return AdvancedEntityListResponse(
|
||||
iss= "https://registry.spid.gov.it/",
|
||||
iat= 1620050972,
|
||||
entities= [
|
||||
# "{'https://rp.example.it/spid': {'iat': 1588455866} }",
|
||||
# "{'https://rp.another.it/spid': {'iat': 1588455866} }"
|
||||
],
|
||||
page= 1,
|
||||
total_pages= 2,
|
||||
total_entries= 189,
|
||||
next_page_path= "/federation_adv_list/?page=2",
|
||||
prev_page_path= ""
|
||||
)
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
|
||||
from typing import Literal, Optional
|
||||
|
||||
from pydantic import BaseModel, HttpUrl, constr
|
||||
|
||||
|
||||
class FetchRequest(BaseModel):
|
||||
# OpenID Federation 8.1.1: sub REQUIRED; issuer implied by fetch endpoint URL
|
||||
sub: HttpUrl
|
||||
|
||||
def example(): # pragma: no cover
|
||||
return FetchRequest(sub="http://127.0.0.1:8000/oidc/rp")
|
||||
|
||||
|
||||
class FetchResponse(BaseModel):
|
||||
jose : constr(regex=r"^[a-zA-Z\_\-0-9]+\.[a-zA-Z\_\-0-9]+\.[a-zA-Z\_\-0-9]+") # noqa: F722
|
||||
|
||||
|
||||
class FedAPIErrorResponse(BaseModel):
|
||||
operation: Optional[str]
|
||||
error: Literal[
|
||||
"invalid_request",
|
||||
"invalid_client",
|
||||
"invalid_issuer",
|
||||
"invalid_subject",
|
||||
"invalid_trust_anchor",
|
||||
"invalid_trust_chain",
|
||||
"invalid_metadata",
|
||||
"not_found",
|
||||
"server_error",
|
||||
"temporarily_unavailable",
|
||||
"unsupported_parameter",
|
||||
]
|
||||
error_description: str
|
||||
@@ -0,0 +1,20 @@
|
||||
from typing import List, Literal, Optional, Union
|
||||
|
||||
from pydantic import BaseModel, HttpUrl
|
||||
|
||||
|
||||
class ListRequest(BaseModel):
|
||||
# OpenID Federation 8.2.1: optional filters
|
||||
entity_type: Optional[
|
||||
Literal["openid_relying_party", "openid_provider", "oauth_resource", "federation_entity"]
|
||||
] = None
|
||||
trust_marked: Optional[bool] = None
|
||||
trust_mark_type: Optional[Union[HttpUrl, str]] = None
|
||||
intermediate: Optional[bool] = None
|
||||
|
||||
def example(): # pragma: no cover
|
||||
return ListRequest(entity_type="openid_provider")
|
||||
|
||||
|
||||
class ListResponse(BaseModel):
|
||||
response: List[HttpUrl]
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
|
||||
from typing import Literal, Optional
|
||||
|
||||
from pydantic import BaseModel, HttpUrl, constr
|
||||
|
||||
# JWT pattern (three base64url segments) to avoid flake8 F722 on constr(regex=...)
|
||||
_JWT_PATTERN = r"^[a-zA-Z\_\-0-9]+\.[a-zA-Z\_\-0-9]+\.[a-zA-Z\_\-0-9]+"
|
||||
|
||||
|
||||
class TrustMarkRequest(BaseModel):
|
||||
# Draft 48: trust_mark (JWT) REQUIRED for new flow
|
||||
trust_mark: Optional[constr(regex=_JWT_PATTERN)]
|
||||
# Retrocompat: sub + trust_mark_id / trust_mark_type / id
|
||||
sub: Optional[HttpUrl]
|
||||
trust_mark_id: Optional[HttpUrl]
|
||||
trust_mark_type: Optional[HttpUrl]
|
||||
id: Optional[HttpUrl]
|
||||
|
||||
def example(): # pragma: no cover
|
||||
return TrustMarkRequest(
|
||||
trust_mark_type="https://www.spid.gov.it/openid-federation/agreement/op-public/",
|
||||
sub="http://127.0.0.1:8000/oidc/op",
|
||||
)
|
||||
|
||||
|
||||
class TrustMarkResponse(BaseModel):
|
||||
active: bool
|
||||
|
||||
|
||||
# OpenID Federation 8.4.2: Trust Mark Status Response JWT claims
|
||||
class TrustMarkStatusResponsePayload(BaseModel):
|
||||
iss: str # Entity Identifier of the issuer (Trust Mark Issuer)
|
||||
iat: int
|
||||
trust_mark: str # The Trust Mark JWT this status is about
|
||||
status: Literal["active", "expired", "revoked", "invalid"]
|
||||
Reference in New Issue
Block a user