Skip to content

Validate OIDC resource tokens against provider session state - #906

Merged
KrzysztofPajak merged 2 commits into
developfrom
feature/oidc-sessions-api
Oct 13, 2026
Merged

KrzysztofPajak merged 2 commits into
developfrom
feature/oidc-sessions-api

Conversation

@KrzysztofPajak

Copy link
Copy Markdown
Member

Resolves no public issue
Type: feature

Issue

Protected resource APIs can accept provider-issued access tokens, but they need a resource-level way to reject tokens that are too old or belong to a subject whose provider sessions were revoked after token issuance.

Solution

Add MaximumTokenAgeSeconds to protected resource configuration and enforce it in OIDC token checks. The resource server now refuses provider tokens older than the configured resource limit and tokens issued before the provider subject revocation timestamp. Tests cover config validation, token age checks, and the customer pipeline behavior.

Breaking changes

None expected. Existing resources keep the default behavior unless MaximumTokenAgeSeconds is configured.

Testing

Not run during PR creation.

  1. Run dotnet test src/Tests/Grand.Web.Common.Tests/Grand.Web.Common.Tests.csproj --filter OidcCustomerPipelineTests.
  2. Configure a protected resource with MaximumTokenAgeSeconds.
  3. Call the resource with a fresh provider access token and confirm it is accepted.
  4. Call the resource with an expired-by-policy token or a token issued before subject revocation and confirm it is rejected.

@KrzysztofPajak KrzysztofPajak left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Code review note: I reviewed the token-age and revocation changes against the security/.NET/resource-server checklist. I found no high-confidence issues. Token age and revocation checks run before customer resolution, and config validation covers non-positive MaxTokenAgeMinutes.\n\nI did not run the test suites.

@KrzysztofPajak
KrzysztofPajak force-pushed the feature/oidc-sessions-plugin branch from 27e9613 to 8b0ff4f Compare October 13, 2026 18:30
@KrzysztofPajak
KrzysztofPajak force-pushed the feature/oidc-sessions-api branch from 9ef3f3a to 2a5b7bb Compare October 13, 2026 18:30
Base automatically changed from feature/oidc-sessions-plugin to develop October 13, 2026 19:11
Copilot AI balanced review requested due to automatic review settings October 13, 2026 19:12

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 reached their quota limit.

@KrzysztofPajak
KrzysztofPajak force-pushed the feature/oidc-sessions-api branch from 49c87d1 to 5306b24 Compare October 13, 2026 19:13
@KrzysztofPajak
KrzysztofPajak merged commit 286e2ed into develop Oct 13, 2026
6 checks passed
@KrzysztofPajak
KrzysztofPajak deleted the feature/oidc-sessions-api branch October 13, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants