diff --git a/src/Context/SendingRequestContext.cs b/src/Context/SendingRequestContext.cs index 695feba..a810fa1 100644 --- a/src/Context/SendingRequestContext.cs +++ b/src/Context/SendingRequestContext.cs @@ -1,7 +1,7 @@ // Copyright (c) Duende Software. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. -using IdentityModel.Client; +using Duende.IdentityModel.Client; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http; diff --git a/src/Context/UpdateClientAssertionContext.cs b/src/Context/UpdateClientAssertionContext.cs index 5221b81..5b921fe 100644 --- a/src/Context/UpdateClientAssertionContext.cs +++ b/src/Context/UpdateClientAssertionContext.cs @@ -1,10 +1,10 @@ // Copyright (c) Duende Software. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. -using System; -using IdentityModel.Client; +using Duende.IdentityModel.Client; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http; +using System; namespace IdentityModel.AspNetCore.OAuth2Introspection { diff --git a/src/IdentityModel.AspNetCore.OAuth2Introspection.csproj b/src/IdentityModel.AspNetCore.OAuth2Introspection.csproj index 0c8510d..2d87716 100644 --- a/src/IdentityModel.AspNetCore.OAuth2Introspection.csproj +++ b/src/IdentityModel.AspNetCore.OAuth2Introspection.csproj @@ -27,7 +27,7 @@ - + diff --git a/src/Infrastructure/CacheExtensions.cs b/src/Infrastructure/CacheExtensions.cs index 5593dfa..1ca75b1 100644 --- a/src/Infrastructure/CacheExtensions.cs +++ b/src/Infrastructure/CacheExtensions.cs @@ -1,6 +1,7 @@ // Copyright (c) Duende Software. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. +using Duende.IdentityModel; using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.Logging; using System; @@ -19,20 +20,20 @@ internal static class CacheExtensions private static readonly JsonSerializerOptions Options; static CacheExtensions() - { + { Options = new JsonSerializerOptions { IgnoreReadOnlyFields = true, IgnoreReadOnlyProperties = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull }; - + Options.Converters.Add(new ClaimConverter()); } public static async Task> GetClaimsAsync(this IDistributedCache cache, OAuth2IntrospectionOptions options, string token) { - var cacheKey = options.CacheKeyGenerator(options,token); + var cacheKey = options.CacheKeyGenerator(options, token); var bytes = await cache.GetAsync(cacheKey).ConfigureAwait(false); if (bytes == null) diff --git a/src/OAuth2IntrospectionHandler.cs b/src/OAuth2IntrospectionHandler.cs index ad35659..d8a932b 100644 --- a/src/OAuth2IntrospectionHandler.cs +++ b/src/OAuth2IntrospectionHandler.cs @@ -1,7 +1,7 @@ // Copyright (c) Duende Software. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. -using IdentityModel.Client; +using Duende.IdentityModel.Client; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Caching.Distributed; diff --git a/src/OAuth2IntrospectionOptions.cs b/src/OAuth2IntrospectionOptions.cs index 7ed81ab..cceb543 100644 --- a/src/OAuth2IntrospectionOptions.cs +++ b/src/OAuth2IntrospectionOptions.cs @@ -1,8 +1,9 @@ // Copyright (c) Duende Software. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. +using Duende.IdentityModel; +using Duende.IdentityModel.Client; using IdentityModel.AspNetCore.OAuth2Introspection.Infrastructure; -using IdentityModel.Client; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http; using System; @@ -116,7 +117,7 @@ public OAuth2IntrospectionOptions() /// /// Specifies the method how to generate the cache key from the token /// - public Func CacheKeyGenerator { get; set; } = CacheUtils.CacheKeyFromToken(); + public Func CacheKeyGenerator { get; set; } = CacheUtils.CacheKeyFromToken(); /// /// Specifies the method how to retrieve the token from the HTTP request @@ -133,7 +134,7 @@ public OAuth2IntrospectionOptions() } internal AsyncLazy IntrospectionClient { get; set; } - + /// /// Check that the options are valid. Should throw an exception if things are not ok. /// diff --git a/src/PostConfigureOAuth2IntrospectionOptions.cs b/src/PostConfigureOAuth2IntrospectionOptions.cs index 3a46e5e..471315f 100644 --- a/src/PostConfigureOAuth2IntrospectionOptions.cs +++ b/src/PostConfigureOAuth2IntrospectionOptions.cs @@ -1,13 +1,13 @@ // Copyright (c) Duende Software. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. -using System; -using System.Net.Http; -using System.Threading.Tasks; +using Duende.IdentityModel.Client; using IdentityModel.AspNetCore.OAuth2Introspection.Infrastructure; -using IdentityModel.Client; using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.Options; +using System; +using System.Net.Http; +using System.Threading.Tasks; namespace IdentityModel.AspNetCore.OAuth2Introspection { @@ -30,7 +30,7 @@ public void PostConfigure(string name, OAuth2IntrospectionOptions options) { throw new ArgumentException("Caching is enabled, but no IDistributedCache is found in the services collection", nameof(_cache)); } - + options.IntrospectionClient = new AsyncLazy(() => InitializeIntrospectionClient(options)); } @@ -53,7 +53,7 @@ private async Task GetIntrospectionEndpointFromDiscoveryDocument(OAuth2I Address = options.Authority, Policy = options?.DiscoveryPolicy ?? new DiscoveryPolicy() }).ConfigureAwait(false); - + if (disco.IsError) { switch (disco.ErrorType) diff --git a/test/Tests/Configuration.cs b/test/Tests/Configuration.cs index 8bf52bc..88d2d29 100644 --- a/test/Tests/Configuration.cs +++ b/test/Tests/Configuration.cs @@ -1,9 +1,9 @@ // Copyright (c) Duende Software. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. +using Duende.IdentityModel.Client; using FluentAssertions; using IdentityModel.AspNetCore.OAuth2Introspection; -using IdentityModel.Client; using System; using System.Threading.Tasks; using Tests.Util; diff --git a/test/Tests/Introspection.cs b/test/Tests/Introspection.cs index 4653fd2..7b59485 100644 --- a/test/Tests/Introspection.cs +++ b/test/Tests/Introspection.cs @@ -1,10 +1,10 @@ // Copyright (c) Duende Software. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. +using Duende.IdentityModel; +using Duende.IdentityModel.Client; using FluentAssertions; -using IdentityModel; using IdentityModel.AspNetCore.OAuth2Introspection; -using IdentityModel.Client; using Microsoft.AspNetCore.TestHost; using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.DependencyInjection;