Skip to content

Commit 5bcbf67

Browse files
committed
fix: remove validate_aud method
The check_value method contains validate_aud logic
1 parent 62f5674 commit 5bcbf67

File tree

1 file changed

+2
-37
lines changed

1 file changed

+2
-37
lines changed

src/joserfc/_rfc7519/registry.py

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ def check_value(self, claim_name: str, value: Any) -> None:
2828
option = self.options.get(claim_name)
2929
if not option:
3030
return
31-
31+
3232
allow_blank = option.get("allow_blank")
3333
if not allow_blank and value in (None, "", [], {}):
3434
raise InvalidClaimError(claim_name)
3535

3636
option_values = option.get("values")
37-
37+
3838
if option_values is None:
3939
option_value = option.get("value")
4040
if option_value is not None:
@@ -72,41 +72,6 @@ def __init__(self, now: int | None = None, leeway: int = 0, **kwargs: ClaimsOpti
7272
self.leeway = leeway
7373
super().__init__(**kwargs)
7474

75-
def validate_aud(self, value: str | list[str]) -> None:
76-
"""The "aud" (audience) claim identifies the recipients that the JWT is
77-
intended for. Each principal intended to process the JWT MUST
78-
identify itself with a value in the audience claim. If the principal
79-
processing the claim does not identify itself with a value in the
80-
"aud" claim when this claim is present, then the JWT MUST be
81-
rejected. In the general case, the "aud" value is an array of
82-
case-sensitive strings, each containing a StringOrURI value. In the
83-
special case when the JWT has one audience, the "aud" value MAY be a
84-
single case-sensitive string containing a StringOrURI value. The
85-
interpretation of audience values is generally application specific.
86-
Use of this claim is OPTIONAL.
87-
"""
88-
option = self.options.get("aud")
89-
if not option:
90-
return
91-
92-
option_values = option.get("values")
93-
94-
if option_values is None:
95-
option_value = option.get("value")
96-
if option_value:
97-
option_values = [option_value]
98-
99-
if not option_values:
100-
return
101-
102-
if isinstance(value, list):
103-
aud_list = value
104-
else:
105-
aud_list = [value]
106-
107-
if not any(v in aud_list for v in option_values):
108-
raise InvalidClaimError("aud")
109-
11075
def validate_exp(self, value: int) -> None:
11176
"""The "exp" (expiration time) claim identifies the expiration time on
11277
or after which the JWT MUST NOT be accepted for processing. The

0 commit comments

Comments
 (0)