Repository navigation
[OID4VCI] Cache issued verifiable credentials #53332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
forkimenjeckayang
wants to merge
9
commits into
keycloak:main
Choose a base branch
from
adorsys:issue-49335
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4b01244
Caching support for issued verifiable credentials
forkimenjeckayang a27c789
cache: add per-user caching and invalidation for issued credentials
forkimenjeckayang c0cda98
address copilot reviews
forkimenjeckayang e0dd123
Caching support for issued verifiable credentials
forkimenjeckayang 6385b63
cache: add per-user caching and invalidation for issued credentials
forkimenjeckayang 5326aad
address copilot reviews
forkimenjeckayang 6a7d1e4
Merge branch 'issue-49335' of github.com:adorsys/keycloak-oid4vc into…
forkimenjeckayang d5e226e
address copilot review
forkimenjeckayang 63fc71b
fix: preserve issued credential cleanup SPI compatibility
forkimenjeckayang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
...a/org/keycloak/models/cache/infinispan/entities/CachedUserIssuedVerifiableCredential.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| /* | ||
| * Copyright 2026 Red Hat, Inc. and/or its affiliates | ||
| * and other contributors as indicated by the @author tags. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.keycloak.models.cache.infinispan.entities; | ||
|
|
||
| import org.keycloak.models.IssuedVerifiableCredentialModel; | ||
|
|
||
| public class CachedUserIssuedVerifiableCredential { | ||
|
|
||
| private final String id; | ||
| private final String userId; | ||
| private final String verifiableCredentialId; | ||
| private final Long issuedAt; | ||
| private final Long expiresAt; | ||
| private final String clientId; | ||
| private final String revision; | ||
|
|
||
| public CachedUserIssuedVerifiableCredential(IssuedVerifiableCredentialModel credentialModel) { | ||
| this.id = credentialModel.getId(); | ||
| this.userId = credentialModel.getUserId(); | ||
| this.verifiableCredentialId = credentialModel.getVerifiableCredentialId(); | ||
| this.issuedAt = credentialModel.getIssuedAt(); | ||
| this.expiresAt = credentialModel.getExpiresAt(); | ||
| this.clientId = credentialModel.getClientId(); | ||
| this.revision = credentialModel.getRevision(); | ||
| } | ||
|
|
||
| public String getId() { | ||
| return id; | ||
| } | ||
|
|
||
| public String getUserId() { | ||
| return userId; | ||
| } | ||
|
|
||
| public String getVerifiableCredentialId() { | ||
| return verifiableCredentialId; | ||
| } | ||
|
|
||
| public Long getIssuedAt() { | ||
| return issuedAt; | ||
| } | ||
|
|
||
| public Long getExpiresAt() { | ||
| return expiresAt; | ||
| } | ||
|
|
||
| public String getClientId() { | ||
| return clientId; | ||
| } | ||
|
|
||
| public String getRevision() { | ||
| return revision; | ||
| } | ||
| } |
57 changes: 57 additions & 0 deletions
57
.../org/keycloak/models/cache/infinispan/entities/CachedUserIssuedVerifiableCredentials.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| /* | ||
| * Copyright 2026 Red Hat, Inc. and/or its affiliates | ||
| * and other contributors as indicated by the @author tags. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.keycloak.models.cache.infinispan.entities; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| import org.keycloak.models.IssuedVerifiableCredentialModel; | ||
| import org.keycloak.models.RealmModel; | ||
|
|
||
| public class CachedUserIssuedVerifiableCredentials extends AbstractRevisioned implements InRealm { | ||
|
|
||
| private final List<CachedUserIssuedVerifiableCredential> credentials; | ||
| private final String realmId; | ||
| private final long invalidationRevision; | ||
|
|
||
| public CachedUserIssuedVerifiableCredentials(long revision, String id, RealmModel realm, | ||
| List<IssuedVerifiableCredentialModel> credentials, | ||
| long invalidationRevision) { | ||
| super(revision, id); | ||
| this.realmId = realm.getId(); | ||
| this.invalidationRevision = invalidationRevision; | ||
| this.credentials = credentials != null | ||
| ? credentials.stream() | ||
| .map(CachedUserIssuedVerifiableCredential::new) | ||
| .collect(Collectors.toCollection(ArrayList::new)) | ||
| : new ArrayList<>(); | ||
| } | ||
|
|
||
| public List<CachedUserIssuedVerifiableCredential> getCredentials() { | ||
| return credentials; | ||
| } | ||
|
|
||
| public long getInvalidationRevision() { | ||
| return invalidationRevision; | ||
| } | ||
|
|
||
| @Override | ||
| public String getRealm() { | ||
| return realmId; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.