Skip to content

Conversation

@SuperBatata
Copy link
Contributor

This pull request introduces a credential offer caching mechanism to optimize the credential issuance flow and reduce redundant network requests. The main changes include the addition of a thread-safe cache for credential offers, integration of this cache into the credential offer resolution logic, and updates to the exchange controller to utilize the cache.

Credential Offer Caching:

  • Added a new CredentialOfferCache singleton object that uses a ConcurrentHashMap to store and retrieve CredentialOffer instances by key, providing thread-safe caching functionality.

Credential Offer Resolution Optimization:

  • Updated the credential offer resolution logic in IssuanceService to first check the cache for a resolved offer, then attempt to parse a JSON offer, and finally fall back to the legacy URI resolution if needed. This avoids unnecessary network requests and improves performance.

Controller Integration:

  • Modified the ExchangeController to cache the resolved credential offer against the original request string immediately after parsing, ensuring subsequent accept operations can retrieve the offer from the cache.
  • Imported the new CredentialOfferCache in the ExchangeController file to support caching functionality.

Minor Cleanup:

  • Removed an unused import (withLoggingContext) from the ExchangeController for code cleanliness.

@SuperBatata SuperBatata marked this pull request as draft November 5, 2025 22:15
@SuperBatata SuperBatata self-assigned this Nov 5, 2025
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 7, 2025

Copy link
Contributor

@JakeFernandes98 JakeFernandes98 left a comment

Choose a reason for hiding this comment

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

We should avoid storing state in memory here as it doesn't scale well with multiple instances of the service running. Could you provide config options for in memory or using the DB?

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.

Credential Issuance with Keycloak OID4VCI Feature not possible, due to double retrieval of the offer

3 participants