Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[v3-1-test] Fix JWT token generation with unset issuer/audience config #61331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking "Sign up for GitHub", you agree to our terms of service and privacy statement. We'll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
bugraoz93 merged 1 commit into apache:v3-1-test from bugraoz93:backport-a440d1d-v3-1-test
Feb 1, 2026
Merged

[v3-1-test] Fix JWT token generation with unset issuer/audience config #61331

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion airflow-core/pyproject.toml
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ dependencies = [
# Pygments 2.19.0 improperly renders .ini files with dictionaries as values
# See https://github.com/pygments/pygments/issues/2834
"pygments>=2.0.1,!=2.19.0",
"pyjwt>=2.10.0",
"pyjwt>=2.11.0",
"python-daemon>=3.0.0",
"python-dateutil>=2.7.0",
"python-slugify>=5.0",
Expand Down
15 changes: 9 additions & 6 deletions airflow-core/src/airflow/api_fastapi/auth/tokens.py
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,13 @@ def _conf_list_factory(


def _conf_list_factory(section, key, first_only: bool = False, **kwargs):
def factory() -> list[str] | str:
def factory() -> list[str] | str | None:
from airflow.configuration import conf

val = conf.getlist(section, key, **kwargs, suppress_warnings=True)

if first_only and val:
return val[0]
if first_only:
return val[0] if val else None
return val or []

return factory
Expand Down Expand Up @@ -330,7 +330,7 @@ async def avalidated_claims(
key,
audience=self.audience,
issuer=self.issuer,
options={"require": self.required_claims},
options={"require": list(self.required_claims)},
algorithms=self.algorithm,
leeway=self.leeway,
)
Expand Down Expand Up @@ -446,9 +446,12 @@ def generate(self, extras: dict[str, Any] | None = None, headers: dict[str, Any]
"iat": now,
}

if claims["iss"] is None:
# Remove iss and aud claims if they are falsy (None, [], "", etc.)
# Per RFC 7519, these are optional claims and should be omitted entirely
# rather than set to empty/invalid values: https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.1
if not claims["iss"]:
del claims["iss"]
if claims["aud"] is None:
if not claims["aud"]:
del claims["aud"]

if extras is not None:
Expand Down