Skip to content
Merged
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 src/openhound_okta/models/client_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


class JWK(BaseModel):
kid: str
kid: str | None = None
status: str | None = None
last_updated: datetime | None = Field(default=None, alias="lastUpdated")
created: datetime | None = None
Expand Down
37 changes: 37 additions & 0 deletions tests/test_application_jwk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from openhound_okta.models import ClientApplication


def test_application_accepts_jwk_without_kid():
"""Regression test for OAuth clients whose embedded JWKS has a key without a kid.

The ``kid`` member is optional in RFC 7517, and Okta accepts keys registered
through the Apps API or dynamic client registration without one. Such keys
come back from GET /oauth2/v1/clients with ``kid: null`` (or absent). The
client model previously required ``kid``, so DLT discarded the whole client
row during validation and the client's role assignments never reached the
graph. Only ``client_id`` and ``application_type`` are read from this model,
so a missing ``kid`` must not reject the client.
"""
client = ClientApplication.model_validate(
{
"client_id": "0oa1client",
"application_type": "service",
"token_endpoint_auth_method": "private_key_jwt",
"jwks": {
"keys": [
{
"kid": None,
"status": "ACTIVE",
"created": "2026-01-01T00:00:00Z",
"lastUpdated": "2026-01-02T00:00:00Z",
},
{
"status": "ACTIVE",
},
]
},
}
)

assert client.client_id == "0oa1client"
assert [key.kid for key in client.jwks.keys] == [None, None]
Loading