-
Notifications
You must be signed in to change notification settings - Fork 4
feat: added options to configure read-only key store, and key mapping bug fixes #10
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
jhbritton-RSK
wants to merge
6
commits into
main
Choose a base branch
from
feat/16820
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
6 commits
Select commit
Hold shift + click to select a range
8a0a135
feat: add options object to configuring compatibility store for confi…
jhbritton-RSK b5ccbc1
fix: bug not mapping created value on X509 cert signing keys
jhbritton-RSK 28326af
fix: mapped key id correctly for X509 cert wrapped keys
jhbritton-RSK 38afbd8
docs: updated documentation for compatibility store to talk about Max…
jhbritton-RSK e213293
pr: correcting issues pointed out in PR
jhbritton-RSK a169304
pr: correcting missing copyright header and bug with created time com…
jhbritton-RSK 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
Some comments aren't visible on the classic Files Changed page.
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
17 changes: 17 additions & 0 deletions
17
...ntityServer/src/Configuration/DependencyInjection/Options/CompatibilityKeyStoreOptions.cs
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,17 @@ | ||
| // Copyright (c) 2026, Rock Solid Knowledge Ltd | ||
| // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. | ||
|
|
||
| using System; | ||
|
|
||
| namespace Open.IdentityServer.Configuration; | ||
|
|
||
| /// <summary> | ||
| /// Compatibility key store options. | ||
| /// </summary> | ||
| public class CompatibilityKeyStoreOptions | ||
| { | ||
| /// <summary> | ||
| /// Maximum lifetime for keys read from the key store, defaults to 90 days. | ||
| /// </summary> | ||
| public TimeSpan MaxLifetime { get; set; } = TimeSpan.FromDays(90); | ||
| } | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // Copyright (c) 2026, Rock Solid Knowledge Ltd | ||
| // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. | ||
|
|
||
| namespace Open.IdentityServer; | ||
|
|
||
| /// <summary> | ||
| /// Constants for DataProtection in Open.IdentityServer. | ||
| /// </summary> | ||
| public static class DataProtectionConstants | ||
| { | ||
| /// <summary>Purpose used when creating key material data protector.</summary> | ||
| public const string KeyProtectorPurpose = "DataProtectionKeyProtector"; | ||
| } |
45 changes: 45 additions & 0 deletions
45
src/Open.IdentityServer/src/Stores/Compatibility/IdentityServerKeyStore.cs
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,45 @@ | ||
| // Copyright (c) 2026, Rock Solid Knowledge Ltd | ||
| // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
|
jhbritton-RSK marked this conversation as resolved.
|
||
| using Open.IdentityServer.Configuration; | ||
| using Open.IdentityServer.DataProtection; | ||
| using Open.IdentityServer.Models; | ||
|
|
||
| namespace Open.IdentityServer.Stores; | ||
|
|
||
| /// <summary> | ||
| /// This class is the base implementation of the IdentityServer compatibility signing key store that retrieves legacy | ||
| /// from the existing IdentityServer read-only key store. | ||
| /// </summary> | ||
| /// <param name="identityServerKeyStore">The key store used to retrieve signing keys.</param> | ||
| /// <param name="dataProtectedIdentityServerKeyMaterialConverter">Converter used to decrypt and convert data-protected key material into usable credentials.</param> | ||
| /// <param name="timeProvider">Time provider implementation</param> | ||
| /// <param name="options">Compatibility key store options</param> | ||
| public abstract class IdentityServerSigningKeyStore( | ||
| IIdentityServerKeyStore identityServerKeyStore, | ||
| DataProtectedIdentityServerKeyMaterialConverter dataProtectedIdentityServerKeyMaterialConverter, | ||
| TimeProvider timeProvider, | ||
| CompatibilityKeyStoreOptions options) | ||
| { | ||
| private readonly IIdentityServerKeyStore identityServerKeyStore = identityServerKeyStore; | ||
| private readonly DataProtectedIdentityServerKeyMaterialConverter dataProtectedIdentityServerKeyMaterialConverter = dataProtectedIdentityServerKeyMaterialConverter; | ||
| private readonly CompatibilityKeyStoreOptions options = options; | ||
|
|
||
| /// <summary> | ||
| /// Get all signing keys from the store, filtering based on the compatibility key store configuration and use | ||
| /// </summary> | ||
| /// <returns></returns> | ||
| protected IEnumerable<SigningKey> GetKeys() | ||
| { | ||
|
jhbritton-RSK marked this conversation as resolved.
|
||
| var results = identityServerKeyStore.GetKeys() | ||
| .Where(x => x.Use == "signing") | ||
| .Select(dataProtectedIdentityServerKeyMaterialConverter.Convert) | ||
| .Where(x => x.Created.Add(options.MaxLifetime) > timeProvider.GetUtcNow().UtcDateTime) | ||
| .OrderByDescending(x => x.Created); | ||
|
|
||
| return results; | ||
| } | ||
| } | ||
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
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
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.