Skip to content

jti, auth_code and auth_req store is using RuntimeStoreProvider - #4172

Merged
ThaminduDilshan merged 1 commit into
thunder-id:mainfrom
anushasunkada:local_main
Jul 21, 2026
Merged

jti, auth_code and auth_req store is using RuntimeStoreProvider#4172
ThaminduDilshan merged 1 commit into
thunder-id:mainfrom
anushasunkada:local_main

Conversation

@anushasunkada

@anushasunkada anushasunkada commented Jul 20, 2026

Copy link
Copy Markdown
Member

Purpose

jti, auth_code and auth_req store is updated to use RuntimeStoreProvider

⚠️ Breaking Changes

🔧 Summary of Breaking Changes

AUTHORIZATION_CODE
AUTHORIZATION_REQUEST
PAR_REQUEST
JTI_RECORD tables are removed from the runtime database, instead uses RUNTIME_STORE table.

💥 Impact

The data stored in the above listed tables will be lost. This is not a critical impact as it's have only the information related to the flow. The users might need go through the login, recovery or registration flows

🔄 Migration Guide

Create new table in the runtimestore


Approach

Related Issues

Related PRs

  • N/A

Checklist

  • Followed the contribution guidelines.
  • Manual test round performed and verified.
  • Documentation provided. (Add links if there are any)
    • Ran Vale and fixed all errors and warnings
  • Tests provided. (Add links if there are any)
    • Unit Tests
    • Integration Tests
  • Breaking changes. (Fill if applicable)
    • Breaking changes section filled.
    • breaking change label added.

Security checks

  • Followed secure coding standards in WSO2 Secure Coding Guidelines
  • Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.

Summary by CodeRabbit

  • New Features

    • OAuth authorization codes, authorization requests, PAR, and JTI replay protection now use shared runtime storage.
    • Authorization request/code and PAR handling is consume-once via atomic runtime operations.
    • Startup now wires OAuth services with transaction handling and aligns DPoP JTI replay protection with runtime storage.
  • Maintenance

    • Removed persisted runtime-transient tables for OAuth2/PAR and narrowed cleanup to remaining runtime session data.
    • Dropped Redis-backed implementations and corresponding mocks/tests.
    • Added runtime store “put-if-not-exists” support for improved replay/concurrency behavior.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

OAuth authorization, PAR, and JTI persistence move to the runtime store provider. Atomic conditional writes are added across runtime-store backends, service initialization receives shared runtime dependencies, and obsolete transient database objects and cleanup targets are removed.

Changes

Runtime storage migration

Layer / File(s) Summary
Runtime store conditional-write contract
backend/pkg/thunderidengine/providers/interface.go, backend/internal/runtimestore/...
Adds PutIfNotExists across database, in-memory, and Redis providers with backend, concurrency, and failure-path tests.
Authorization store migration
backend/internal/oauth/oauth2/authz/...
Authorization codes and requests use runtime-store operations with JSON serialization and updated in-memory tests.
JTI and PAR store migration
backend/internal/oauth/oauth2/jti/..., backend/internal/oauth/oauth2/par/...
JTI replay records and PAR requests use injected runtime stores instead of Redis- or database-specific implementations.
Service dependency wiring
backend/cmd/server/servicemanager.go, backend/internal/oauth/..., backend/pkg/thunderidengine/engine.go
Runtime store providers and transactioners are passed through OAuth, authorization, PAR, JTI, and DPoP initialization.
Transient schema and cleanup reduction
backend/dbscripts/runtime-transient/*, backend/scripts/cleanup_runtime_transient_db.sh
Obsolete authorization, PAR, and JTI persistence objects are removed from runtime-transient definitions and cleanup targets.

Estimated code review effort: 4 (Complex) | ~75 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ServerStartup
  participant RuntimeStoreProvider
  participant DPoPVerifier
  participant OAuthService
  participant AuthorizationStores
  participant PARStore
  ServerStartup->>RuntimeStoreProvider: Initialize runtime transient storage
  ServerStartup->>DPoPVerifier: Initialize JTI replay protection with runtime store
  ServerStartup->>OAuthService: Inject runtime store and transactioner
  OAuthService->>AuthorizationStores: Create authorization code and request stores
  OAuthService->>PARStore: Create PAR request store
  AuthorizationStores->>RuntimeStoreProvider: Store and consume serialized OAuth data
  PARStore->>RuntimeStoreProvider: Store and consume serialized PAR data
Loading

Possibly related PRs

Suggested reviewers: darshanasbg, rajithacharith, thiva-k, indeewari

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 78.95% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the PR’s main change: moving JTI, auth_code, and auth_req stores to RuntimeStoreProvider.
Description check ✅ Passed The description covers purpose, breaking changes, related issue, and migration impact, with only the approach and checklist sections left sparse.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🧹 Nitpick comments (2)
backend/internal/oauth/oauth2/par/store.go (1)

47-47: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Stale "database"/"DB-backed" comments after runtime-store migration. These doc comments still describe the removed DB/Redis path and can mislead future maintainers of this security-sensitive OAuth code.

  • backend/internal/oauth/oauth2/par/store.go#L47: update "creates a new DB-backed PAR request store" to reflect the runtime store provider.
  • backend/internal/oauth/oauth2/authz/auth_code_store.go#L49: "inserts a new authorization code into the database" should read as storing into the runtime store.
  • backend/internal/oauth/oauth2/authz/auth_code_store.go#L67-L68: "false if a database error occurs" should reference the runtime store error path.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend/internal/oauth/oauth2/par/store.go` at line 47, Update the doc
comments for the PAR request store constructor in
backend/internal/oauth/oauth2/par/store.go (line 47) and the authorization-code
methods in backend/internal/oauth/oauth2/authz/auth_code_store.go (lines 49 and
67-68) to describe the runtime store/provider rather than the removed database
or Redis implementation; make no code changes.
backend/internal/oauth/oauth2/jti/store.go (1)

27-28: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove unused import.

If you apply the proposed logic change below to remove json.Marshal, this import will no longer be needed.

🧹 Proposed fix
-	"encoding/json"
 	"fmt"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend/internal/oauth/oauth2/jti/store.go` around lines 27 - 28, Remove the
unused encoding/json import from the oauth2 JTI store imports, while retaining
fmt and all imports still referenced by the implementation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@backend/cmd/server/servicemanager.go`:
- Around line 253-255: Update the relevant deployment or migration documentation
for the runtime store initialization introduced around runtimestore.Initialize:
document migration to the RUNTIME_STORE table, removal of AUTHORIZATION_CODE,
AUTHORIZATION_REQUEST, PAR_REQUEST, and JTI_RECORD tables, and the upgrade
impact that in-flight login, recovery, or registration flows may be lost and
must be restarted.

In `@backend/internal/oauth/oauth2/jti/store.go`:
- Around line 74-82: Update the JTI storage flow around ttlSeconds and
storeProvider.Put: return successfully without storing when expiry is already
past, remove the unnecessary json.Marshal/value handling, and calculate the
remaining TTL with a minimum of one second for future expirations, including
sub-second durations. Preserve the existing error wrapping for storage failures.

---

Nitpick comments:
In `@backend/internal/oauth/oauth2/jti/store.go`:
- Around line 27-28: Remove the unused encoding/json import from the oauth2 JTI
store imports, while retaining fmt and all imports still referenced by the
implementation.

In `@backend/internal/oauth/oauth2/par/store.go`:
- Line 47: Update the doc comments for the PAR request store constructor in
backend/internal/oauth/oauth2/par/store.go (line 47) and the authorization-code
methods in backend/internal/oauth/oauth2/authz/auth_code_store.go (lines 49 and
67-68) to describe the runtime store/provider rather than the removed database
or Redis implementation; make no code changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 358ff234-e12c-4fb5-89c1-145a098d7498

📥 Commits

Reviewing files that changed from the base of the PR and between 806799a and 547e12c.

📒 Files selected for processing (35)
  • backend/cmd/server/servicemanager.go
  • backend/dbscripts/runtime-transient/postgres-cleanup.sql
  • backend/dbscripts/runtime-transient/postgres.sql
  • backend/dbscripts/runtime-transient/sqlite.sql
  • backend/internal/oauth/init.go
  • backend/internal/oauth/oauth2/authz/authCodeRedisClient_mock_test.go
  • backend/internal/oauth/oauth2/authz/authReqRedisClient_mock_test.go
  • backend/internal/oauth/oauth2/authz/auth_code_redis_store.go
  • backend/internal/oauth/oauth2/authz/auth_code_redis_store_test.go
  • backend/internal/oauth/oauth2/authz/auth_code_store.go
  • backend/internal/oauth/oauth2/authz/auth_code_store_test.go
  • backend/internal/oauth/oauth2/authz/auth_req_redis_store.go
  • backend/internal/oauth/oauth2/authz/auth_req_redis_store_test.go
  • backend/internal/oauth/oauth2/authz/auth_req_store.go
  • backend/internal/oauth/oauth2/authz/auth_req_store_test.go
  • backend/internal/oauth/oauth2/authz/init.go
  • backend/internal/oauth/oauth2/authz/init_test.go
  • backend/internal/oauth/oauth2/authz/store_constants.go
  • backend/internal/oauth/oauth2/jti/StoreInterface_mock_test.go
  • backend/internal/oauth/oauth2/jti/init.go
  • backend/internal/oauth/oauth2/jti/redisClient_mock_test.go
  • backend/internal/oauth/oauth2/jti/redis_store.go
  • backend/internal/oauth/oauth2/jti/redis_store_test.go
  • backend/internal/oauth/oauth2/jti/store.go
  • backend/internal/oauth/oauth2/jti/store_constants.go
  • backend/internal/oauth/oauth2/jti/store_test.go
  • backend/internal/oauth/oauth2/par/init.go
  • backend/internal/oauth/oauth2/par/parRedisClient_mock_test.go
  • backend/internal/oauth/oauth2/par/redis_store.go
  • backend/internal/oauth/oauth2/par/redis_store_test.go
  • backend/internal/oauth/oauth2/par/store.go
  • backend/internal/oauth/oauth2/par/store_constants.go
  • backend/internal/oauth/oauth2/par/store_test.go
  • backend/pkg/thunderidengine/engine.go
  • backend/scripts/cleanup_runtime_transient_db.sh
💤 Files with no reviewable changes (19)
  • backend/internal/oauth/oauth2/authz/auth_code_redis_store.go
  • backend/internal/oauth/oauth2/par/parRedisClient_mock_test.go
  • backend/internal/oauth/oauth2/jti/store_constants.go
  • backend/internal/oauth/oauth2/par/store_constants.go
  • backend/internal/oauth/oauth2/authz/authCodeRedisClient_mock_test.go
  • backend/internal/oauth/oauth2/authz/auth_req_redis_store.go
  • backend/dbscripts/runtime-transient/postgres-cleanup.sql
  • backend/internal/oauth/oauth2/jti/StoreInterface_mock_test.go
  • backend/internal/oauth/oauth2/par/redis_store.go
  • backend/internal/oauth/oauth2/authz/auth_req_redis_store_test.go
  • backend/internal/oauth/oauth2/par/redis_store_test.go
  • backend/internal/oauth/oauth2/jti/redis_store.go
  • backend/internal/oauth/oauth2/authz/store_constants.go
  • backend/dbscripts/runtime-transient/postgres.sql
  • backend/internal/oauth/oauth2/authz/auth_code_redis_store_test.go
  • backend/internal/oauth/oauth2/jti/redis_store_test.go
  • backend/dbscripts/runtime-transient/sqlite.sql
  • backend/internal/oauth/oauth2/jti/redisClient_mock_test.go
  • backend/internal/oauth/oauth2/authz/authReqRedisClient_mock_test.go

Comment on lines 253 to 255
runtimeStoreProvider, transactioner, err := runtimestore.Initialize(runtime.Config.Database.RuntimeTransient.Type,
runtime.Config.Server.Identifier)
fatalOnError(ctx, logger, err, "Failed to initialize runtime store")

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.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

🔴 Documentation Required
This PR introduces user-facing changes that are not covered by documentation updates under docs/.
Please update the relevant documentation before merging.

Missing documentation:

  • Deployment settings / Migration guide: The migration to the new RUNTIME_STORE table and the removal of the AUTHORIZATION_CODE, AUTHORIZATION_REQUEST, PAR_REQUEST, and JTI_RECORD tables must be documented in the deployment or upgrade guides.
  • User-facing behavior changes: Document the upgrade impact in the release notes or migration guide, explaining that existing in-flight login, recovery, or registration flows may be lost and require users to restart them.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend/cmd/server/servicemanager.go` around lines 253 - 255, Update the
relevant deployment or migration documentation for the runtime store
initialization introduced around runtimestore.Initialize: document migration to
the RUNTIME_STORE table, removal of AUTHORIZATION_CODE, AUTHORIZATION_REQUEST,
PAR_REQUEST, and JTI_RECORD tables, and the upgrade impact that in-flight login,
recovery, or registration flows may be lost and must be restarted.

Source: Path instructions

Comment thread backend/internal/oauth/oauth2/jti/store.go
@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@backend/internal/oauth/oauth2/authz/auth_code_store.go`:
- Around line 57-58: Update the auth-code persistence flow around ttlSeconds and
acs.storeProvider.Put to handle non-positive TTLs before storage: reject expired
codes or clamp the value to a positive TTL so Put never receives zero or a
negative expiry. Preserve normal TTL calculation and storage for unexpired
authorization codes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e589eb8a-7abe-4b26-a6a0-4d023f406ef7

📥 Commits

Reviewing files that changed from the base of the PR and between 547e12c and 5f70bcb.

📒 Files selected for processing (35)
  • backend/cmd/server/servicemanager.go
  • backend/dbscripts/runtime-transient/postgres-cleanup.sql
  • backend/dbscripts/runtime-transient/postgres.sql
  • backend/dbscripts/runtime-transient/sqlite.sql
  • backend/internal/oauth/init.go
  • backend/internal/oauth/oauth2/authz/authCodeRedisClient_mock_test.go
  • backend/internal/oauth/oauth2/authz/authReqRedisClient_mock_test.go
  • backend/internal/oauth/oauth2/authz/auth_code_redis_store.go
  • backend/internal/oauth/oauth2/authz/auth_code_redis_store_test.go
  • backend/internal/oauth/oauth2/authz/auth_code_store.go
  • backend/internal/oauth/oauth2/authz/auth_code_store_test.go
  • backend/internal/oauth/oauth2/authz/auth_req_redis_store.go
  • backend/internal/oauth/oauth2/authz/auth_req_redis_store_test.go
  • backend/internal/oauth/oauth2/authz/auth_req_store.go
  • backend/internal/oauth/oauth2/authz/auth_req_store_test.go
  • backend/internal/oauth/oauth2/authz/init.go
  • backend/internal/oauth/oauth2/authz/init_test.go
  • backend/internal/oauth/oauth2/authz/store_constants.go
  • backend/internal/oauth/oauth2/jti/StoreInterface_mock_test.go
  • backend/internal/oauth/oauth2/jti/init.go
  • backend/internal/oauth/oauth2/jti/redisClient_mock_test.go
  • backend/internal/oauth/oauth2/jti/redis_store.go
  • backend/internal/oauth/oauth2/jti/redis_store_test.go
  • backend/internal/oauth/oauth2/jti/store.go
  • backend/internal/oauth/oauth2/jti/store_constants.go
  • backend/internal/oauth/oauth2/jti/store_test.go
  • backend/internal/oauth/oauth2/par/init.go
  • backend/internal/oauth/oauth2/par/parRedisClient_mock_test.go
  • backend/internal/oauth/oauth2/par/redis_store.go
  • backend/internal/oauth/oauth2/par/redis_store_test.go
  • backend/internal/oauth/oauth2/par/store.go
  • backend/internal/oauth/oauth2/par/store_constants.go
  • backend/internal/oauth/oauth2/par/store_test.go
  • backend/pkg/thunderidengine/engine.go
  • backend/scripts/cleanup_runtime_transient_db.sh
💤 Files with no reviewable changes (19)
  • backend/internal/oauth/oauth2/par/parRedisClient_mock_test.go
  • backend/internal/oauth/oauth2/authz/authCodeRedisClient_mock_test.go
  • backend/internal/oauth/oauth2/authz/auth_req_redis_store_test.go
  • backend/dbscripts/runtime-transient/postgres-cleanup.sql
  • backend/internal/oauth/oauth2/par/redis_store.go
  • backend/internal/oauth/oauth2/authz/auth_req_redis_store.go
  • backend/internal/oauth/oauth2/jti/StoreInterface_mock_test.go
  • backend/internal/oauth/oauth2/par/store_constants.go
  • backend/internal/oauth/oauth2/authz/auth_code_redis_store.go
  • backend/internal/oauth/oauth2/jti/redisClient_mock_test.go
  • backend/internal/oauth/oauth2/authz/store_constants.go
  • backend/internal/oauth/oauth2/authz/auth_code_redis_store_test.go
  • backend/dbscripts/runtime-transient/postgres.sql
  • backend/internal/oauth/oauth2/authz/authReqRedisClient_mock_test.go
  • backend/internal/oauth/oauth2/jti/redis_store_test.go
  • backend/dbscripts/runtime-transient/sqlite.sql
  • backend/internal/oauth/oauth2/par/redis_store_test.go
  • backend/internal/oauth/oauth2/jti/redis_store.go
  • backend/internal/oauth/oauth2/jti/store_constants.go
🚧 Files skipped from review as they are similar to previous changes (14)
  • backend/internal/oauth/init.go
  • backend/internal/oauth/oauth2/jti/init.go
  • backend/internal/oauth/oauth2/authz/init_test.go
  • backend/cmd/server/servicemanager.go
  • backend/pkg/thunderidengine/engine.go
  • backend/internal/oauth/oauth2/authz/init.go
  • backend/internal/oauth/oauth2/par/store_test.go
  • backend/internal/oauth/oauth2/jti/store.go
  • backend/internal/oauth/oauth2/jti/store_test.go
  • backend/scripts/cleanup_runtime_transient_db.sh
  • backend/internal/oauth/oauth2/par/store.go
  • backend/internal/oauth/oauth2/authz/auth_req_store_test.go
  • backend/internal/oauth/oauth2/authz/auth_req_store.go
  • backend/internal/oauth/oauth2/authz/auth_code_store_test.go

Comment thread backend/internal/oauth/oauth2/authz/auth_code_store.go Outdated
@thiva-k thiva-k added Type/Improvement breaking change The feature/ improvement will alter the existing behaviour labels Jul 20, 2026
return nil
}

// ConsumeAuthorizationCode atomically transitions an ACTIVE authorization code to INACTIVE.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shall we update this comment properly?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@anushasunkada shall we address this? Comment should start with ConsumeAuthorizationCode ...
Ideally this should be caught by the linter

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@coderabbitai why go linter didn't report this? Provide short answer

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.

@ThaminduDilshan, because this is a style convention, not a compiler error. It would only be flagged if the relevant doc-comment linter (for example, revive/golint) is enabled and configured to check it; the current lint configuration likely does not enforce that rule.

Comment thread backend/internal/oauth/oauth2/authz/auth_code_store_test.go Outdated
Comment thread backend/internal/oauth/oauth2/authz/auth_req_store_test.go Outdated
// The runtime store's Put is an unconditional overwrite, so replay detection is done with a
// Get-then-Put check. This has a benign race under concurrent submissions of the same jti, but
// that's an acceptable trade-off for a replay cache.
func (s *jtiStore) RecordJTI(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hope this is the agreed upon approach for this and trade off is acceptable.
cc: @senthalan

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's better if we can introduce a new function in the RuntimeStoreProvider to support this.

PutIfNotExists(ctx context.Context, namespace RuntimeStoreNamespace, key string, value []byte, ttlSeconds int64) (bool, error)

@ThaminduDilshan ThaminduDilshan Jul 21, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@senthalan isn't PutIfNotExists give the idea insert only if a record doesn't exists? Here we insert a record if not exists, but updates the existing record if it exist and is not expired

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems this is suggested matching redis SETNX semantics. Writes only if no live entry exists for the key; an expired entry is treated as absent. Returns true if the write was performed, false if a live entry blocked it.

So maybe PutIfNotExists is a suitable name here as PUT generally indicates a replace operation

Comment thread backend/internal/oauth/oauth2/jti/store_test.go Outdated
Comment thread backend/internal/oauth/oauth2/par/init.go Outdated
Comment thread backend/internal/oauth/oauth2/par/store_test.go Outdated
Comment thread backend/internal/oauth/oauth2/authz/auth_code_store.go Outdated
Comment on lines +73 to +74
ttlSeconds := int64(expiryTime.Sub(time.Now().UTC()).Seconds())
err = authzRS.storeProvider.Put(ctx, providers.NamespaceAuthzReq, key, data, ttlSeconds)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
ttlSeconds := int64(expiryTime.Sub(time.Now().UTC()).Seconds())
err = authzRS.storeProvider.Put(ctx, providers.NamespaceAuthzReq, key, data, ttlSeconds)
err = authzRS.storeProvider.Put(ctx, providers.NamespaceAuthzReq, key, data, authzRS.validityPeriod)

Comment thread backend/internal/runtimestore/dbstore/queries.go Outdated
Comment thread backend/internal/runtimestore/redisstore/service.go
senthalan
senthalan previously approved these changes Jul 21, 2026
@senthalan
senthalan enabled auto-merge July 21, 2026 08:27
Signed-off-by: anushasunkada <anushasunkada@gmail.com>
auto-merge was automatically disabled July 21, 2026 09:53

Head branch was pushed to by a user without write access

@anushasunkada
anushasunkada dismissed stale reviews from senthalan and ThaminduDilshan via 2964725 July 21, 2026 09:53
@ThaminduDilshan
ThaminduDilshan added this pull request to the merge queue Jul 21, 2026
Merged via the queue into thunder-id:main with commit c4d489a Jul 21, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change The feature/ improvement will alter the existing behaviour Type/Improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants