From ae17610102ae6727dbb3ea8c6a36bb480c2ffd6c Mon Sep 17 00:00:00 2001 From: Stijn Moreels <9039753+stijnmoreels@users.noreply.github.com> Date: Thu, 26 Feb 2026 08:51:30 +0100 Subject: [PATCH] chore(deprecate): use centralized diagnostic id for deprecation messages --- .../Arcus.Security.Core.csproj | 4 +++ .../Caching/CachedSecretProvider.cs | 8 ++--- .../Configuration/CacheConfiguration.cs | 2 +- .../Configuration/ICacheConfiguration.cs | 2 +- .../Caching/ICachedSecretProvider.cs | 10 +++--- .../SecretProviderCachingExtensions.cs | 6 ++-- .../CompositeSecretProvider.cs | 32 +++++++++---------- .../CriticalExceptionFilter.cs | 2 +- .../ISecretProviderExtensions.Deprecated.cs | 4 +-- .../Extensions/ISecretProviderExtensions.cs | 12 +++---- .../SecretStoreBuilderExtensions.cs | 9 +++--- src/Arcus.Security.Core/ISecretProvider.cs | 14 ++++---- src/Arcus.Security.Core/ISecretStore.cs | 8 ++--- .../ISyncSecretProvider.cs | 4 +-- .../IVersionedSecretProvider.cs | 2 +- .../Providers/ConfigurationSecretProvider.cs | 8 ++--- .../EnvironmentVariableSecretProvider.cs | 10 +++--- .../MutatedSecretNameCachedSecretProvider.cs | 4 +-- .../MutatedSecretNameSecretProvider.cs | 6 ++-- src/Arcus.Security.Core/Secret.cs | 2 +- .../SecretNotFoundException.cs | 2 +- .../SecretProviderOptions.cs | 2 +- .../SecretStoreAuditingOptions.cs | 2 +- src/Arcus.Security.Core/SecretStoreBuilder.cs | 18 +++++------ src/Arcus.Security.Core/SecretStoreSource.cs | 2 +- src/Arcus.Security.sln | 5 +-- src/ObsoleteDefaults.cs | 13 ++++++++ 27 files changed, 106 insertions(+), 87 deletions(-) create mode 100644 src/ObsoleteDefaults.cs diff --git a/src/Arcus.Security.Core/Arcus.Security.Core.csproj b/src/Arcus.Security.Core/Arcus.Security.Core.csproj index fd7f1153..81e38d71 100644 --- a/src/Arcus.Security.Core/Arcus.Security.Core.csproj +++ b/src/Arcus.Security.Core/Arcus.Security.Core.csproj @@ -19,6 +19,10 @@ S1133 + + + + diff --git a/src/Arcus.Security.Core/Caching/CachedSecretProvider.cs b/src/Arcus.Security.Core/Caching/CachedSecretProvider.cs index 91c427dd..7ccfba60 100644 --- a/src/Arcus.Security.Core/Caching/CachedSecretProvider.cs +++ b/src/Arcus.Security.Core/Caching/CachedSecretProvider.cs @@ -11,7 +11,7 @@ namespace Arcus.Security.Core.Caching /// /// A that will cache secrets in memory, to improve performance. /// - [Obsolete("Will be removed in v3.0 as caching will happen directly on the secret store")] + [Obsolete("Will be removed in v3.0 as caching will happen directly on the secret store", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public class CachedSecretProvider : ICachedSecretProvider, IVersionedSecretProvider, ISyncSecretProvider { private readonly ISecretProvider _secretProvider; @@ -92,7 +92,7 @@ public CachedSecretProvider(ISecretProvider secretProvider) : /// The name must not be empty /// The name must not be null /// The secret was not found, using the given name - [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecret) + " instead")] + [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecret) + " instead", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public Task GetRawSecretAsync(string secretName) { if (string.IsNullOrWhiteSpace(secretName)) @@ -130,7 +130,7 @@ public Task GetSecretAsync(string secretName) /// The name must not be empty /// The name must not be null /// The secret was not found, using the given name - [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecret) + " instead")] + [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecret) + " instead", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public async Task GetRawSecretAsync(string secretName, bool ignoreCache) { if (string.IsNullOrWhiteSpace(secretName)) @@ -190,7 +190,7 @@ private bool TryGetValueFromCache(string secretName, bool ignoreCache, out Secre /// Thrown when the is blank. /// Thrown when the is less than zero. /// Thrown when no secret was not found, using the given . - [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecret) + " instead")] + [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecret) + " instead", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public async Task> GetRawSecretsAsync(string secretName, int amountOfVersions) { if (string.IsNullOrWhiteSpace(secretName)) diff --git a/src/Arcus.Security.Core/Caching/Configuration/CacheConfiguration.cs b/src/Arcus.Security.Core/Caching/Configuration/CacheConfiguration.cs index abeffcb2..e2e7fd9a 100644 --- a/src/Arcus.Security.Core/Caching/Configuration/CacheConfiguration.cs +++ b/src/Arcus.Security.Core/Caching/Configuration/CacheConfiguration.cs @@ -5,7 +5,7 @@ namespace Arcus.Security.Core.Caching.Configuration /// /// Default implementation of the collected configuration values to control the caching when interacting with Azure Key Vault. /// - [Obsolete("Will be removed in v3.0 as caching will be handled by the secret store itself")] + [Obsolete("Will be removed in v3.0 as caching will be handled by the secret store itself", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public class CacheConfiguration : ICacheConfiguration { /// diff --git a/src/Arcus.Security.Core/Caching/Configuration/ICacheConfiguration.cs b/src/Arcus.Security.Core/Caching/Configuration/ICacheConfiguration.cs index 0885e6f0..f065081f 100644 --- a/src/Arcus.Security.Core/Caching/Configuration/ICacheConfiguration.cs +++ b/src/Arcus.Security.Core/Caching/Configuration/ICacheConfiguration.cs @@ -5,7 +5,7 @@ namespace Arcus.Security.Core.Caching.Configuration /// /// Collected configuration values to control the caching when interacting with Azure Key Vault. /// - [Obsolete("Will be removed in v3.0 as caching will happen on the secret store itself")] + [Obsolete("Will be removed in v3.0 as caching will happen on the secret store itself", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public interface ICacheConfiguration { /// diff --git a/src/Arcus.Security.Core/Caching/ICachedSecretProvider.cs b/src/Arcus.Security.Core/Caching/ICachedSecretProvider.cs index 605b2a22..7e72a35a 100644 --- a/src/Arcus.Security.Core/Caching/ICachedSecretProvider.cs +++ b/src/Arcus.Security.Core/Caching/ICachedSecretProvider.cs @@ -7,13 +7,13 @@ namespace Arcus.Security.Core.Caching /// /// allows developers to build specific Secret key providers with caching. /// - [Obsolete("Will be removed in v3.0 as caching will happen on the secret store itself")] + [Obsolete("Will be removed in v3.0 as caching will happen on the secret store itself", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public interface ICachedSecretProvider : ISecretProvider { /// /// Gets the cache-configuration for this instance. /// - [Obsolete("Will be removed in v3.0 as caching will happen on the secret store itself")] + [Obsolete("Will be removed in v3.0 as caching will happen on the secret store itself", DiagnosticId = ObsoleteDefaults.DiagnosticId)] ICacheConfiguration Configuration { get; } /// @@ -25,7 +25,7 @@ public interface ICachedSecretProvider : ISecretProvider /// The name must not be empty /// The name must not be null /// The secret was not found, using the given name - [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretAsync) + " instead")] + [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretAsync) + " instead", DiagnosticId = ObsoleteDefaults.DiagnosticId)] Task GetRawSecretAsync(string secretName, bool ignoreCache); /// @@ -37,7 +37,7 @@ public interface ICachedSecretProvider : ISecretProvider /// The name must not be empty /// The name must not be null /// The secret was not found, using the given name - [Obsolete("Will be removed in v3.0 as caching will happen on the secret store itself")] + [Obsolete("Will be removed in v3.0 as caching will happen on the secret store itself", DiagnosticId = ObsoleteDefaults.DiagnosticId)] Task GetSecretAsync(string secretName, bool ignoreCache); @@ -46,7 +46,7 @@ public interface ICachedSecretProvider : ISecretProvider /// so the next time is called, a new version of the secret will be added back to the cache. /// /// The name of the secret that should be removed from the cache. - [Obsolete("Will be removed in v3.0 as caching will happen on the secret store itself")] + [Obsolete("Will be removed in v3.0 as caching will happen on the secret store itself", DiagnosticId = ObsoleteDefaults.DiagnosticId)] Task InvalidateSecretAsync(string secretName); } } diff --git a/src/Arcus.Security.Core/Caching/SecretProviderCachingExtensions.cs b/src/Arcus.Security.Core/Caching/SecretProviderCachingExtensions.cs index e83588fb..0553868d 100644 --- a/src/Arcus.Security.Core/Caching/SecretProviderCachingExtensions.cs +++ b/src/Arcus.Security.Core/Caching/SecretProviderCachingExtensions.cs @@ -18,7 +18,7 @@ public static class SecretProviderCachingExtensions /// A secret provider that caches values /// Thrown when the or is null. /// Thrown when the is not a positive time duration. - [Obsolete("Will be removed in v3.0 in favor of placing the secret caching on the secret store itself")] + [Obsolete("Will be removed in v3.0 in favor of placing the secret caching on the secret store itself", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public static ICachedSecretProvider WithCaching(this ISecretProvider secretProvider, TimeSpan cachingDuration, IMemoryCache memoryCache) { if (secretProvider is null) @@ -48,7 +48,7 @@ public static ICachedSecretProvider WithCaching(this ISecretProvider secretProvi /// A secret provider that caches values /// Thrown when the is null. /// Thrown when the is not a positive time duration. - [Obsolete("Will be removed in v3.0 in favor of placing the secret caching on the secret store itself")] + [Obsolete("Will be removed in v3.0 in favor of placing the secret caching on the secret store itself", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public static ICachedSecretProvider WithCaching(this ISecretProvider secretProvider, TimeSpan cachingDuration) { if (secretProvider is null) @@ -71,7 +71,7 @@ public static ICachedSecretProvider WithCaching(this ISecretProvider secretProvi /// An instantiated that will only be called if the value is not cached /// A secret provider that caches values /// Thrown when the is null. - [Obsolete("Will be removed in v3.0 in favor of placing the secret caching on the secret store itself")] + [Obsolete("Will be removed in v3.0 in favor of placing the secret caching on the secret store itself", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public static ICachedSecretProvider WithCaching(this ISecretProvider secretProvider) { if (secretProvider is null) diff --git a/src/Arcus.Security.Core/CompositeSecretProvider.cs b/src/Arcus.Security.Core/CompositeSecretProvider.cs index 36bc65a8..dbfff004 100644 --- a/src/Arcus.Security.Core/CompositeSecretProvider.cs +++ b/src/Arcus.Security.Core/CompositeSecretProvider.cs @@ -237,7 +237,7 @@ private SecretResult CreateFinalFailureSecretResult(string secretName, Collectio /// /// Thrown every time because the cannot determine the caching configuration from the different registered s. /// - [Obsolete("Will be removed in v3.0 as caching will be handled by the secret store itself")] + [Obsolete("Will be removed in v3.0 as caching will be handled by the secret store itself", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public ICacheConfiguration Configuration => throw new NotSupportedException( "Getting the cache configuration directly from the secret store is not supported, " @@ -252,7 +252,7 @@ private SecretResult CreateFinalFailureSecretResult(string secretName, Collectio /// Thrown when there was no found in the secret store with the given . /// Thrown when the registered cannot be cast to the specific . /// Thrown when multiple were registered with the same name. - [Obsolete("Will be removed in v3.0 in favor of using a new interface")] + [Obsolete("Will be removed in v3.0 in favor of using a new interface", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public TSecretProvider GetProvider(string name) where TSecretProvider : Core.ISecretProvider { var provider = ((ISecretStore) this).GetProvider(name); @@ -280,7 +280,7 @@ public TSecretProvider GetProvider(string name) where TSecretPr /// The name that was used to register the in the secret store. /// Thrown when the is blank. /// Thrown when there was no found in the secret store with the given . - [Obsolete("Will be removed in v3.0 in favor of using a new interface")] + [Obsolete("Will be removed in v3.0 in favor of using a new interface", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public Core.ISecretProvider GetProvider(string name) { var provider = ((ISecretStore) this).GetProvider(name); @@ -314,7 +314,7 @@ public Core.ISecretProvider GetProvider(string name) /// /// Thrown when the registered cannot be cast to the specific . /// Thrown when multiple were registered with the same name. - [Obsolete("Will be removed in v3.0 as caching is handled by the secret store itself")] + [Obsolete("Will be removed in v3.0 as caching is handled by the secret store itself", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public TCachedSecretProvider GetCachedProvider(string name) where TCachedSecretProvider : ICachedSecretProvider { var provider = ((ISecretStore) this).GetProvider(name); @@ -345,7 +345,7 @@ public TCachedSecretProvider GetCachedProvider(string nam /// Thrown when their was either none of the registered secret providers are registered as instances /// or there was an registered but not with caching. /// - [Obsolete("Will be removed in v3.0 as caching is handled via the secret store itself")] + [Obsolete("Will be removed in v3.0 as caching is handled via the secret store itself", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public ICachedSecretProvider GetCachedProvider(string name) { var provider = ((ISecretStore) this).GetProvider(name); @@ -373,7 +373,7 @@ public ICachedSecretProvider GetCachedProvider(string name) /// Returns the secret key. /// Thrown when the is blank. /// Thrown when the secret was not found, using the given name. - [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretAsync) + " instead")] + [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretAsync) + " instead", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public string GetRawSecret(string secretName) { SecretResult result = GetSecret(secretName, configureOptions: null); @@ -387,7 +387,7 @@ public string GetRawSecret(string secretName) /// Returns a that contains the secret key /// Thrown when the is blank. /// Thrown when the secret was not found, using the given name. - [Obsolete("Will be removed in v3.0 in favor of using secret results")] + [Obsolete("Will be removed in v3.0 in favor of using secret results", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public Secret GetSecret(string secretName) { SecretResult result = GetSecret(secretName, configureOptions: null); @@ -441,7 +441,7 @@ private void LogSecurityEvent(SecretProviderRegistration source, string secretNa /// The name of the secret. /// Thrown when the is blank. /// Thrown when no secret was not found, using the given . - [Obsolete("Will be removed in v3.0 as versioned secrets will be moved to concrete implementations")] + [Obsolete("Will be removed in v3.0 as versioned secrets will be moved to concrete implementations", DiagnosticId = ObsoleteDefaults.DiagnosticId)] internal Task> GetSecretsAsync(string secretName) { throw new NotSupportedException( @@ -455,7 +455,7 @@ internal Task> GetSecretsAsync(string secretName) /// The name of the secret. /// Thrown when the is blank. /// Thrown when no secret was not found, using the given . - [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretsAsync) + " instead")] + [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretsAsync) + " instead", DiagnosticId = ObsoleteDefaults.DiagnosticId)] internal Task> GetRawSecretsAsync(string secretName) { throw new NotSupportedException( @@ -471,7 +471,7 @@ internal Task> GetRawSecretsAsync(string secretName) /// Thrown when the is blank. /// Thrown when the is less than zero. /// Thrown when no secret was not found, using the given . - [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretsAsync) + " instead")] + [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretsAsync) + " instead", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public Task> GetRawSecretsAsync(string secretName, int amountOfVersions) { throw new NotSupportedException( @@ -487,7 +487,7 @@ public Task> GetRawSecretsAsync(string secretName, int amoun /// Thrown when the is blank. /// Thrown when the is less than zero. /// Thrown when no secret was not found, using the given . - [Obsolete("Will be removed in v3.0 as versioned secrets will be moved to concrete implementations")] + [Obsolete("Will be removed in v3.0 as versioned secrets will be moved to concrete implementations", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public Task> GetSecretsAsync(string secretName, int amountOfVersions) { throw new NotSupportedException( @@ -503,7 +503,7 @@ public Task> GetSecretsAsync(string secretName, int amountOf /// The must not be empty /// The must not be null /// The secret was not found, using the given name - [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretAsync) + " instead")] + [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretAsync) + " instead", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public async Task GetRawSecretAsync(string secretName) { SecretResult result = await GetSecretAsync(secretName, configureOptions: null); @@ -518,7 +518,7 @@ public async Task GetRawSecretAsync(string secretName) /// The must not be empty /// The must not be null /// The secret was not found, using the given name - [Obsolete("Will be removed in v3.0 in favor of using secret results")] + [Obsolete("Will be removed in v3.0 in favor of using secret results", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public async Task GetSecretAsync(string secretName) { SecretResult result = await GetSecretAsync(secretName, configureOptions: null); @@ -535,7 +535,7 @@ public async Task GetSecretAsync(string secretName) /// The name must not be null /// The secret was not found, using the given name /// Thrown when none of the registered secret providers are registered as instances. - [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretAsync) + " instead")] + [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretAsync) + " instead", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public async Task GetRawSecretAsync(string secretName, bool ignoreCache) { SecretResult result = await GetSecretAsync(secretName, options => options.UseCache = !ignoreCache); @@ -552,7 +552,7 @@ public async Task GetRawSecretAsync(string secretName, bool ignoreCache) /// The name must not be null /// The secret was not found, using the given name /// Thrown when none of the registered secret providers are registered as instances. - [Obsolete("Will be removed in v3.0 in favor of using secret results")] + [Obsolete("Will be removed in v3.0 in favor of using secret results", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public async Task GetSecretAsync(string secretName, bool ignoreCache) { SecretResult result = await GetSecretAsync(secretName, options => options.UseCache = !ignoreCache); @@ -564,7 +564,7 @@ public async Task GetSecretAsync(string secretName, bool ignoreCache) /// so the next time is called, a new version of the secret will be added back to the cache. /// /// The name of the secret that should be removed from the cache. - [Obsolete("Will be removed in v3.0 as invalidating secrets should happen via the " + nameof(ISecretStoreContext))] + [Obsolete("Will be removed in v3.0 as invalidating secrets should happen via the " + nameof(ISecretStoreContext), DiagnosticId = ObsoleteDefaults.DiagnosticId)] public async Task InvalidateSecretAsync(string secretName) { await Cache.InvalidateSecretAsync(secretName); diff --git a/src/Arcus.Security.Core/CriticalExceptionFilter.cs b/src/Arcus.Security.Core/CriticalExceptionFilter.cs index 2b026a1b..1d6c15a4 100644 --- a/src/Arcus.Security.Core/CriticalExceptionFilter.cs +++ b/src/Arcus.Security.Core/CriticalExceptionFilter.cs @@ -7,7 +7,7 @@ namespace Arcus.Security.Core /// so the is able to collect all the available exception filters /// and determine whether or not a critical exception was thrown during interacting with the secret sources. /// - [Obsolete("Will be removed in v3.0 in favor of using secret results to determine secret retrieval failures")] + [Obsolete("Will be removed in v3.0 in favor of using secret results to determine secret retrieval failures", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public class CriticalExceptionFilter { private readonly Func _exceptionFilter; diff --git a/src/Arcus.Security.Core/Extensions/ISecretProviderExtensions.Deprecated.cs b/src/Arcus.Security.Core/Extensions/ISecretProviderExtensions.Deprecated.cs index 6b5ddbd4..acbcabe3 100644 --- a/src/Arcus.Security.Core/Extensions/ISecretProviderExtensions.Deprecated.cs +++ b/src/Arcus.Security.Core/Extensions/ISecretProviderExtensions.Deprecated.cs @@ -25,7 +25,7 @@ public static class ISecretProviderExtensions /// The must not be empty /// The must not be null /// The secret was not found, using the given name - [Obsolete("Use the " + nameof(Core.ISecretProviderExtensions.GetRawSecretsAsync) + " extension instead")] + [Obsolete("Use the " + nameof(Core.ISecretProviderExtensions.GetRawSecretsAsync) + " extension instead", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public static async Task> GetRawSecretsAsync(this ISecretProvider secretProvider, string secretName) { ArgumentException.ThrowIfNullOrWhiteSpace(secretName); @@ -52,7 +52,7 @@ public static async Task> GetRawSecretsAsync(this ISecretPro /// The must not be empty /// The must not be null /// The secret was not found, using the given name - [Obsolete("Use the " + nameof(Core.ISecretProviderExtensions.GetSecretsAsync) + " extension instead")] + [Obsolete("Use the " + nameof(Core.ISecretProviderExtensions.GetSecretsAsync) + " extension instead", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public static async Task> GetSecretsAsync(this ISecretProvider secretProvider, string secretName) { ArgumentException.ThrowIfNullOrWhiteSpace(secretName); diff --git a/src/Arcus.Security.Core/Extensions/ISecretProviderExtensions.cs b/src/Arcus.Security.Core/Extensions/ISecretProviderExtensions.cs index af27c07b..fe32d299 100644 --- a/src/Arcus.Security.Core/Extensions/ISecretProviderExtensions.cs +++ b/src/Arcus.Security.Core/Extensions/ISecretProviderExtensions.cs @@ -20,7 +20,7 @@ public static class ISecretProviderExtensions /// Returns the secret key. /// Thrown when the is blank. /// Thrown when the secret was not found, using the given name. - [Obsolete("Will be removed in v3 in favor of solely using " + nameof(Arcus.Security.ISecretProvider.GetSecretAsync) + " instead")] + [Obsolete("Will be removed in v3 in favor of solely using " + nameof(Arcus.Security.ISecretProvider.GetSecretAsync) + " instead", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public static string GetRawSecret(this ISecretProvider secretProvider, string secretName) { if (secretProvider is null) @@ -51,7 +51,7 @@ public static string GetRawSecret(this ISecretProvider secretProvider, string se /// Returns the secret key. /// Thrown when the is blank. /// Thrown when the secret was not found, using the given name. - [Obsolete("Will be removed in v3.0 in favor of using a new secret provider interface 'Arcus.Security.ISecretProvider'")] + [Obsolete("Will be removed in v3.0 in favor of using a new secret provider interface 'Arcus.Security.ISecretProvider'", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public static Secret GetSecret(this ISecretProvider secretProvider, string secretName) { if (secretProvider is null) @@ -86,7 +86,7 @@ public static Secret GetSecret(this ISecretProvider secretProvider, string secre /// The must not be empty /// The must not be null /// The secret was not found, using the given name - [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretsAsync) + " instead")] + [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretsAsync) + " instead", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public static async Task> GetRawSecretsAsync(this ISecretProvider secretProvider, string secretName) { if (string.IsNullOrWhiteSpace(secretName)) @@ -116,7 +116,7 @@ public static async Task> GetRawSecretsAsync(this ISecretPro /// The must not be empty /// The must not be null /// The secret was not found, using the given name - [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretsAsync) + " instead")] + [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretsAsync) + " instead", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public static async Task> GetRawSecretsAsync(this Security.ISecretProvider secretProvider, string secretName) { if (string.IsNullOrWhiteSpace(secretName)) @@ -146,7 +146,7 @@ public static async Task> GetRawSecretsAsync(this Security.I /// The must not be empty /// The must not be null /// The secret was not found, using the given name - [Obsolete("Will be removed in v3.0 as versioned secrets will be handled on the concrete secret providers themselves")] + [Obsolete("Will be removed in v3.0 as versioned secrets will be handled on the concrete secret providers themselves", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public static async Task> GetSecretsAsync(this ISecretProvider secretProvider, string secretName) { if (string.IsNullOrWhiteSpace(secretName)) @@ -177,7 +177,7 @@ public static async Task> GetSecretsAsync(this ISecretProvid /// The must not be empty /// The must not be null /// The secret was not found, using the given name - [Obsolete("Will be removed in v3.0 as versioned secrets will be handled on the concrete secret providers themselves")] + [Obsolete("Will be removed in v3.0 as versioned secrets will be handled on the concrete secret providers themselves", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public static async Task> GetSecretsAsync(this Security.ISecretProvider secretProvider, string secretName) { if (string.IsNullOrWhiteSpace(secretName)) diff --git a/src/Arcus.Security.Core/Extensions/SecretStoreBuilderExtensions.cs b/src/Arcus.Security.Core/Extensions/SecretStoreBuilderExtensions.cs index 97c96648..a650a7af 100644 --- a/src/Arcus.Security.Core/Extensions/SecretStoreBuilderExtensions.cs +++ b/src/Arcus.Security.Core/Extensions/SecretStoreBuilderExtensions.cs @@ -1,4 +1,5 @@ using System; +using Arcus.Security; using Arcus.Security.Core.Providers; using Microsoft.Extensions.Configuration; @@ -74,7 +75,7 @@ public static class DeprecatedSecretStoreBuilderExtensions /// The optional function to mutate the secret name before looking it up. /// Thrown when the is null. /// Thrown when the is outside the bounds of the enumeration. - [Obsolete("Will be removed in v3.0 in favor of configuring the secret provider registration with options")] + [Obsolete("Will be removed in v3.0 in favor of configuring the secret provider registration with options", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public static SecretStoreBuilder AddEnvironmentVariables( this SecretStoreBuilder builder, EnvironmentVariableTarget target = EnvironmentVariableSecretProvider.DefaultTarget, @@ -95,7 +96,7 @@ public static SecretStoreBuilder AddEnvironmentVariables( /// The optional function to mutate the secret name before looking it up. /// Thrown when the is null. /// Thrown when the is outside the bounds of the enumeration. - [Obsolete("Will be removed in v3.0 in favor of configuring the secret provider registration with options")] + [Obsolete("Will be removed in v3.0 in favor of configuring the secret provider registration with options", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public static SecretStoreBuilder AddEnvironmentVariables( this SecretStoreBuilder builder, EnvironmentVariableTarget target, @@ -135,7 +136,7 @@ public static SecretStoreBuilder AddEnvironmentVariables( /// The configuration of the application, containing secrets. /// The function to mutate the secret name before looking it up. /// Thrown when the is null. - [Obsolete("Will be removed in v3.0 in favor of configuring the secret provider registration with options")] + [Obsolete("Will be removed in v3.0 in favor of configuring the secret provider registration with options", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public static SecretStoreBuilder AddConfiguration( this SecretStoreBuilder builder, IConfiguration configuration, @@ -153,7 +154,7 @@ public static SecretStoreBuilder AddConfiguration( /// The unique name to register this Configuration provider in the secret store. /// The optional function to mutate the secret name before looking it up. /// Thrown when the is null. - [Obsolete("Will be removed in v3.0 in favor of configuring the secret provider registration with options")] + [Obsolete("Will be removed in v3.0 in favor of configuring the secret provider registration with options", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public static SecretStoreBuilder AddConfiguration( this SecretStoreBuilder builder, IConfiguration configuration, diff --git a/src/Arcus.Security.Core/ISecretProvider.cs b/src/Arcus.Security.Core/ISecretProvider.cs index 364ff129..fc24fde1 100644 --- a/src/Arcus.Security.Core/ISecretProvider.cs +++ b/src/Arcus.Security.Core/ISecretProvider.cs @@ -11,7 +11,7 @@ namespace Arcus.Security.Core /// /// allows developers to build specific Secret key providers. /// - [Obsolete("Will be removed in v3.0 in favor a new interface 'Arcus.Security.ISecretProvider'")] + [Obsolete("Will be removed in v3.0 in favor a new interface 'Arcus.Security.ISecretProvider'", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public interface ISecretProvider { /// @@ -22,7 +22,7 @@ public interface ISecretProvider /// The must not be empty /// The must not be null /// The secret was not found, using the given name - [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretAsync) + " instead")] + [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretAsync) + " instead", DiagnosticId = ObsoleteDefaults.DiagnosticId)] Task GetRawSecretAsync(string secretName); /// @@ -84,7 +84,7 @@ public static class DeprecatedSecretProviderExtensions /// The must not be empty /// The must not be null /// The secret was not found, using the given name - [Obsolete("Will be removed in v3.0, please use the new " + nameof(ISecretProvider.GetSecretAsync) + " overloads with secret results")] + [Obsolete("Will be removed in v3.0, please use the new " + nameof(ISecretProvider.GetSecretAsync) + " overloads with secret results", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public static async Task GetSecretAsync(this ISecretProvider provider, string secretName) { return await provider.GetSecretAsync(secretName); @@ -99,7 +99,7 @@ public static async Task GetSecretAsync(this ISecretProvider provider, s /// The must not be empty /// The must not be null /// The secret was not found, using the given name - [Obsolete("Will be removed in v3.0, please use the new " + nameof(ISecretProvider.GetSecret) + " overloads with secret results")] + [Obsolete("Will be removed in v3.0, please use the new " + nameof(ISecretProvider.GetSecret) + " overloads with secret results", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public static Secret GetSecret(this ISecretProvider provider, string secretName) { return provider.GetSecret(secretName); @@ -114,7 +114,7 @@ public static Secret GetSecret(this ISecretProvider provider, string secretName) /// The must not be empty /// The must not be null /// The secret was not found, using the given name - [Obsolete("Will be removed in v3.0, please use the new " + nameof(ISecretProvider.GetSecretAsync) + " overloads with secret results")] + [Obsolete("Will be removed in v3.0, please use the new " + nameof(ISecretProvider.GetSecretAsync) + " overloads with secret results", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public static async Task GetRawSecretAsync(this ISecretProvider provider, string secretName) { Secret secret = await GetSecretAsync(provider, secretName); @@ -130,7 +130,7 @@ public static async Task GetRawSecretAsync(this ISecretProvider provider /// The must not be empty /// The must not be null /// The secret was not found, using the given name - [Obsolete("Will be removed in v3.0, please use the new " + nameof(ISecretProvider.GetSecret) + " overloads with secret results")] + [Obsolete("Will be removed in v3.0, please use the new " + nameof(ISecretProvider.GetSecret) + " overloads with secret results", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public static string GetRawSecret(this ISecretProvider provider, string secretName) { Secret secret = GetSecret(provider, secretName); @@ -340,7 +340,7 @@ public static implicit operator string(SecretResult result) /// /// Converts the to its deprecated previous implementation. /// - [Obsolete("Will be removed in v3.0 in favor of using secret results")] + [Obsolete("Will be removed in v3.0 in favor of using secret results", DiagnosticId = ObsoleteDefaults.DiagnosticId)] #pragma warning disable CS0618 public static implicit operator Secret(SecretResult result) #pragma warning restore diff --git a/src/Arcus.Security.Core/ISecretStore.cs b/src/Arcus.Security.Core/ISecretStore.cs index 80864245..d63b4e3c 100644 --- a/src/Arcus.Security.Core/ISecretStore.cs +++ b/src/Arcus.Security.Core/ISecretStore.cs @@ -12,7 +12,7 @@ namespace Arcus.Security.Core /// /// Represents the exposed functionality of the secret store. /// - [Obsolete("Will be removed in v3.0 in favor of a new " + nameof(Security.ISecretStore) + " interface in the 'Arcus.Security' namespace")] + [Obsolete("Will be removed in v3.0 in favor of a new " + nameof(Security.ISecretStore) + " interface in the 'Arcus.Security' namespace", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public interface ISecretStore { /// @@ -149,7 +149,7 @@ public static TProvider GetProvider(this ISecretStore store) where TP /// Thrown when there was no found in the secret store with the given . /// Thrown when the registered cannot be cast to the specific . /// Thrown when multiple were registered with the same name. - [Obsolete("Will be removed in v3.0 in favor of a new interface 'Arcus.Security.ISecretProvider'")] + [Obsolete("Will be removed in v3.0 in favor of a new interface 'Arcus.Security.ISecretProvider'", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public static TSecretProvider GetProvider(this ISecretStore store, string name) where TSecretProvider : Core.ISecretProvider { var provider = store.GetProvider(name); @@ -172,7 +172,7 @@ public static TSecretProvider GetProvider(this ISecretStore sto /// Thrown when their was either none of the registered secret providers are registered as instances /// or there was an registered but not with caching. /// - [Obsolete("Will be removed in v3.0 as secret caching will happen on the secret store itself")] + [Obsolete("Will be removed in v3.0 as secret caching will happen on the secret store itself", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public static ICachedSecretProvider GetCachedProvider(this ISecretStore store, string name) { var provider = store.GetProvider(name); @@ -198,7 +198,7 @@ public static ICachedSecretProvider GetCachedProvider(this ISecretStore store, s /// /// Thrown when the registered cannot be cast to the specific . /// Thrown when multiple were registered with the same name. - [Obsolete("Will be removed in v3.0 as secret caching will happen on the secret store itself")] + [Obsolete("Will be removed in v3.0 as secret caching will happen on the secret store itself", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public static TCachedSecretProvider GetCachedProvider(this ISecretStore store, string name) where TCachedSecretProvider : ICachedSecretProvider { var provider = store.GetProvider(name); diff --git a/src/Arcus.Security.Core/ISyncSecretProvider.cs b/src/Arcus.Security.Core/ISyncSecretProvider.cs index 59480a09..cfd30e08 100644 --- a/src/Arcus.Security.Core/ISyncSecretProvider.cs +++ b/src/Arcus.Security.Core/ISyncSecretProvider.cs @@ -5,7 +5,7 @@ namespace Arcus.Security.Core /// /// Represents an additional synchronous implementation on top of the . /// - [Obsolete("Will be removed in v3.0 in favor of using the new secret provider interface which has already a synchronous variant of secret retrieval")] + [Obsolete("Will be removed in v3.0 in favor of using the new secret provider interface which has already a synchronous variant of secret retrieval", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public interface ISyncSecretProvider : ISecretProvider { /// @@ -15,7 +15,7 @@ public interface ISyncSecretProvider : ISecretProvider /// Returns the secret key. /// Thrown when the is blank. /// Thrown when the secret was not found, using the given name. - [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecret) + " instead")] + [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecret) + " instead", DiagnosticId = ObsoleteDefaults.DiagnosticId)] string GetRawSecret(string secretName); /// diff --git a/src/Arcus.Security.Core/IVersionedSecretProvider.cs b/src/Arcus.Security.Core/IVersionedSecretProvider.cs index 97c94357..1c7bc4d6 100644 --- a/src/Arcus.Security.Core/IVersionedSecretProvider.cs +++ b/src/Arcus.Security.Core/IVersionedSecretProvider.cs @@ -7,7 +7,7 @@ namespace Arcus.Security.Core /// /// Represents an implementation that supports multiple versions of a secret. /// - [Obsolete("Will be removed in v3.0 in favor of accessing versioned secrets on the concrete secret provider implementations")] + [Obsolete("Will be removed in v3.0 in favor of accessing versioned secrets on the concrete secret provider implementations", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public interface IVersionedSecretProvider : ISecretProvider { /// diff --git a/src/Arcus.Security.Core/Providers/ConfigurationSecretProvider.cs b/src/Arcus.Security.Core/Providers/ConfigurationSecretProvider.cs index 98f8f32d..9e28af9c 100644 --- a/src/Arcus.Security.Core/Providers/ConfigurationSecretProvider.cs +++ b/src/Arcus.Security.Core/Providers/ConfigurationSecretProvider.cs @@ -53,7 +53,7 @@ SecretResult Security.ISecretProvider.GetSecret(string secretName) /// The must not be empty /// The must not be null /// The secret was not found, using the given name - [Obsolete("Will be removed in v3.0 in favor of using secret results")] + [Obsolete("Will be removed in v3.0 in favor of using secret results", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public Task GetSecretAsync(string secretName) { Secret secret = GetSecret(secretName); @@ -66,7 +66,7 @@ public Task GetSecretAsync(string secretName) /// The must not be empty /// The must not be null /// The secret was not found, using the given name - [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretAsync) + " instead")] + [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretAsync) + " instead", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public Task GetRawSecretAsync(string secretName) { string secretValue = GetRawSecret(secretName); @@ -80,7 +80,7 @@ public Task GetRawSecretAsync(string secretName) /// Returns a that contains the secret key /// Thrown when the is blank. /// Thrown when the secret was not found, using the given name. - [Obsolete("Will be removed in v3.0 in favor of using secret results")] + [Obsolete("Will be removed in v3.0 in favor of using secret results", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public Secret GetSecret(string secretName) { SecretResult result = ((Security.ISecretProvider) this).GetSecret(secretName); @@ -94,7 +94,7 @@ public Secret GetSecret(string secretName) /// Returns the secret key. /// Thrown when the is blank. /// Thrown when the secret was not found, using the given name. - [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecret) + " instead")] + [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecret) + " instead", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public string GetRawSecret(string secretName) { return GetSecret(secretName)?.Value; diff --git a/src/Arcus.Security.Core/Providers/EnvironmentVariableSecretProvider.cs b/src/Arcus.Security.Core/Providers/EnvironmentVariableSecretProvider.cs index f98984a8..e037d596 100644 --- a/src/Arcus.Security.Core/Providers/EnvironmentVariableSecretProvider.cs +++ b/src/Arcus.Security.Core/Providers/EnvironmentVariableSecretProvider.cs @@ -60,7 +60,7 @@ public class EnvironmentVariableSecretProvider : /// The target on which the environment variables should be retrieved. /// The optional prefix which will be prepended to the secret name when retrieving environment variables. /// Thrown when the is outside the bounds of the enumeration. - [Obsolete("Will be removed in v3.0 in favor of internal constructor")] + [Obsolete("Will be removed in v3.0 in favor of internal constructor", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public EnvironmentVariableSecretProvider(EnvironmentVariableTarget target = DefaultTarget, string prefix = null) { if (!Enum.IsDefined(typeof(EnvironmentVariableTarget), target)) @@ -107,7 +107,7 @@ SecretResult Security.ISecretProvider.GetSecret(string secretName) /// The must not be empty /// The must not be null /// The secret was not found, using the given name - [Obsolete("Will be removed in v3.0 in favor of using secret results")] + [Obsolete("Will be removed in v3.0 in favor of using secret results", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public Task GetSecretAsync(string secretName) { Secret secret = GetSecret(secretName); @@ -122,7 +122,7 @@ public Task GetSecretAsync(string secretName) /// The must not be empty /// The must not be null /// The secret was not found, using the given name - [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretAsync) + " instead")] + [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretAsync) + " instead", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public Task GetRawSecretAsync(string secretName) { string secretValue = GetRawSecret(secretName); @@ -136,7 +136,7 @@ public Task GetRawSecretAsync(string secretName) /// Returns a that contains the secret key /// Thrown when the is blank. /// Thrown when the secret was not found, using the given name. - [Obsolete("Will be removed in v3.0 in favor of using secret results")] + [Obsolete("Will be removed in v3.0 in favor of using secret results", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public Secret GetSecret(string secretName) { SecretResult result = ((Security.ISecretProvider) this).GetSecret(secretName); @@ -150,7 +150,7 @@ public Secret GetSecret(string secretName) /// Returns the secret key. /// Thrown when the is blank. /// Thrown when the secret was not found, using the given name. - [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecret) + " instead")] + [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecret) + " instead", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public string GetRawSecret(string secretName) { return GetSecret(secretName)?.Value; diff --git a/src/Arcus.Security.Core/Providers/MutatedSecretNameCachedSecretProvider.cs b/src/Arcus.Security.Core/Providers/MutatedSecretNameCachedSecretProvider.cs index 91436265..fe90b2c5 100644 --- a/src/Arcus.Security.Core/Providers/MutatedSecretNameCachedSecretProvider.cs +++ b/src/Arcus.Security.Core/Providers/MutatedSecretNameCachedSecretProvider.cs @@ -9,7 +9,7 @@ namespace Arcus.Security.Core.Providers /// /// Represents an that can mutate the secret name provided before looking up the secret. /// - [Obsolete("Will be removed in v3.0 in favor of moving secret name mutation solely in secret provider registration options")] + [Obsolete("Will be removed in v3.0 in favor of moving secret name mutation solely in secret provider registration options", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public class MutatedSecretNameCachedSecretProvider : MutatedSecretNameSecretProvider, ICachedSecretProvider { private readonly ICachedSecretProvider _implementation; @@ -51,7 +51,7 @@ public MutatedSecretNameCachedSecretProvider( /// The name must not be empty /// The name must not be null /// The secret was not found, using the given name - [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretAsync) + " instead")] + [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretAsync) + " instead", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public async Task GetRawSecretAsync(string secretName, bool ignoreCache) { if (string.IsNullOrWhiteSpace(secretName)) diff --git a/src/Arcus.Security.Core/Providers/MutatedSecretNameSecretProvider.cs b/src/Arcus.Security.Core/Providers/MutatedSecretNameSecretProvider.cs index 2cece444..0f2e2b13 100644 --- a/src/Arcus.Security.Core/Providers/MutatedSecretNameSecretProvider.cs +++ b/src/Arcus.Security.Core/Providers/MutatedSecretNameSecretProvider.cs @@ -8,7 +8,7 @@ namespace Arcus.Security.Core.Providers /// /// Represents an that can mutate the secret name provided before looking up the secret. /// - [Obsolete("Will be removed in v3.0 in favor of moving secret name mutation solely in secret provider registration options")] + [Obsolete("Will be removed in v3.0 in favor of moving secret name mutation solely in secret provider registration options", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public class MutatedSecretNameSecretProvider : ISyncSecretProvider { private readonly Func _mutateSecretName; @@ -54,7 +54,7 @@ public MutatedSecretNameSecretProvider(ISecretProvider implementation, FuncThe must not be empty /// The must not be null /// The secret was not found, using the given name - [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretAsync) + " instead")] + [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretAsync) + " instead", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public async Task GetRawSecretAsync(string secretName) { if (string.IsNullOrWhiteSpace(secretName)) @@ -100,7 +100,7 @@ public async Task GetSecretAsync(string secretName) /// Returns the secret key. /// Thrown when the is blank. /// Thrown when the secret was not found, using the given name. - [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretAsync) + " instead")] + [Obsolete("Will be removed in v3 in favor of solely using " + nameof(GetSecretAsync) + " instead", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public string GetRawSecret(string secretName) { if (string.IsNullOrWhiteSpace(secretName)) diff --git a/src/Arcus.Security.Core/Secret.cs b/src/Arcus.Security.Core/Secret.cs index c1a20774..c332bb5d 100644 --- a/src/Arcus.Security.Core/Secret.cs +++ b/src/Arcus.Security.Core/Secret.cs @@ -5,7 +5,7 @@ namespace Arcus.Security.Core /// /// Represents the secret returned from the implementation. /// - [Obsolete("Will be removed in v3.0 in favor of using secret results")] + [Obsolete("Will be removed in v3.0 in favor of using secret results", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public class Secret { /// diff --git a/src/Arcus.Security.Core/SecretNotFoundException.cs b/src/Arcus.Security.Core/SecretNotFoundException.cs index 09818ff2..bba6fc22 100644 --- a/src/Arcus.Security.Core/SecretNotFoundException.cs +++ b/src/Arcus.Security.Core/SecretNotFoundException.cs @@ -5,7 +5,7 @@ namespace Arcus.Security.Core /// /// Exception, thrown when no secret was found, using the given name. /// - [Obsolete("Will be removed in v3.0 in favor of using secret results")] + [Obsolete("Will be removed in v3.0 in favor of using secret results", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public class SecretNotFoundException : Exception { /// diff --git a/src/Arcus.Security.Core/SecretProviderOptions.cs b/src/Arcus.Security.Core/SecretProviderOptions.cs index 5ce60870..a9efa235 100644 --- a/src/Arcus.Security.Core/SecretProviderOptions.cs +++ b/src/Arcus.Security.Core/SecretProviderOptions.cs @@ -7,7 +7,7 @@ namespace Arcus.Security.Core /// /// Represents the additional options to register an implementation to the secret store. /// - [Obsolete("Will be removed in v3.0 in favor of a new " + nameof(SecretProviderRegistrationOptions) + " model")] + [Obsolete("Will be removed in v3.0 in favor of a new " + nameof(SecretProviderRegistrationOptions) + " model", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public class SecretProviderOptions { private readonly IDictionary _versionedSecretNames = new Dictionary(); diff --git a/src/Arcus.Security.Core/SecretStoreAuditingOptions.cs b/src/Arcus.Security.Core/SecretStoreAuditingOptions.cs index a1947256..18c37d4b 100644 --- a/src/Arcus.Security.Core/SecretStoreAuditingOptions.cs +++ b/src/Arcus.Security.Core/SecretStoreAuditingOptions.cs @@ -5,7 +5,7 @@ namespace Arcus.Security.Core /// /// Represents configurable options related to auditing during the lifetime of the secret store. /// - [Obsolete("Will be removed in v3.0 as the hard-link to Arcus.Observability will be removed")] + [Obsolete("Will be removed in v3.0 as the hard-link to Arcus.Observability will be removed", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public class SecretStoreAuditingOptions { /// diff --git a/src/Arcus.Security.Core/SecretStoreBuilder.cs b/src/Arcus.Security.Core/SecretStoreBuilder.cs index 6da62b17..0a7c089e 100644 --- a/src/Arcus.Security.Core/SecretStoreBuilder.cs +++ b/src/Arcus.Security.Core/SecretStoreBuilder.cs @@ -51,7 +51,7 @@ public SecretStoreBuilder(IServiceCollection services) /// The series of secret stores is directly publicly available, including the operations so future (consumer) extensions can easily low-level manipulate this series during build-up. /// Though, for almost all use-cases, the and the should be sufficient. /// - [Obsolete("Will be removed in v3.0 as secret providers are registered internally")] + [Obsolete("Will be removed in v3.0 as secret providers are registered internally", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public IList SecretStoreSources { get; } = new List(); /// @@ -62,7 +62,7 @@ public SecretStoreBuilder(IServiceCollection services) /// The series of exception filters is directly publicly available including the operations so future (consumer) extensions can easily low-level manipulate this series during build-up. /// Though, for almost all use-cases, the and should be sufficient. /// - [Obsolete("Will be removed in v3.0 as secret results are capturing failures")] + [Obsolete("Will be removed in v3.0 as secret results are capturing failures", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public IList CriticalExceptionFilters { get; } = new List(); /// @@ -73,7 +73,7 @@ public SecretStoreBuilder(IServiceCollection services) /// The extended secret store with the given . /// /// Thrown when the is null. - [Obsolete("Will be removed in v3.0 in favor of using a new interface 'Arcus.Security.ISecretProvider'")] + [Obsolete("Will be removed in v3.0 in favor of using a new interface 'Arcus.Security.ISecretProvider'", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public SecretStoreBuilder AddProvider(ISecretProvider secretProvider) { return AddProvider(secretProvider ?? throw new ArgumentNullException(nameof(secretProvider)), configureOptions: null); @@ -88,7 +88,7 @@ public SecretStoreBuilder AddProvider(ISecretProvider secretProvider) /// The extended secret store with the given . /// /// Thrown when the is null. - [Obsolete("Will be removed in v3.0 in favor of using a new interface 'Arcus.Security.ISecretProvider'")] + [Obsolete("Will be removed in v3.0 in favor of using a new interface 'Arcus.Security.ISecretProvider'", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public SecretStoreBuilder AddProvider( ISecretProvider secretProvider, Action configureOptions) @@ -127,7 +127,7 @@ public SecretStoreBuilder AddProvider( /// The extended secret store with the given as lazy initialization. /// /// Thrown when the is null. - [Obsolete("Will be removed in v3.0, please use the new " + nameof(ISecretProvider) + " in the 'Arcus.Security' namespace")] + [Obsolete("Will be removed in v3.0, please use the new " + nameof(ISecretProvider) + " in the 'Arcus.Security' namespace", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public SecretStoreBuilder AddProvider(Func createSecretProvider) { return AddProvider(createSecretProvider, configureOptions: null); @@ -142,7 +142,7 @@ public SecretStoreBuilder AddProvider(Func cr /// The extended secret store with the given as lazy initialization. /// /// Thrown when the is null. - [Obsolete("Will be removed in v3.0 in favor of using a new interface 'Arcus.Security.ISecretProvider'")] + [Obsolete("Will be removed in v3.0 in favor of using a new interface 'Arcus.Security.ISecretProvider'", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public SecretStoreBuilder AddProvider( Func createSecretProvider, Action configureOptions) @@ -304,7 +304,7 @@ public void UseCaching(TimeSpan duration) /// which makes sure that the secret store handles all exceptions of type differently. /// /// The type of the to add as critical exception. - [Obsolete("Will be removed in v3.0 in favor of using secret results")] + [Obsolete("Will be removed in v3.0 in favor of using secret results", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public SecretStoreBuilder AddCriticalException() where TException : Exception { CriticalExceptionFilters.Add(new CriticalExceptionFilter(typeof(TException), exception => exception is TException)); @@ -318,7 +318,7 @@ public SecretStoreBuilder AddCriticalException() where TException : /// The type of the to add as critical exception. /// The filter that makes sure that only specific 's are considered critical exceptions. /// Thrown when the is null. - [Obsolete("Will be removed in v3.0 in favor of using secret results")] + [Obsolete("Will be removed in v3.0 in favor of using secret results", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public SecretStoreBuilder AddCriticalException(Func exceptionFilter) where TException : Exception { if (exceptionFilter is null) @@ -344,7 +344,7 @@ public SecretStoreBuilder AddCriticalException(Func /// The function to customize the auditing options of the secret store. /// Thrown when the is null. - [Obsolete("Will be removed in v3.0 as the hard-link to Arcus.Observability will be removed")] + [Obsolete("Will be removed in v3.0 as the hard-link to Arcus.Observability will be removed", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public SecretStoreBuilder WithAuditing(Action configureOptions) { _configureAuditingOptions.Add(configureOptions ?? throw new ArgumentNullException(nameof(configureOptions))); diff --git a/src/Arcus.Security.Core/SecretStoreSource.cs b/src/Arcus.Security.Core/SecretStoreSource.cs index 2f3708e1..413b19a7 100644 --- a/src/Arcus.Security.Core/SecretStoreSource.cs +++ b/src/Arcus.Security.Core/SecretStoreSource.cs @@ -10,7 +10,7 @@ namespace Arcus.Security.Core /// /// Represents an entry for an implementation. /// - [Obsolete("Will be removed in v3.0 in favor of internal secret provider registration")] + [Obsolete("Will be removed in v3.0 in favor of internal secret provider registration", DiagnosticId = ObsoleteDefaults.DiagnosticId)] public class SecretStoreSource { private readonly Func _createSecretProvider; diff --git a/src/Arcus.Security.sln b/src/Arcus.Security.sln index 668adf7a..6bd5ee27 100644 --- a/src/Arcus.Security.sln +++ b/src/Arcus.Security.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.0.32126.317 +# Visual Studio Version 18 +VisualStudioVersion = 18.2.11430.68 d18.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Arcus.Security.Tests.Unit", "Arcus.Security.Tests.Unit\Arcus.Security.Tests.Unit.csproj", "{DACBC3C6-2894-4961-B327-746BC29229CC}" EndProject @@ -28,6 +28,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig + ObsoleteDefaults.cs = ObsoleteDefaults.cs EndProjectSection EndProject Global diff --git a/src/ObsoleteDefaults.cs b/src/ObsoleteDefaults.cs new file mode 100644 index 00000000..49b2e13c --- /dev/null +++ b/src/ObsoleteDefaults.cs @@ -0,0 +1,13 @@ +namespace Arcus.Security +{ + /// + /// Represents the deprecation defaults used throughout deprecated Arcus functionality. + /// + internal static class ObsoleteDefaults + { + /// + /// Gets the diagnostic identifier to group Arcus deprecated functionality. + /// + internal const string DiagnosticId = "ARCUS"; + } +} \ No newline at end of file