-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: pydantic for dopo schema validation, jwk moved from tools to jwk
- Loading branch information
1 parent
79c53e6
commit 01f29f0
Showing
8 changed files
with
72 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
from pydantic import BaseModel, HttpUrl, validator | ||
|
||
from pyeudiw.jwk import JWK | ||
from pyeudiw.tools.jwt import JWSHelper | ||
|
||
from typing import List, Literal, Optional | ||
|
||
|
||
class DPoPTokenHeaderSchema(BaseModel): | ||
# header | ||
typ: Literal["dpop+jwt"] | ||
alg: Literal[ | ||
"RS256", | ||
"RS384", | ||
"RS512", | ||
"ES256", | ||
"ES384", | ||
"ES512", | ||
"PS256", | ||
"PS384", | ||
"PS512", | ||
] | ||
jwk: SINGLE_REQUIRED_JSON | ||
|
||
class DPoPTokenPayloadSchema(BaseModel): | ||
# body | ||
jti: str, | ||
htm: Literal["GET", "POST", "get", "post"], | ||
htu: HttpUrl | ||
iat: int | ||
ath: str | ||
|
||
|
||
class DPoPIssuer: | ||
def __init__(self, token :str, private_jwk :dict): | ||
self.token = token | ||
self.private_jwk = private_jwk | ||
|
||
def get_proof(self): | ||
pass | ||
|
||
|
||
class DPoPVerifier: | ||
def __init__( | ||
self, token :str, | ||
public_jwk :dict, | ||
http_header_authz :str, | ||
http_header_dpop :str | ||
): | ||
self.token = token | ||
self.public_jwk = private_jwk | ||
|
||
def validate_proof(self): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import pytest | ||
|
||
from pyeudiw.tools.jwk import JWK | ||
from pyeudiw.jwk import JWK | ||
|
||
|
||
@pytest.mark.parametrize( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters