8000 Record admin events for organization identity provider links by akasakariko · Pull Request #55147 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Record admin events for organization identity provider links - #55147

Merged
pedroigor merged 1 commit into
keycloak:mainfrom
akasakariko:fix/55124-organization-idp-admin-events
Nov 25, 2026
Merged

pedroigor merged 1 commit into
keycloak:mainfrom
akasakariko:fix/55124-organization-idp-admin-events

Conversation

@akasakariko
@akasakariko akasakariko commented Nov 13, 2026 •
Copy link
Copy Markdown
Contributor

Closes #55124

Use the resolved identity provider alias and persisted association settings so links created by alias or internal ID have the same complete audit trail

The organization tab filtering changes remain tracked in #55120

The CREATE representation assertion fails against the previous implementation and passes with this fix

@ahus1
ahus1 commented Nov 13, 2026
Copy link
Copy Markdown
Member

The parent issue is still in triage status; I first need input from the owning team. Please do not create PRs from issues that have that label.

@ahus1 ahus1 closed this Nov 13, 2026
@sguilhen sguilhen reopened this Nov 19, 2026
@sguilhen sguilhen left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @akasakariko. In general it looks ok to me.

One thing worth considering: the CREATE event's representation is inconsistent with the UPDATE event's, and with how representation() is used everywhere else in the codebase.

For addIdentityProvider, the stored representation is just the raw submitted id/alias string, serialized as a bare JSON string, e.g. "my-identity-provider" or "3fa85f64-5717-4562-b3fc-2c963f66afa6" depending on whether the caller passed an alias or an internal id.

For updateIdentityProviderLink, the stored representation is the full OrganizationIdentityProviderLinkRepresentation, e.g. {"autoMembership":true,"membershipType":"MANAGED"}.

So a reviewer looking at the organization's admin events tab sees a structured config object for updates, but just an opaque identifier for the initial link with no indication of the autoMembership/membershipType values the link actually got (which default to true/UNMANAGED when not specified elsewhere, e.g. for the default-config case). That's also a departure from how other CREATE events in this codebase log representations (OrganizationsResource, OrganizationMemberResource, etc. all log the created resource's representation, not a plain id).

I think it makes sense for the CREATE case to log the resulting link representation (alias + autoMembership + membershipType) instead of the bare submitted id? That would make the two events symmetric and give a complete picture of the link that was created, not just what was passed in.

Separately, it'd be good to add a representation assertion for the CREATE event in the test, since right now only operationType/resourceType/resourcePath are checked for it.

Closes keycloak#55124

Signed-off-by: akasakariko <148060537+akasakariko@users.noreply.github.com>
@akasakariko
akasakariko force-pushed the fix/55124-organization-idp-admin-events branch from 7e42fe6 to 117c7bd Compare November 20, 2026 06:00
@akasakariko
Copy link
Copy Markdown
Contributor Author

@sguilhen Addressed in 117c7bd

CREATE now records a JSON object containing the resolved alias and the persisted autoMembership and membershipType values

Extended testUpdateLinkConfig to assert all three fields when adding the link again by internal ID, including the fresh true / UNMANAGED defaults after removing a MANAGED link

The new assertion fails against the previous implementation and passes with this fix

Validation: 59 organization tests passed; 1294 services tests, 0 failures, 0 errors, 2 existing skips; Spotless and the base suite check passed

@sguilhen
Copy link
Copy Markdown
Contributor

@akasakariko thanks for updating the PR. Can you switch it from draft to regular PR?

@akasakariko
akasakariko marked this pull request as ready for review November 23, 2026 11:32
@akasakariko
akasakariko requested a review from a team as a code owner November 23, 2026 11:32
Copilot AI balanced review requested due to automatic review settings November 23, 2026 11:32
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@akasakariko
Copy link
Copy Markdown
Contributor Author

@sguilhen Done, it is now a regular PR and ready for review

@pedroigor
pedroigor merged commit 49ade26 into keycloak:main Nov 25, 2026
97 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No admin event is recorded when an identity provider is linked to an organization

5 participants

0