diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a4873c985..0af85e51b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -24,9 +24,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Setup .NET
- uses: actions/setup-dotnet@v2
+ uses: actions/setup-dotnet@v4
with:
- dotnet-version: 7.0.x
+ dotnet-version: '9'
- if: contains(matrix.runs-on, 'macOS') || contains(matrix.runs-on, 'ubuntu')
env:
MINVERVERSIONOVERRIDE: ${{ secrets.MINVER_VERSION }}
diff --git a/global.json b/global.json
index 08585a2b3..01fa100de 100644
--- a/global.json
+++ b/global.json
@@ -1,5 +1,6 @@
{
"sdk": {
- "version": "7.0.100"
+ "version": "9.0.203",
+ "rollForward": "latestFeature"
}
}
\ No newline at end of file
diff --git a/samples/Clients/Directory.Build.targets b/samples/Clients/Directory.Build.targets
index 4eafc7731..6e29b7b13 100644
--- a/samples/Clients/Directory.Build.targets
+++ b/samples/Clients/Directory.Build.targets
@@ -1,17 +1,17 @@
-
- 3.1.0
-
+
+ 9.0.4
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/Clients/old/MvcHybrid/MvcHybrid.csproj b/samples/Clients/old/MvcHybrid/MvcHybrid.csproj
index 23b31358e..45287483f 100644
--- a/samples/Clients/old/MvcHybrid/MvcHybrid.csproj
+++ b/samples/Clients/old/MvcHybrid/MvcHybrid.csproj
@@ -1,12 +1,12 @@
- net7.0
+ net9.0
-
+
\ No newline at end of file
diff --git a/samples/Clients/old/MvcHybrid/Startup.cs b/samples/Clients/old/MvcHybrid/Startup.cs
index a4f4831ae..20cac5495 100644
--- a/samples/Clients/old/MvcHybrid/Startup.cs
+++ b/samples/Clients/old/MvcHybrid/Startup.cs
@@ -2,7 +2,7 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using System.IdentityModel.Tokens.Jwt;
-using IdentityModel;
+using Duende.IdentityModel;
using Clients;
using Microsoft.IdentityModel.Tokens;
using Microsoft.AspNetCore.Authentication.Cookies;
diff --git a/samples/Clients/old/MvcHybridAutomaticRefresh/MvcHybridAutomaticRefresh.csproj b/samples/Clients/old/MvcHybridAutomaticRefresh/MvcHybridAutomaticRefresh.csproj
index 50125eebe..34845e1c0 100644
--- a/samples/Clients/old/MvcHybridAutomaticRefresh/MvcHybridAutomaticRefresh.csproj
+++ b/samples/Clients/old/MvcHybridAutomaticRefresh/MvcHybridAutomaticRefresh.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
diff --git a/samples/Clients/old/MvcHybridAutomaticRefresh/Startup.cs b/samples/Clients/old/MvcHybridAutomaticRefresh/Startup.cs
index 5c5be40bd..4f2ba641f 100644
--- a/samples/Clients/old/MvcHybridAutomaticRefresh/Startup.cs
+++ b/samples/Clients/old/MvcHybridAutomaticRefresh/Startup.cs
@@ -2,7 +2,7 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using System.IdentityModel.Tokens.Jwt;
-using IdentityModel;
+using Duende.IdentityModel;
using Clients;
using Microsoft.IdentityModel.Tokens;
using Microsoft.AspNetCore.Authentication.Cookies;
@@ -50,7 +50,7 @@ public void ConfigureServices(IServiceCollection services)
options.Scope.Add("email");
options.Scope.Add("api1");
options.Scope.Add("offline_access");
-
+
options.ClaimActions.MapAllExcept("iss", "nbf", "exp", "aud", "nonce", "iat", "c_hash");
options.GetClaimsFromUserInfoEndpoint = true;
diff --git a/samples/Clients/old/MvcImplicit/MvcImplicit.csproj b/samples/Clients/old/MvcImplicit/MvcImplicit.csproj
index bc73b48e2..45287483f 100644
--- a/samples/Clients/old/MvcImplicit/MvcImplicit.csproj
+++ b/samples/Clients/old/MvcImplicit/MvcImplicit.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
diff --git a/samples/Clients/old/MvcImplicit/Startup.cs b/samples/Clients/old/MvcImplicit/Startup.cs
index 7dafb4ab7..4141943f3 100644
--- a/samples/Clients/old/MvcImplicit/Startup.cs
+++ b/samples/Clients/old/MvcImplicit/Startup.cs
@@ -1,5 +1,5 @@
using Clients;
-using IdentityModel;
+using Duende.IdentityModel;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
diff --git a/samples/Clients/old/MvcImplicitJwtRequest/MvcImplicitJwtRequest.csproj b/samples/Clients/old/MvcImplicitJwtRequest/MvcImplicitJwtRequest.csproj
index 0c003d6b3..f10f7bd79 100644
--- a/samples/Clients/old/MvcImplicitJwtRequest/MvcImplicitJwtRequest.csproj
+++ b/samples/Clients/old/MvcImplicitJwtRequest/MvcImplicitJwtRequest.csproj
@@ -1,12 +1,12 @@
- net7.0
+ net9.0
-
+
diff --git a/samples/Clients/old/MvcImplicitJwtRequest/Startup.cs b/samples/Clients/old/MvcImplicitJwtRequest/Startup.cs
index 910be18a6..a27c38ae9 100644
--- a/samples/Clients/old/MvcImplicitJwtRequest/Startup.cs
+++ b/samples/Clients/old/MvcImplicitJwtRequest/Startup.cs
@@ -1,5 +1,5 @@
using Clients;
-using IdentityModel;
+using Duende.IdentityModel;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.IdentityModel.Tokens;
diff --git a/samples/Clients/old/MvcManual/Controllers/HomeController.cs b/samples/Clients/old/MvcManual/Controllers/HomeController.cs
index 840396fc4..69413ddfd 100644
--- a/samples/Clients/old/MvcManual/Controllers/HomeController.cs
+++ b/samples/Clients/old/MvcManual/Controllers/HomeController.cs
@@ -6,7 +6,7 @@
using System.Linq;
using Microsoft.IdentityModel.Tokens;
using System.Collections.Generic;
-using IdentityModel;
+using Duende.IdentityModel;
using System.Security.Cryptography;
using System.IdentityModel.Tokens.Jwt;
using Clients;
@@ -32,7 +32,7 @@ public async Task Secure()
return await StartAuthentication();
}
- public async Task Logout()
+ public async Task Logout()
{
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
diff --git a/samples/Clients/old/MvcManual/MvcManual.csproj b/samples/Clients/old/MvcManual/MvcManual.csproj
index a67bc0d94..2548a286b 100644
--- a/samples/Clients/old/MvcManual/MvcManual.csproj
+++ b/samples/Clients/old/MvcManual/MvcManual.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
@@ -12,7 +12,7 @@
-
+
@@ -25,4 +25,4 @@
-
+
\ No newline at end of file
diff --git a/samples/Clients/src/APIs/ResourceBasedApi/Program.cs b/samples/Clients/src/APIs/ResourceBasedApi/Program.cs
index 0fb8c5590..5d538f90b 100644
--- a/samples/Clients/src/APIs/ResourceBasedApi/Program.cs
+++ b/samples/Clients/src/APIs/ResourceBasedApi/Program.cs
@@ -1,9 +1,9 @@
-using System;
-using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.Hosting;
using Serilog;
using Serilog.Events;
using Serilog.Sinks.SystemConsole.Themes;
+using System;
namespace ResourceBasedApi
{
@@ -13,10 +13,10 @@ public static void Main(string[] args)
{
Console.Title = "Sample API";
- BuildWebHost(args).Run();
+ CreateHostBuilder(args).Build().Run();
}
- public static IWebHost BuildWebHost(string[] args)
+ public static IHostBuilder CreateHostBuilder(string[] args)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Verbose()
@@ -27,10 +27,12 @@ public static IWebHost BuildWebHost(string[] args)
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}", theme: AnsiConsoleTheme.Code)
.CreateLogger();
- return WebHost.CreateDefaultBuilder(args)
- .UseStartup()
- .UseSerilog()
- .Build();
+ return Host.CreateDefaultBuilder(args)
+ .UseSerilog()
+ .ConfigureWebHostDefaults(webBuilder =>
+ {
+ webBuilder.UseStartup();
+ });
}
}
}
\ No newline at end of file
diff --git a/samples/Clients/src/APIs/ResourceBasedApi/ResourceBasedApi.csproj b/samples/Clients/src/APIs/ResourceBasedApi/ResourceBasedApi.csproj
index 7f6d3ed9a..e9d7b6075 100644
--- a/samples/Clients/src/APIs/ResourceBasedApi/ResourceBasedApi.csproj
+++ b/samples/Clients/src/APIs/ResourceBasedApi/ResourceBasedApi.csproj
@@ -1,21 +1,19 @@
- net7.0
+ net9.0
-
+
-
-
-
-
-
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/Clients/src/APIs/ResourceBasedApi/Startup.cs b/samples/Clients/src/APIs/ResourceBasedApi/Startup.cs
index af3087663..0b52bb49d 100644
--- a/samples/Clients/src/APIs/ResourceBasedApi/Startup.cs
+++ b/samples/Clients/src/APIs/ResourceBasedApi/Startup.cs
@@ -1,14 +1,6 @@
-using Clients;
+using Clients;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
-using System;
-using System.IdentityModel.Tokens.Jwt;
-using System.Security.Cryptography.X509Certificates;
-using System.Text;
-using System.Threading.Tasks;
-using IdentityModel.AspNetCore.AccessTokenValidation;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.HttpOverrides;
namespace ResourceBasedApi
{
@@ -32,7 +24,7 @@ public void ConfigureServices(IServiceCollection services)
options.TokenValidationParameters.ValidTypes = new[] { "at+jwt" };
// if token does not contain a dot, it is a reference token
- options.ForwardDefaultSelector = Selector.ForwardReferenceToken("introspection");
+ // options.ForwardDefaultSelector = Selector.ForwardReferenceToken("introspection");
})
// reference tokens
@@ -44,7 +36,7 @@ public void ConfigureServices(IServiceCollection services)
options.ClientSecret = "secret";
});
- services.AddScopeTransformation();
+ // services.AddScopeTransformation();
}
public void Configure(IApplicationBuilder app)
diff --git a/samples/Clients/src/APIs/SimpleApi/Program.cs b/samples/Clients/src/APIs/SimpleApi/Program.cs
index 44fe9c6a4..9b53bccef 100644
--- a/samples/Clients/src/APIs/SimpleApi/Program.cs
+++ b/samples/Clients/src/APIs/SimpleApi/Program.cs
@@ -1,9 +1,9 @@
-using System;
-using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.Hosting;
using Serilog;
using Serilog.Events;
using Serilog.Sinks.SystemConsole.Themes;
+using System;
namespace SampleApi
{
@@ -13,10 +13,10 @@ public static void Main(string[] args)
{
Console.Title = "Sample API";
- BuildWebHost(args).Run();
+ CreateHostBuilder(args).Build().Run();
}
- public static IWebHost BuildWebHost(string[] args)
+ public static IHostBuilder CreateHostBuilder(string[] args)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Verbose()
@@ -27,10 +27,12 @@ public static IWebHost BuildWebHost(string[] args)
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}", theme: AnsiConsoleTheme.Code)
.CreateLogger();
- return WebHost.CreateDefaultBuilder(args)
- .UseStartup()
- .UseSerilog()
- .Build();
+ return Host.CreateDefaultBuilder(args)
+ .UseSerilog()
+ .ConfigureWebHostDefaults(webBuilder =>
+ {
+ webBuilder.UseStartup();
+ });
}
}
}
\ No newline at end of file
diff --git a/samples/Clients/src/APIs/SimpleApi/SimpleApi.csproj b/samples/Clients/src/APIs/SimpleApi/SimpleApi.csproj
index 0f4483298..833064cdb 100644
--- a/samples/Clients/src/APIs/SimpleApi/SimpleApi.csproj
+++ b/samples/Clients/src/APIs/SimpleApi/SimpleApi.csproj
@@ -1,18 +1,17 @@
- net7.0
+ net9.0
-
+
-
-
-
-
+
+
+
\ No newline at end of file
diff --git a/samples/Clients/src/ConsoleClientCredentialsFlow/ConsoleClientCredentialsFlow.csproj b/samples/Clients/src/ConsoleClientCredentialsFlow/ConsoleClientCredentialsFlow.csproj
index 0dcf82805..7d8abb9c5 100644
--- a/samples/Clients/src/ConsoleClientCredentialsFlow/ConsoleClientCredentialsFlow.csproj
+++ b/samples/Clients/src/ConsoleClientCredentialsFlow/ConsoleClientCredentialsFlow.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
Exe
diff --git a/samples/Clients/src/ConsoleClientCredentialsFlow/Program.cs b/samples/Clients/src/ConsoleClientCredentialsFlow/Program.cs
index 12fa702b5..8d026cdc4 100644
--- a/samples/Clients/src/ConsoleClientCredentialsFlow/Program.cs
+++ b/samples/Clients/src/ConsoleClientCredentialsFlow/Program.cs
@@ -1,6 +1,5 @@
-using Clients;
-using IdentityModel.Client;
-using Newtonsoft.Json.Linq;
+using Clients;
+using Duende.IdentityModel.Client;
using System;
using System.Net.Http;
using System.Threading.Tasks;
@@ -52,7 +51,7 @@ static async Task CallServiceAsync(string token)
var response = await client.GetStringAsync("identity");
"\n\nService claims:".ConsoleGreen();
- Console.WriteLine(JArray.Parse(response));
+ Console.WriteLine(response);
}
}
}
\ No newline at end of file
diff --git a/samples/Clients/src/ConsoleClientCredentialsFlowCallingIdentityServerApi/ConsoleClientCredentialsFlowCallingIdentityServerApi.csproj b/samples/Clients/src/ConsoleClientCredentialsFlowCallingIdentityServerApi/ConsoleClientCredentialsFlowCallingIdentityServerApi.csproj
index 0dcf82805..7d8abb9c5 100644
--- a/samples/Clients/src/ConsoleClientCredentialsFlowCallingIdentityServerApi/ConsoleClientCredentialsFlowCallingIdentityServerApi.csproj
+++ b/samples/Clients/src/ConsoleClientCredentialsFlowCallingIdentityServerApi/ConsoleClientCredentialsFlowCallingIdentityServerApi.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
Exe
diff --git a/samples/Clients/src/ConsoleClientCredentialsFlowCallingIdentityServerApi/Program.cs b/samples/Clients/src/ConsoleClientCredentialsFlowCallingIdentityServerApi/Program.cs
index 0af2abdaa..bca79409c 100644
--- a/samples/Clients/src/ConsoleClientCredentialsFlowCallingIdentityServerApi/Program.cs
+++ b/samples/Clients/src/ConsoleClientCredentialsFlowCallingIdentityServerApi/Program.cs
@@ -1,6 +1,5 @@
-using Clients;
-using IdentityModel.Client;
-using Newtonsoft.Json.Linq;
+using Clients;
+using Duende.IdentityModel.Client;
using System;
using System.Net.Http;
using System.Threading.Tasks;
@@ -53,7 +52,7 @@ static async Task CallServiceAsync(string token)
var response = await client.GetStringAsync("localApi");
"\n\nService claims:".ConsoleGreen();
- Console.WriteLine(JArray.Parse(response));
+ Console.WriteLine(response);
}
}
}
\ No newline at end of file
diff --git a/samples/Clients/src/ConsoleClientCredentialsFlowPostBody/ConsoleClientCredentialsFlowPostBody.csproj b/samples/Clients/src/ConsoleClientCredentialsFlowPostBody/ConsoleClientCredentialsFlowPostBody.csproj
index 7dd6357a7..95ee8b0f5 100644
--- a/samples/Clients/src/ConsoleClientCredentialsFlowPostBody/ConsoleClientCredentialsFlowPostBody.csproj
+++ b/samples/Clients/src/ConsoleClientCredentialsFlowPostBody/ConsoleClientCredentialsFlowPostBody.csproj
@@ -1,6 +1,6 @@
- net7.0
+ net9.0
Exe
diff --git a/samples/Clients/src/ConsoleClientCredentialsFlowPostBody/Program.cs b/samples/Clients/src/ConsoleClientCredentialsFlowPostBody/Program.cs
index 1a29181f4..bc286f746 100644
--- a/samples/Clients/src/ConsoleClientCredentialsFlowPostBody/Program.cs
+++ b/samples/Clients/src/ConsoleClientCredentialsFlowPostBody/Program.cs
@@ -1,6 +1,5 @@
-using Clients;
-using IdentityModel.Client;
-using Newtonsoft.Json.Linq;
+using Clients;
+using Duende.IdentityModel.Client;
using System;
using System.Net.Http;
using System.Threading.Tasks;
@@ -54,7 +53,7 @@ static async Task CallServiceAsync(string token)
var response = await client.GetStringAsync("identity");
"\n\nService claims:".ConsoleGreen();
- Console.WriteLine(JArray.Parse(response));
+ Console.WriteLine(response);
}
}
}
\ No newline at end of file
diff --git a/samples/Clients/src/ConsoleCode/ConsoleCode.csproj b/samples/Clients/src/ConsoleCode/ConsoleCode.csproj
index 8ceceba22..b6adcab05 100644
--- a/samples/Clients/src/ConsoleCode/ConsoleCode.csproj
+++ b/samples/Clients/src/ConsoleCode/ConsoleCode.csproj
@@ -1,19 +1,19 @@
- net7.0
+ net9.0
Exe
ConsoleHybridWithPkce
-
-
+
+
-
+
-
+
\ No newline at end of file
diff --git a/samples/Clients/src/ConsoleCustomGrant/ConsoleExtensionGrant.csproj b/samples/Clients/src/ConsoleCustomGrant/ConsoleExtensionGrant.csproj
index 0dcf82805..7d8abb9c5 100644
--- a/samples/Clients/src/ConsoleCustomGrant/ConsoleExtensionGrant.csproj
+++ b/samples/Clients/src/ConsoleCustomGrant/ConsoleExtensionGrant.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
Exe
diff --git a/samples/Clients/src/ConsoleCustomGrant/Program.cs b/samples/Clients/src/ConsoleCustomGrant/Program.cs
index f8384715a..d50480b45 100644
--- a/samples/Clients/src/ConsoleCustomGrant/Program.cs
+++ b/samples/Clients/src/ConsoleCustomGrant/Program.cs
@@ -1,6 +1,5 @@
-using Clients;
-using IdentityModel.Client;
-using Newtonsoft.Json.Linq;
+using Clients;
+using Duende.IdentityModel.Client;
using System;
using System.Net.Http;
using System.Threading.Tasks;
@@ -71,7 +70,7 @@ static async Task CallServiceAsync(string token)
var response = await client.GetStringAsync("identity");
"\n\nService claims:".ConsoleGreen();
- Console.WriteLine(JArray.Parse(response));
+ Console.WriteLine(response);
}
}
}
\ No newline at end of file
diff --git a/samples/Clients/src/ConsoleDeviceFlow/ConsoleDeviceFlow.csproj b/samples/Clients/src/ConsoleDeviceFlow/ConsoleDeviceFlow.csproj
index 0dcf82805..7d8abb9c5 100644
--- a/samples/Clients/src/ConsoleDeviceFlow/ConsoleDeviceFlow.csproj
+++ b/samples/Clients/src/ConsoleDeviceFlow/ConsoleDeviceFlow.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
Exe
diff --git a/samples/Clients/src/ConsoleDeviceFlow/Program.cs b/samples/Clients/src/ConsoleDeviceFlow/Program.cs
index 3e88488e7..5d5e047b0 100644
--- a/samples/Clients/src/ConsoleDeviceFlow/Program.cs
+++ b/samples/Clients/src/ConsoleDeviceFlow/Program.cs
@@ -1,7 +1,6 @@
-using Clients;
-using IdentityModel;
-using IdentityModel.Client;
-using Newtonsoft.Json.Linq;
+using Clients;
+using Duende.IdentityModel;
+using Duende.IdentityModel.Client;
using System;
using System.Diagnostics;
using System.Net.Http;
@@ -101,7 +100,7 @@ static async Task CallServiceAsync(string token)
var response = await client.GetStringAsync("identity");
"\n\nService claims:".ConsoleGreen();
- Console.WriteLine(JArray.Parse(response));
+ Console.WriteLine(response);
}
}
}
\ No newline at end of file
diff --git a/samples/Clients/src/ConsoleEphemeralMtlsClient/ConsoleEphemeralMtlsClient.csproj b/samples/Clients/src/ConsoleEphemeralMtlsClient/ConsoleEphemeralMtlsClient.csproj
index 2894af2de..882aab071 100644
--- a/samples/Clients/src/ConsoleEphemeralMtlsClient/ConsoleEphemeralMtlsClient.csproj
+++ b/samples/Clients/src/ConsoleEphemeralMtlsClient/ConsoleEphemeralMtlsClient.csproj
@@ -1,12 +1,12 @@
-
- Exe
- net7.0
-
+
+ Exe
+ net9.0
+
-
-
-
+
+
+
-
+
\ No newline at end of file
diff --git a/samples/Clients/src/ConsoleEphemeralMtlsClient/Program.cs b/samples/Clients/src/ConsoleEphemeralMtlsClient/Program.cs
index a187bedfc..b7faafdb8 100644
--- a/samples/Clients/src/ConsoleEphemeralMtlsClient/Program.cs
+++ b/samples/Clients/src/ConsoleEphemeralMtlsClient/Program.cs
@@ -1,31 +1,29 @@
-using System;
-using System.Net;
+using Clients;
+using Duende.IdentityModel;
+using Duende.IdentityModel.Client;
+using System;
using System.Net.Http;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
-using Clients;
-using IdentityModel;
-using IdentityModel.Client;
-using Newtonsoft.Json.Linq;
namespace ConsoleEphemeralMtlsClient
{
class Program
{
private static X509Certificate2 ClientCertificate;
-
+
static async Task Main(string[] args)
{
ClientCertificate = CreateClientCertificate("client");
-
+
var response = await RequestTokenAsync();
response.Show();
Console.ReadLine();
await CallServiceAsync(response.AccessToken);
}
-
+
static async Task RequestTokenAsync()
{
var client = new HttpClient(GetHandler(ClientCertificate));
@@ -35,9 +33,8 @@ static async Task RequestTokenAsync()
var endpoint = disco
.TryGetValue(OidcConstants.Discovery.MtlsEndpointAliases)
- .Value(OidcConstants.Discovery.TokenEndpoint)
- .ToString();
-
+ .Value.TryGetString(OidcConstants.Discovery.TokenEndpoint);
+
var response = await client.RequestClientCredentialsTokenAsync(new ClientCredentialsTokenRequest
{
Address = endpoint,
@@ -62,19 +59,19 @@ static async Task CallServiceAsync(string token)
var response = await client.GetStringAsync("identity");
"\n\nService claims:".ConsoleGreen();
- Console.WriteLine(JArray.Parse(response));
+ Console.WriteLine(response);
}
-
+
static X509Certificate2 CreateClientCertificate(string name)
{
X500DistinguishedName distinguishedName = new X500DistinguishedName($"CN={name}");
using (var rsa = RSA.Create(2048))
{
- var request = new CertificateRequest(distinguishedName, rsa, HashAlgorithmName.SHA256,RSASignaturePadding.Pkcs1);
+ var request = new CertificateRequest(distinguishedName, rsa, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1);
request.CertificateExtensions.Add(
- new X509KeyUsageExtension(X509KeyUsageFlags.DataEncipherment | X509KeyUsageFlags.KeyEncipherment | X509KeyUsageFlags.DigitalSignature , false));
+ new X509KeyUsageExtension(X509KeyUsageFlags.DataEncipherment | X509KeyUsageFlags.KeyEncipherment | X509KeyUsageFlags.DigitalSignature, false));
request.CertificateExtensions.Add(
new X509EnhancedKeyUsageExtension(
@@ -83,7 +80,7 @@ static X509Certificate2 CreateClientCertificate(string name)
return request.CreateSelfSigned(new DateTimeOffset(DateTime.UtcNow.AddDays(-1)), new DateTimeOffset(DateTime.UtcNow.AddDays(3650)));
}
}
-
+
static SocketsHttpHandler GetHandler(X509Certificate2 certificate)
{
var handler = new SocketsHttpHandler
diff --git a/samples/Clients/src/ConsoleIntrospectionClient/ConsoleIntrospectionClient.csproj b/samples/Clients/src/ConsoleIntrospectionClient/ConsoleIntrospectionClient.csproj
index 0dcf82805..7d8abb9c5 100644
--- a/samples/Clients/src/ConsoleIntrospectionClient/ConsoleIntrospectionClient.csproj
+++ b/samples/Clients/src/ConsoleIntrospectionClient/ConsoleIntrospectionClient.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
Exe
diff --git a/samples/Clients/src/ConsoleIntrospectionClient/Program.cs b/samples/Clients/src/ConsoleIntrospectionClient/Program.cs
index 1702ae710..f8f31a6c5 100644
--- a/samples/Clients/src/ConsoleIntrospectionClient/Program.cs
+++ b/samples/Clients/src/ConsoleIntrospectionClient/Program.cs
@@ -1,5 +1,5 @@
-using Clients;
-using IdentityModel.Client;
+using Clients;
+using Duende.IdentityModel.Client;
using System;
using System.Linq;
using System.Net.Http;
diff --git a/samples/Clients/src/ConsoleMTLSClient/ConsoleMTLSClient.csproj b/samples/Clients/src/ConsoleMTLSClient/ConsoleMTLSClient.csproj
index fc963494d..1bc5c37e7 100644
--- a/samples/Clients/src/ConsoleMTLSClient/ConsoleMTLSClient.csproj
+++ b/samples/Clients/src/ConsoleMTLSClient/ConsoleMTLSClient.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
Exe
diff --git a/samples/Clients/src/ConsoleMTLSClient/Program.cs b/samples/Clients/src/ConsoleMTLSClient/Program.cs
index a68901353..2edf04084 100644
--- a/samples/Clients/src/ConsoleMTLSClient/Program.cs
+++ b/samples/Clients/src/ConsoleMTLSClient/Program.cs
@@ -1,9 +1,7 @@
-using Clients;
-using IdentityModel;
-using IdentityModel.Client;
-using Newtonsoft.Json.Linq;
+using Clients;
+using Duende.IdentityModel;
+using Duende.IdentityModel.Client;
using System;
-using System.Linq;
using System.Net.Http;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
@@ -32,9 +30,8 @@ static async Task RequestTokenAsync()
var endpoint = disco
.TryGetValue(OidcConstants.Discovery.MtlsEndpointAliases)
- .Value(OidcConstants.Discovery.TokenEndpoint)
- .ToString();
-
+ .Value.TryGetString(OidcConstants.Discovery.TokenEndpoint);
+
var response = await client.RequestClientCredentialsTokenAsync(new ClientCredentialsTokenRequest
{
Address = endpoint,
@@ -58,13 +55,13 @@ static async Task CallServiceAsync(string token)
var response = await client.GetStringAsync("identity");
"\n\nService claims:".ConsoleGreen();
- Console.WriteLine(JArray.Parse(response));
+ Console.WriteLine(response);
}
static SocketsHttpHandler GetHandler()
{
var handler = new SocketsHttpHandler();
-
+
var cert = new X509Certificate2("client.p12", "changeit");
handler.SslOptions.ClientCertificates = new X509CertificateCollection { cert };
diff --git a/samples/Clients/src/ConsoleParameterizedScopeClient/ConsoleParameterizedScopeClient.csproj b/samples/Clients/src/ConsoleParameterizedScopeClient/ConsoleParameterizedScopeClient.csproj
index 9d631e2d8..89579d1a8 100644
--- a/samples/Clients/src/ConsoleParameterizedScopeClient/ConsoleParameterizedScopeClient.csproj
+++ b/samples/Clients/src/ConsoleParameterizedScopeClient/ConsoleParameterizedScopeClient.csproj
@@ -2,7 +2,7 @@
Exe
- net7.0
+ net9.0
ConsoleStructuredScopeClient
@@ -10,4 +10,4 @@
-
+
\ No newline at end of file
diff --git a/samples/Clients/src/ConsoleParameterizedScopeClient/Program.cs b/samples/Clients/src/ConsoleParameterizedScopeClient/Program.cs
index 90b4035bd..20efe1687 100644
--- a/samples/Clients/src/ConsoleParameterizedScopeClient/Program.cs
+++ b/samples/Clients/src/ConsoleParameterizedScopeClient/Program.cs
@@ -1,9 +1,8 @@
-using System;
+using Clients;
+using Duende.IdentityModel.Client;
+using System;
using System.Net.Http;
using System.Threading.Tasks;
-using Clients;
-using IdentityModel.Client;
-using Newtonsoft.Json.Linq;
namespace ConsoleParameterizedScopeClient
{
@@ -49,7 +48,7 @@ static async Task CallServiceAsync(string token)
var response = await client.GetStringAsync("identity");
"\n\nService claims:".ConsoleGreen();
- Console.WriteLine(JArray.Parse(response));
+ Console.WriteLine(response);
}
}
}
\ No newline at end of file
diff --git a/samples/Clients/src/ConsolePrivateKeyJwtClient/ConsolePrivateKeyJwtClient.csproj b/samples/Clients/src/ConsolePrivateKeyJwtClient/ConsolePrivateKeyJwtClient.csproj
index afdcce7f2..ab3ecb6e2 100644
--- a/samples/Clients/src/ConsolePrivateKeyJwtClient/ConsolePrivateKeyJwtClient.csproj
+++ b/samples/Clients/src/ConsolePrivateKeyJwtClient/ConsolePrivateKeyJwtClient.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
Exe
@@ -16,10 +16,10 @@
-
+
latest
-
+
\ No newline at end of file
diff --git a/samples/Clients/src/ConsolePrivateKeyJwtClient/Program.cs b/samples/Clients/src/ConsolePrivateKeyJwtClient/Program.cs
index 4e1a59c21..165e898e6 100644
--- a/samples/Clients/src/ConsolePrivateKeyJwtClient/Program.cs
+++ b/samples/Clients/src/ConsolePrivateKeyJwtClient/Program.cs
@@ -1,14 +1,14 @@
-using Clients;
-using IdentityModel;
-using IdentityModel.Client;
+using Clients;
+using Duende.IdentityModel;
+using Duende.IdentityModel.Client;
using Microsoft.IdentityModel.Tokens;
+using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.Net.Http;
using System.Security.Claims;
using System.Security.Cryptography.X509Certificates;
-using Newtonsoft.Json.Linq;
using System.Threading.Tasks;
namespace ConsolePrivateKeyJwtClient
@@ -16,7 +16,7 @@ namespace ConsolePrivateKeyJwtClient
public class Program
{
private static string rsaKey = "{'d':'GmiaucNIzdvsEzGjZjd43SDToy1pz-Ph-shsOUXXh-dsYNGftITGerp8bO1iryXh_zUEo8oDK3r1y4klTonQ6bLsWw4ogjLPmL3yiqsoSjJa1G2Ymh_RY_sFZLLXAcrmpbzdWIAkgkHSZTaliL6g57vA7gxvd8L4s82wgGer_JmURI0ECbaCg98JVS0Srtf9GeTRHoX4foLWKc1Vq6NHthzqRMLZe-aRBNU9IMvXNd7kCcIbHCM3GTD_8cFj135nBPP2HOgC_ZXI1txsEf-djqJj8W5vaM7ViKU28IDv1gZGH3CatoysYx6jv1XJVvb2PH8RbFKbJmeyUm3Wvo-rgQ','dp':'YNjVBTCIwZD65WCht5ve06vnBLP_Po1NtL_4lkholmPzJ5jbLYBU8f5foNp8DVJBdFQW7wcLmx85-NC5Pl1ZeyA-Ecbw4fDraa5Z4wUKlF0LT6VV79rfOF19y8kwf6MigyrDqMLcH_CRnRGg5NfDsijlZXffINGuxg6wWzhiqqE','dq':'LfMDQbvTFNngkZjKkN2CBh5_MBG6Yrmfy4kWA8IC2HQqID5FtreiY2MTAwoDcoINfh3S5CItpuq94tlB2t-VUv8wunhbngHiB5xUprwGAAnwJ3DL39D2m43i_3YP-UO1TgZQUAOh7Jrd4foatpatTvBtY3F1DrCrUKE5Kkn770M','e':'AQAB','kid':'ZzAjSnraU3bkWGnnAqLapYGpTyNfLbjbzgAPbbW2GEA','kty':'RSA','n':'wWwQFtSzeRjjerpEM5Rmqz_DsNaZ9S1Bw6UbZkDLowuuTCjBWUax0vBMMxdy6XjEEK4Oq9lKMvx9JzjmeJf1knoqSNrox3Ka0rnxXpNAz6sATvme8p9mTXyp0cX4lF4U2J54xa2_S9NF5QWvpXvBeC4GAJx7QaSw4zrUkrc6XyaAiFnLhQEwKJCwUw4NOqIuYvYp_IXhw-5Ti_icDlZS-282PcccnBeOcX7vc21pozibIdmZJKqXNsL1Ibx5Nkx1F1jLnekJAmdaACDjYRLL_6n3W4wUp19UvzB1lGtXcJKLLkqB6YDiZNu16OSiSprfmrRXvYmvD8m6Fnl5aetgKw','p':'7enorp9Pm9XSHaCvQyENcvdU99WCPbnp8vc0KnY_0g9UdX4ZDH07JwKu6DQEwfmUA1qspC-e_KFWTl3x0-I2eJRnHjLOoLrTjrVSBRhBMGEH5PvtZTTThnIY2LReH-6EhceGvcsJ_MhNDUEZLykiH1OnKhmRuvSdhi8oiETqtPE','q':'0CBLGi_kRPLqI8yfVkpBbA9zkCAshgrWWn9hsq6a7Zl2LcLaLBRUxH0q1jWnXgeJh9o5v8sYGXwhbrmuypw7kJ0uA3OgEzSsNvX5Ay3R9sNel-3Mqm8Me5OfWWvmTEBOci8RwHstdR-7b9ZT13jk-dsZI7OlV_uBja1ny9Nz9ts','qi':'pG6J4dcUDrDndMxa-ee1yG4KjZqqyCQcmPAfqklI2LmnpRIjcK78scclvpboI3JQyg6RCEKVMwAhVtQM6cBcIO3JrHgqeYDblp5wXHjto70HVW6Z8kBruNx1AH9E8LzNvSRL-JVTFzBkJuNgzKQfD0G77tQRgJ-Ri7qu3_9o1M4'}";
-
+
public static async Task Main()
{
Console.Title = "Console Client Credentials Flow with JWT Assertion";
@@ -35,7 +35,7 @@ public static async Task Main()
var jwk = new JsonWebKey(rsaKey);
response = await RequestTokenAsync(new SigningCredentials(jwk, "RS256"));
response.Show();
-
+
Console.ReadLine();
await CallServiceAsync(response.AccessToken);
}
@@ -47,7 +47,7 @@ static async Task RequestTokenAsync(SigningCredentials credential
var disco = await client.GetDiscoveryDocumentAsync(Constants.Authority);
if (disco.IsError) throw new Exception(disco.Error);
- var clientToken = CreateClientToken(credential,"client.jwt", disco.TokenEndpoint);
+ var clientToken = CreateClientToken(credential, "client.jwt", disco.TokenEndpoint);
var response = await client.RequestClientCredentialsTokenAsync(new ClientCredentialsTokenRequest
{
@@ -83,7 +83,7 @@ static async Task CallServiceAsync(string token)
private static string CreateClientToken(SigningCredentials credential, string clientId, string audience)
{
-
+
var now = DateTime.UtcNow;
var token = new JwtSecurityToken(
diff --git a/samples/Clients/src/ConsoleResourceOwnerFlow/ConsoleResourceOwnerFlow.csproj b/samples/Clients/src/ConsoleResourceOwnerFlow/ConsoleResourceOwnerFlow.csproj
index 0dcf82805..7d8abb9c5 100644
--- a/samples/Clients/src/ConsoleResourceOwnerFlow/ConsoleResourceOwnerFlow.csproj
+++ b/samples/Clients/src/ConsoleResourceOwnerFlow/ConsoleResourceOwnerFlow.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
Exe
diff --git a/samples/Clients/src/ConsoleResourceOwnerFlow/Program.cs b/samples/Clients/src/ConsoleResourceOwnerFlow/Program.cs
index c1ea8f316..ca4b23a16 100644
--- a/samples/Clients/src/ConsoleResourceOwnerFlow/Program.cs
+++ b/samples/Clients/src/ConsoleResourceOwnerFlow/Program.cs
@@ -1,6 +1,5 @@
-using Clients;
-using IdentityModel.Client;
-using Newtonsoft.Json.Linq;
+using Clients;
+using Duende.IdentityModel.Client;
using System;
using System.Net.Http;
using System.Threading.Tasks;
@@ -62,7 +61,7 @@ static async Task CallServiceAsync(string token)
var response = await client.GetStringAsync("identity");
"\n\nService claims:".ConsoleGreen();
- Console.WriteLine(JArray.Parse(response));
+ Console.WriteLine(response);
}
}
}
\ No newline at end of file
diff --git a/samples/Clients/src/ConsoleResourceOwnerFlowPublic/ConsoleResourceOwnerFlowPublic.csproj b/samples/Clients/src/ConsoleResourceOwnerFlowPublic/ConsoleResourceOwnerFlowPublic.csproj
index 0dcf82805..7d8abb9c5 100644
--- a/samples/Clients/src/ConsoleResourceOwnerFlowPublic/ConsoleResourceOwnerFlowPublic.csproj
+++ b/samples/Clients/src/ConsoleResourceOwnerFlowPublic/ConsoleResourceOwnerFlowPublic.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
Exe
diff --git a/samples/Clients/src/ConsoleResourceOwnerFlowPublic/Program.cs b/samples/Clients/src/ConsoleResourceOwnerFlowPublic/Program.cs
index 5acf5a795..fe8b736d9 100644
--- a/samples/Clients/src/ConsoleResourceOwnerFlowPublic/Program.cs
+++ b/samples/Clients/src/ConsoleResourceOwnerFlowPublic/Program.cs
@@ -1,6 +1,5 @@
-using Clients;
-using IdentityModel.Client;
-using Newtonsoft.Json.Linq;
+using Clients;
+using Duende.IdentityModel.Client;
using System;
using System.Net.Http;
using System.Threading.Tasks;
@@ -32,7 +31,7 @@ static async Task RequestTokenAsync()
Address = disco.TokenEndpoint,
ClientId = "roclient.public",
-
+
UserName = "bob",
Password = "bob",
@@ -61,7 +60,7 @@ static async Task CallServiceAsync(string token)
var response = await client.GetStringAsync("identity");
"\n\nService claims:".ConsoleGreen();
- Console.WriteLine(JArray.Parse(response));
+ Console.WriteLine(response);
}
}
}
\ No newline at end of file
diff --git a/samples/Clients/src/ConsoleResourceOwnerFlowReference/ConsoleResourceOwnerFlowReference.csproj b/samples/Clients/src/ConsoleResourceOwnerFlowReference/ConsoleResourceOwnerFlowReference.csproj
index 0dcf82805..7d8abb9c5 100644
--- a/samples/Clients/src/ConsoleResourceOwnerFlowReference/ConsoleResourceOwnerFlowReference.csproj
+++ b/samples/Clients/src/ConsoleResourceOwnerFlowReference/ConsoleResourceOwnerFlowReference.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
Exe
diff --git a/samples/Clients/src/ConsoleResourceOwnerFlowReference/Program.cs b/samples/Clients/src/ConsoleResourceOwnerFlowReference/Program.cs
index 7d481db01..a48653b8e 100644
--- a/samples/Clients/src/ConsoleResourceOwnerFlowReference/Program.cs
+++ b/samples/Clients/src/ConsoleResourceOwnerFlowReference/Program.cs
@@ -1,6 +1,5 @@
-using Clients;
-using IdentityModel.Client;
-using Newtonsoft.Json.Linq;
+using Clients;
+using Duende.IdentityModel.Client;
using System;
using System.Net.Http;
using System.Threading.Tasks;
@@ -60,7 +59,7 @@ static async Task CallServiceAsync(string token)
var response = await client.GetStringAsync("identity");
"\n\nService claims:".ConsoleGreen();
- Console.WriteLine(JArray.Parse(response));
+ Console.WriteLine(response);
Console.ReadLine();
}
diff --git a/samples/Clients/src/ConsoleResourceOwnerFlowRefreshToken/ConsoleResourceOwnerFlowRefreshToken.csproj b/samples/Clients/src/ConsoleResourceOwnerFlowRefreshToken/ConsoleResourceOwnerFlowRefreshToken.csproj
index 0dcf82805..7d8abb9c5 100644
--- a/samples/Clients/src/ConsoleResourceOwnerFlowRefreshToken/ConsoleResourceOwnerFlowRefreshToken.csproj
+++ b/samples/Clients/src/ConsoleResourceOwnerFlowRefreshToken/ConsoleResourceOwnerFlowRefreshToken.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
Exe
diff --git a/samples/Clients/src/ConsoleResourceOwnerFlowRefreshToken/Program.cs b/samples/Clients/src/ConsoleResourceOwnerFlowRefreshToken/Program.cs
index 0f1cfae71..80547bbf2 100644
--- a/samples/Clients/src/ConsoleResourceOwnerFlowRefreshToken/Program.cs
+++ b/samples/Clients/src/ConsoleResourceOwnerFlowRefreshToken/Program.cs
@@ -1,7 +1,6 @@
-using Clients;
-using IdentityModel;
-using IdentityModel.Client;
-using Newtonsoft.Json.Linq;
+using Clients;
+using Duende.IdentityModel;
+using Duende.IdentityModel.Client;
using System;
using System.Net.Http;
using System.Text;
@@ -92,7 +91,7 @@ static async Task CallServiceAsync(string token)
var response = await client.GetStringAsync("identity");
"\n\nService claims:".ConsoleGreen();
- Console.WriteLine(JArray.Parse(response));
+ Console.WriteLine(response);
}
private static void ShowResponse(TokenResponse response)
@@ -110,8 +109,8 @@ private static void ShowResponse(TokenResponse response)
var header = parts[0];
var claims = parts[1];
- Console.WriteLine(JObject.Parse(Encoding.UTF8.GetString(Base64Url.Decode(header))));
- Console.WriteLine(JObject.Parse(Encoding.UTF8.GetString(Base64Url.Decode(claims))));
+ Console.WriteLine(Encoding.UTF8.GetString(Base64Url.Decode(header)));
+ Console.WriteLine(Encoding.UTF8.GetString(Base64Url.Decode(claims)));
}
}
else
diff --git a/samples/Clients/src/ConsoleResourceOwnerFlowUserInfo/ConsoleResourceOwnerFlowUserInfo.csproj b/samples/Clients/src/ConsoleResourceOwnerFlowUserInfo/ConsoleResourceOwnerFlowUserInfo.csproj
index 0dcf82805..7d8abb9c5 100644
--- a/samples/Clients/src/ConsoleResourceOwnerFlowUserInfo/ConsoleResourceOwnerFlowUserInfo.csproj
+++ b/samples/Clients/src/ConsoleResourceOwnerFlowUserInfo/ConsoleResourceOwnerFlowUserInfo.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
Exe
diff --git a/samples/Clients/src/ConsoleResourceOwnerFlowUserInfo/Program.cs b/samples/Clients/src/ConsoleResourceOwnerFlowUserInfo/Program.cs
index bec49284e..702245e7f 100644
--- a/samples/Clients/src/ConsoleResourceOwnerFlowUserInfo/Program.cs
+++ b/samples/Clients/src/ConsoleResourceOwnerFlowUserInfo/Program.cs
@@ -1,5 +1,5 @@
-using Clients;
-using IdentityModel.Client;
+using Clients;
+using Duende.IdentityModel.Client;
using System;
using System.Net.Http;
using System.Threading.Tasks;
diff --git a/samples/Clients/src/Constants/Constants.csproj b/samples/Clients/src/Constants/Constants.csproj
index 3eaf4f1c5..6a296673e 100644
--- a/samples/Clients/src/Constants/Constants.csproj
+++ b/samples/Clients/src/Constants/Constants.csproj
@@ -1,10 +1,10 @@
- net7.0
+ net9.0
-
+
\ No newline at end of file
diff --git a/samples/Clients/src/Constants/TokenResponseExtensions.cs b/samples/Clients/src/Constants/TokenResponseExtensions.cs
index 48afb9e2c..4552ba5fc 100644
--- a/samples/Clients/src/Constants/TokenResponseExtensions.cs
+++ b/samples/Clients/src/Constants/TokenResponseExtensions.cs
@@ -1,8 +1,5 @@
-using IdentityModel;
-using IdentityModel.Client;
-using Newtonsoft.Json.Linq;
+using Duende.IdentityModel.Client;
using System;
-using System.Text;
namespace Clients
{
@@ -22,9 +19,6 @@ public static void Show(this TokenResponse response)
var parts = response.AccessToken.Split('.');
var header = parts[0];
var claims = parts[1];
-
- Console.WriteLine(JObject.Parse(Encoding.UTF8.GetString(Base64Url.Decode(header))));
- Console.WriteLine(JObject.Parse(Encoding.UTF8.GetString(Base64Url.Decode(claims))));
}
}
else
diff --git a/samples/Clients/src/JsOidc/JsOidc.csproj b/samples/Clients/src/JsOidc/JsOidc.csproj
index 37aaf6b3e..5bf8a1b09 100644
--- a/samples/Clients/src/JsOidc/JsOidc.csproj
+++ b/samples/Clients/src/JsOidc/JsOidc.csproj
@@ -1,6 +1,6 @@
- net7.0
+ net9.0
\ No newline at end of file
diff --git a/samples/Clients/src/MvcAutomaticTokenManagement/MvcAutomaticTokenManagement.csproj b/samples/Clients/src/MvcAutomaticTokenManagement/MvcAutomaticTokenManagement.csproj
index 69b4e8e6a..b4dfbe98d 100644
--- a/samples/Clients/src/MvcAutomaticTokenManagement/MvcAutomaticTokenManagement.csproj
+++ b/samples/Clients/src/MvcAutomaticTokenManagement/MvcAutomaticTokenManagement.csproj
@@ -1,16 +1,16 @@
- net7.0
+ net9.0
-
+
-
-
+
+
diff --git a/samples/Clients/src/MvcAutomaticTokenManagement/Program.cs b/samples/Clients/src/MvcAutomaticTokenManagement/Program.cs
index 68faec35f..3a38f6fb8 100644
--- a/samples/Clients/src/MvcAutomaticTokenManagement/Program.cs
+++ b/samples/Clients/src/MvcAutomaticTokenManagement/Program.cs
@@ -12,7 +12,7 @@ public static int Main(string[] args)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Warning()
- .MinimumLevel.Override("IdentityModel", LogEventLevel.Debug)
+ .MinimumLevel.Override("Duende.IdentityModel", LogEventLevel.Debug)
.MinimumLevel.Override("System.Net.Http", LogEventLevel.Information)
.MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.Information)
.Enrich.FromLogContext()
@@ -38,10 +38,10 @@ public static int Main(string[] args)
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
+ .UseSerilog()
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup();
- webBuilder.UseSerilog();
});
}
}
diff --git a/samples/Clients/src/MvcCode/Controllers/HomeController.cs b/samples/Clients/src/MvcCode/Controllers/HomeController.cs
index 1afc89165..f9c9f4ffe 100644
--- a/samples/Clients/src/MvcCode/Controllers/HomeController.cs
+++ b/samples/Clients/src/MvcCode/Controllers/HomeController.cs
@@ -1,13 +1,12 @@
-using System;
-using System.Globalization;
-using System.Net.Http;
-using System.Threading.Tasks;
using Clients;
-using IdentityModel.Client;
+using Duende.IdentityModel.Client;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
-using Newtonsoft.Json.Linq;
+using System;
+using System.Globalization;
+using System.Net.Http;
+using System.Threading.Tasks;
namespace MvcCode.Controllers
{
@@ -21,14 +20,14 @@ public HomeController(IHttpClientFactory httpClientFactory, IDiscoveryCache disc
_httpClientFactory = httpClientFactory;
_discoveryCache = discoveryCache;
}
-
+
[AllowAnonymous]
public IActionResult Index() => View();
public IActionResult Secure() => View();
public IActionResult Logout() => SignOut("oidc");
-
+
public async Task CallApi()
{
var token = await HttpContext.GetTokenAsync("access_token");
@@ -37,7 +36,7 @@ public async Task CallApi()
client.SetBearerToken(token);
var response = await client.GetStringAsync(Constants.SampleApi + "identity");
- ViewBag.Json = JArray.Parse(response).ToString();
+ ViewBag.Json = response;
return View();
}
diff --git a/samples/Clients/src/MvcCode/MvcCode.csproj b/samples/Clients/src/MvcCode/MvcCode.csproj
index 8f0c768c1..fd10db2cf 100644
--- a/samples/Clients/src/MvcCode/MvcCode.csproj
+++ b/samples/Clients/src/MvcCode/MvcCode.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
@@ -11,4 +11,4 @@
-
+
\ No newline at end of file
diff --git a/samples/Clients/src/MvcCode/Startup.cs b/samples/Clients/src/MvcCode/Startup.cs
index 0558bec90..9526b596e 100644
--- a/samples/Clients/src/MvcCode/Startup.cs
+++ b/samples/Clients/src/MvcCode/Startup.cs
@@ -1,5 +1,6 @@
using Clients;
-using IdentityModel;
+using Duende.IdentityModel;
+using Duende.IdentityModel.Client;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Builder;
@@ -7,7 +8,6 @@
using Microsoft.IdentityModel.Tokens;
using System.IdentityModel.Tokens.Jwt;
using System.Net.Http;
-using IdentityModel.Client;
namespace MvcCode
{
@@ -18,7 +18,7 @@ public void ConfigureServices(IServiceCollection services)
JwtSecurityTokenHandler.DefaultMapInboundClaims = false;
services.AddControllersWithViews();
-
+
services.AddHttpClient();
services.AddSingleton(r =>
diff --git a/samples/Clients/src/MvcHybridBackChannel/Controllers/HomeController.cs b/samples/Clients/src/MvcHybridBackChannel/Controllers/HomeController.cs
index e78add677..ada409d5f 100644
--- a/samples/Clients/src/MvcHybridBackChannel/Controllers/HomeController.cs
+++ b/samples/Clients/src/MvcHybridBackChannel/Controllers/HomeController.cs
@@ -1,14 +1,13 @@
-using System;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc;
+using Clients;
+using Duende.IdentityModel.Client;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization;
-using System.Net.Http;
-using Clients;
-using Newtonsoft.Json.Linq;
-using IdentityModel.Client;
-using System.Globalization;
using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Globalization;
+using System.Net.Http;
+using System.Threading.Tasks;
namespace MvcHybrid.Controllers
{
@@ -43,7 +42,7 @@ public async Task CallApi()
client.SetBearerToken(token);
var response = await client.GetStringAsync(Constants.SampleApi + "identity");
- ViewBag.Json = JArray.Parse(response).ToString();
+ ViewBag.Json = response.ToString();
return View();
}
diff --git a/samples/Clients/src/MvcHybridBackChannel/Controllers/LogoutController.cs b/samples/Clients/src/MvcHybridBackChannel/Controllers/LogoutController.cs
index 5e226fe84..593225d34 100644
--- a/samples/Clients/src/MvcHybridBackChannel/Controllers/LogoutController.cs
+++ b/samples/Clients/src/MvcHybridBackChannel/Controllers/LogoutController.cs
@@ -1,16 +1,15 @@
-using Clients;
-using IdentityModel;
-using IdentityModel.Client;
+using Clients;
+using Duende.IdentityModel;
+using Duende.IdentityModel.Client;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.IdentityModel.Tokens;
-using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.Net.Http;
using System.Security.Claims;
-using System.Security.Cryptography;
+using System.Text.Json.Nodes;
using System.Threading.Tasks;
namespace MvcHybrid.Controllers
@@ -60,8 +59,8 @@ private async Task ValidateLogoutToken(string logoutToken)
var eventsJson = claims.FindFirst("events")?.Value;
if (String.IsNullOrWhiteSpace(eventsJson)) throw new Exception("Invalid logout token");
- var events = JObject.Parse(eventsJson);
- var logoutEvent = events.TryGetValue("http://schemas.openid.net/event/backchannel-logout");
+ var events = JsonNode.Parse(eventsJson);
+ var logoutEvent = events["http://schemas.openid.net/event/backchannel-logout"];
if (logoutEvent == null) throw new Exception("Invalid logout token");
return claims;
diff --git a/samples/Clients/src/MvcHybridBackChannel/MvcHybridBackChannel.csproj b/samples/Clients/src/MvcHybridBackChannel/MvcHybridBackChannel.csproj
index bc73b48e2..45287483f 100644
--- a/samples/Clients/src/MvcHybridBackChannel/MvcHybridBackChannel.csproj
+++ b/samples/Clients/src/MvcHybridBackChannel/MvcHybridBackChannel.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
diff --git a/samples/Clients/src/MvcHybridBackChannel/Startup.cs b/samples/Clients/src/MvcHybridBackChannel/Startup.cs
index d9d3bb037..0a7b05150 100644
--- a/samples/Clients/src/MvcHybridBackChannel/Startup.cs
+++ b/samples/Clients/src/MvcHybridBackChannel/Startup.cs
@@ -1,13 +1,13 @@
-using System;
+using Clients;
+using Duende.IdentityModel;
+using Duende.IdentityModel.Client;
+using Microsoft.AspNetCore.Authentication;
+using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
-using System.IdentityModel.Tokens.Jwt;
-using IdentityModel;
-using Clients;
using Microsoft.IdentityModel.Tokens;
-using Microsoft.AspNetCore.Authentication.Cookies;
-using Microsoft.AspNetCore.Authentication;
-using IdentityModel.Client;
+using System;
+using System.IdentityModel.Tokens.Jwt;
using System.Net.Http;
namespace MvcHybrid
diff --git a/samples/Clients/src/WindowsConsoleSystemBrowser/WindowsConsoleSystemBrowser.csproj b/samples/Clients/src/WindowsConsoleSystemBrowser/WindowsConsoleSystemBrowser.csproj
index 3ae531411..a0366e058 100644
--- a/samples/Clients/src/WindowsConsoleSystemBrowser/WindowsConsoleSystemBrowser.csproj
+++ b/samples/Clients/src/WindowsConsoleSystemBrowser/WindowsConsoleSystemBrowser.csproj
@@ -2,18 +2,18 @@
Exe
- net7.0
+ net9.0
-
-
+
+
-
+
\ No newline at end of file
diff --git a/samples/KeyManagement/FileSystem/Startup.cs b/samples/KeyManagement/FileSystem/Startup.cs
index 78cd0e5ee..4fad094b3 100644
--- a/samples/KeyManagement/FileSystem/Startup.cs
+++ b/samples/KeyManagement/FileSystem/Startup.cs
@@ -7,7 +7,7 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.Extensions.DependencyInjection;
-using IdentityModel;
+using Duende.IdentityModel;
using System.Linq;
using System.IO;
using Microsoft.Extensions.Configuration;
@@ -31,7 +31,7 @@ public void ConfigureServices(IServiceCollection services)
services.AddDataProtection()
.PersistKeysToFileSystem(new DirectoryInfo(Path.Combine(Environment.ContentRootPath, "dataprotectionkeys")));
- //.ProtectKeysWithCertificate(cert);
+ //.ProtectKeysWithCertificate(cert);
var builder = services.AddIdentityServer()
.AddInMemoryIdentityResources(Config.GetIdentityResources())
@@ -60,12 +60,12 @@ public void ConfigureServices(IServiceCollection services)
.PersistKeysToFileSystem(Path.Combine(Environment.ContentRootPath, @"signingkeys"))
.ProtectKeysWithDataProtection();
- // .PersistKeysWith() // use this when you implement your own ISigningKeyStore
- //.EnableInMemoryCaching() // caching disabled unless explicitly enabled
- // run "..\cert\cert.ps1" from a powershell prompt to create new cert/pfx
- // put the pfx created in the local machine store
- //.ProtectKeysWithX509Certificate("CN=SigningKeysMasterKey")
- ;
+ // .PersistKeysWith() // use this when you implement your own ISigningKeyStore
+ //.EnableInMemoryCaching() // caching disabled unless explicitly enabled
+ // run "..\cert\cert.ps1" from a powershell prompt to create new cert/pfx
+ // put the pfx created in the local machine store
+ //.ProtectKeysWithX509Certificate("CN=SigningKeysMasterKey")
+ ;
}
public void Configure(IApplicationBuilder app)
diff --git a/samples/KeyManagement/database/EF/Startup.cs b/samples/KeyManagement/database/EF/Startup.cs
index 22bbcd3bd..09a2f4d32 100644
--- a/samples/KeyManagement/database/EF/Startup.cs
+++ b/samples/KeyManagement/database/EF/Startup.cs
@@ -4,7 +4,7 @@
using System;
using System.Linq;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.KeyManagement.EntityFramework;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.DataProtection;
@@ -43,7 +43,7 @@ public void ConfigureServices(IServiceCollection services)
ConfigureDbContext = b => b.UseSqlServer(cn),
LoggerFactory = LoggerFactory,
});
- //.ProtectKeysWithCertificate(cert);
+ //.ProtectKeysWithCertificate(cert);
var builder = services.AddIdentityServer()
.AddInMemoryIdentityResources(Config.GetIdentityResources())
@@ -68,11 +68,12 @@ public void ConfigureServices(IServiceCollection services)
options.Licensee = "your licensee";
options.License = "your license key";
})
- .PersistKeysToDatabase(new DatabaseKeyManagementOptions {
+ .PersistKeysToDatabase(new DatabaseKeyManagementOptions
+ {
ConfigureDbContext = b => b.UseSqlServer(cn),
})
.ProtectKeysWithDataProtection()
- //.EnableInMemoryCaching() // caching disabled unless explicitly enabled
+ //.EnableInMemoryCaching() // caching disabled unless explicitly enabled
;
}
diff --git a/samples/Quickstarts/1_ClientCredentials/src/Client/Client.csproj b/samples/Quickstarts/1_ClientCredentials/src/Client/Client.csproj
index 81fc26a6a..d9fb60367 100644
--- a/samples/Quickstarts/1_ClientCredentials/src/Client/Client.csproj
+++ b/samples/Quickstarts/1_ClientCredentials/src/Client/Client.csproj
@@ -6,7 +6,7 @@
-
+
-
+
\ No newline at end of file
diff --git a/samples/Quickstarts/2_InteractiveAspNetCore/src/Client/Client.csproj b/samples/Quickstarts/2_InteractiveAspNetCore/src/Client/Client.csproj
index 81fc26a6a..d9fb60367 100644
--- a/samples/Quickstarts/2_InteractiveAspNetCore/src/Client/Client.csproj
+++ b/samples/Quickstarts/2_InteractiveAspNetCore/src/Client/Client.csproj
@@ -6,7 +6,7 @@
-
+
-
+
\ No newline at end of file
diff --git a/samples/Quickstarts/2_InteractiveAspNetCore/src/IdentityServer/Quickstart/Account/AccountController.cs b/samples/Quickstarts/2_InteractiveAspNetCore/src/IdentityServer/Quickstart/Account/AccountController.cs
index 2d51c3cd0..11b891951 100644
--- a/samples/Quickstarts/2_InteractiveAspNetCore/src/IdentityServer/Quickstart/Account/AccountController.cs
+++ b/samples/Quickstarts/2_InteractiveAspNetCore/src/IdentityServer/Quickstart/Account/AccountController.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4;
using IdentityServer4.Events;
using IdentityServer4.Extensions;
@@ -125,7 +125,8 @@ public async Task Login(LoginInputModel model, string button)
IsPersistent = true,
ExpiresUtc = DateTimeOffset.UtcNow.Add(AccountOptions.RememberMeLoginDuration)
};
- };
+ }
+ ;
// issue authentication cookie with subject ID and username
var isuser = new IdentityServerUser(user.SubjectId)
@@ -164,7 +165,7 @@ public async Task Login(LoginInputModel model, string button)
}
}
- await _events.RaiseAsync(new UserLoginFailureEvent(model.Username, "invalid credentials", clientId:context?.Client.ClientId));
+ await _events.RaiseAsync(new UserLoginFailureEvent(model.Username, "invalid credentials", clientId: context?.Client.ClientId));
ModelState.AddModelError(string.Empty, AccountOptions.InvalidCredentialsErrorMessage);
}
@@ -173,7 +174,7 @@ public async Task Login(LoginInputModel model, string button)
return View(vm);
}
-
+
///
/// Show logout page
///
diff --git a/samples/Quickstarts/2_InteractiveAspNetCore/src/IdentityServer/Quickstart/Account/ExternalController.cs b/samples/Quickstarts/2_InteractiveAspNetCore/src/IdentityServer/Quickstart/Account/ExternalController.cs
index 1a7479ea1..4c50816a3 100644
--- a/samples/Quickstarts/2_InteractiveAspNetCore/src/IdentityServer/Quickstart/Account/ExternalController.cs
+++ b/samples/Quickstarts/2_InteractiveAspNetCore/src/IdentityServer/Quickstart/Account/ExternalController.cs
@@ -1,4 +1,4 @@
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4;
using IdentityServer4.Events;
using IdentityServer4.Services;
@@ -58,20 +58,20 @@ public IActionResult Challenge(string scheme, string returnUrl)
// user might have clicked on a malicious link - should be logged
throw new Exception("invalid return URL");
}
-
+
// start challenge and roundtrip the return URL and scheme
var props = new AuthenticationProperties
{
- RedirectUri = Url.Action(nameof(Callback)),
+ RedirectUri = Url.Action(nameof(Callback)),
Items =
{
- { "returnUrl", returnUrl },
+ { "returnUrl", returnUrl },
{ "scheme", scheme },
}
};
return Challenge(props, scheme);
-
+
}
///
@@ -109,7 +109,7 @@ public async Task Callback()
var additionalLocalClaims = new List();
var localSignInProps = new AuthenticationProperties();
ProcessLoginCallback(result, additionalLocalClaims, localSignInProps);
-
+
// issue authentication cookie for user
var isuser = new IdentityServerUser(user.SubjectId)
{
diff --git a/samples/Quickstarts/2_InteractiveAspNetCore/src/IdentityServer/Quickstart/Diagnostics/DiagnosticsViewModel.cs b/samples/Quickstarts/2_InteractiveAspNetCore/src/IdentityServer/Quickstart/Diagnostics/DiagnosticsViewModel.cs
index f43c7685b..1d4286529 100644
--- a/samples/Quickstarts/2_InteractiveAspNetCore/src/IdentityServer/Quickstart/Diagnostics/DiagnosticsViewModel.cs
+++ b/samples/Quickstarts/2_InteractiveAspNetCore/src/IdentityServer/Quickstart/Diagnostics/DiagnosticsViewModel.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using Microsoft.AspNetCore.Authentication;
using Newtonsoft.Json;
using System.Collections.Generic;
diff --git a/samples/Quickstarts/2_InteractiveAspNetCore/src/IdentityServer/Quickstart/TestUsers.cs b/samples/Quickstarts/2_InteractiveAspNetCore/src/IdentityServer/Quickstart/TestUsers.cs
index 2acb95405..37f2be4a9 100644
--- a/samples/Quickstarts/2_InteractiveAspNetCore/src/IdentityServer/Quickstart/TestUsers.cs
+++ b/samples/Quickstarts/2_InteractiveAspNetCore/src/IdentityServer/Quickstart/TestUsers.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Test;
using System.Collections.Generic;
using System.Security.Claims;
@@ -24,7 +24,7 @@ public static List Users
postal_code = 69118,
country = "Germany"
};
-
+
return new List
{
new TestUser
diff --git a/samples/Quickstarts/3_AspNetCoreAndApis/src/Client/Client.csproj b/samples/Quickstarts/3_AspNetCoreAndApis/src/Client/Client.csproj
index 81fc26a6a..d9fb60367 100644
--- a/samples/Quickstarts/3_AspNetCoreAndApis/src/Client/Client.csproj
+++ b/samples/Quickstarts/3_AspNetCoreAndApis/src/Client/Client.csproj
@@ -6,7 +6,7 @@
-
+
-
+
\ No newline at end of file
diff --git a/samples/Quickstarts/3_AspNetCoreAndApis/src/IdentityServer/Quickstart/Account/AccountController.cs b/samples/Quickstarts/3_AspNetCoreAndApis/src/IdentityServer/Quickstart/Account/AccountController.cs
index 2d51c3cd0..11b891951 100644
--- a/samples/Quickstarts/3_AspNetCoreAndApis/src/IdentityServer/Quickstart/Account/AccountController.cs
+++ b/samples/Quickstarts/3_AspNetCoreAndApis/src/IdentityServer/Quickstart/Account/AccountController.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4;
using IdentityServer4.Events;
using IdentityServer4.Extensions;
@@ -125,7 +125,8 @@ public async Task Login(LoginInputModel model, string button)
IsPersistent = true,
ExpiresUtc = DateTimeOffset.UtcNow.Add(AccountOptions.RememberMeLoginDuration)
};
- };
+ }
+ ;
// issue authentication cookie with subject ID and username
var isuser = new IdentityServerUser(user.SubjectId)
@@ -164,7 +165,7 @@ public async Task Login(LoginInputModel model, string button)
}
}
- await _events.RaiseAsync(new UserLoginFailureEvent(model.Username, "invalid credentials", clientId:context?.Client.ClientId));
+ await _events.RaiseAsync(new UserLoginFailureEvent(model.Username, "invalid credentials", clientId: context?.Client.ClientId));
ModelState.AddModelError(string.Empty, AccountOptions.InvalidCredentialsErrorMessage);
}
@@ -173,7 +174,7 @@ public async Task Login(LoginInputModel model, string button)
return View(vm);
}
-
+
///
/// Show logout page
///
diff --git a/samples/Quickstarts/3_AspNetCoreAndApis/src/IdentityServer/Quickstart/Account/ExternalController.cs b/samples/Quickstarts/3_AspNetCoreAndApis/src/IdentityServer/Quickstart/Account/ExternalController.cs
index 1a7479ea1..4c50816a3 100644
--- a/samples/Quickstarts/3_AspNetCoreAndApis/src/IdentityServer/Quickstart/Account/ExternalController.cs
+++ b/samples/Quickstarts/3_AspNetCoreAndApis/src/IdentityServer/Quickstart/Account/ExternalController.cs
@@ -1,4 +1,4 @@
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4;
using IdentityServer4.Events;
using IdentityServer4.Services;
@@ -58,20 +58,20 @@ public IActionResult Challenge(string scheme, string returnUrl)
// user might have clicked on a malicious link - should be logged
throw new Exception("invalid return URL");
}
-
+
// start challenge and roundtrip the return URL and scheme
var props = new AuthenticationProperties
{
- RedirectUri = Url.Action(nameof(Callback)),
+ RedirectUri = Url.Action(nameof(Callback)),
Items =
{
- { "returnUrl", returnUrl },
+ { "returnUrl", returnUrl },
{ "scheme", scheme },
}
};
return Challenge(props, scheme);
-
+
}
///
@@ -109,7 +109,7 @@ public async Task Callback()
var additionalLocalClaims = new List();
var localSignInProps = new AuthenticationProperties();
ProcessLoginCallback(result, additionalLocalClaims, localSignInProps);
-
+
// issue authentication cookie for user
var isuser = new IdentityServerUser(user.SubjectId)
{
diff --git a/samples/Quickstarts/3_AspNetCoreAndApis/src/IdentityServer/Quickstart/Diagnostics/DiagnosticsViewModel.cs b/samples/Quickstarts/3_AspNetCoreAndApis/src/IdentityServer/Quickstart/Diagnostics/DiagnosticsViewModel.cs
index f43c7685b..1d4286529 100644
--- a/samples/Quickstarts/3_AspNetCoreAndApis/src/IdentityServer/Quickstart/Diagnostics/DiagnosticsViewModel.cs
+++ b/samples/Quickstarts/3_AspNetCoreAndApis/src/IdentityServer/Quickstart/Diagnostics/DiagnosticsViewModel.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using Microsoft.AspNetCore.Authentication;
using Newtonsoft.Json;
using System.Collections.Generic;
diff --git a/samples/Quickstarts/3_AspNetCoreAndApis/src/IdentityServer/Quickstart/TestUsers.cs b/samples/Quickstarts/3_AspNetCoreAndApis/src/IdentityServer/Quickstart/TestUsers.cs
index 2acb95405..37f2be4a9 100644
--- a/samples/Quickstarts/3_AspNetCoreAndApis/src/IdentityServer/Quickstart/TestUsers.cs
+++ b/samples/Quickstarts/3_AspNetCoreAndApis/src/IdentityServer/Quickstart/TestUsers.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Test;
using System.Collections.Generic;
using System.Security.Claims;
@@ -24,7 +24,7 @@ public static List Users
postal_code = 69118,
country = "Germany"
};
-
+
return new List
{
new TestUser
diff --git a/samples/Quickstarts/4_JavaScriptClient/src/Client/Client.csproj b/samples/Quickstarts/4_JavaScriptClient/src/Client/Client.csproj
index 81fc26a6a..d9fb60367 100644
--- a/samples/Quickstarts/4_JavaScriptClient/src/Client/Client.csproj
+++ b/samples/Quickstarts/4_JavaScriptClient/src/Client/Client.csproj
@@ -6,7 +6,7 @@
-
+
-
+
\ No newline at end of file
diff --git a/samples/Quickstarts/4_JavaScriptClient/src/IdentityServer/Quickstart/Account/AccountController.cs b/samples/Quickstarts/4_JavaScriptClient/src/IdentityServer/Quickstart/Account/AccountController.cs
index 2d51c3cd0..11b891951 100644
--- a/samples/Quickstarts/4_JavaScriptClient/src/IdentityServer/Quickstart/Account/AccountController.cs
+++ b/samples/Quickstarts/4_JavaScriptClient/src/IdentityServer/Quickstart/Account/AccountController.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4;
using IdentityServer4.Events;
using IdentityServer4.Extensions;
@@ -125,7 +125,8 @@ public async Task Login(LoginInputModel model, string button)
IsPersistent = true,
ExpiresUtc = DateTimeOffset.UtcNow.Add(AccountOptions.RememberMeLoginDuration)
};
- };
+ }
+ ;
// issue authentication cookie with subject ID and username
var isuser = new IdentityServerUser(user.SubjectId)
@@ -164,7 +165,7 @@ public async Task Login(LoginInputModel model, string button)
}
}
- await _events.RaiseAsync(new UserLoginFailureEvent(model.Username, "invalid credentials", clientId:context?.Client.ClientId));
+ await _events.RaiseAsync(new UserLoginFailureEvent(model.Username, "invalid credentials", clientId: context?.Client.ClientId));
ModelState.AddModelError(string.Empty, AccountOptions.InvalidCredentialsErrorMessage);
}
@@ -173,7 +174,7 @@ public async Task Login(LoginInputModel model, string button)
return View(vm);
}
-
+
///
/// Show logout page
///
diff --git a/samples/Quickstarts/4_JavaScriptClient/src/IdentityServer/Quickstart/Account/ExternalController.cs b/samples/Quickstarts/4_JavaScriptClient/src/IdentityServer/Quickstart/Account/ExternalController.cs
index 1a7479ea1..4c50816a3 100644
--- a/samples/Quickstarts/4_JavaScriptClient/src/IdentityServer/Quickstart/Account/ExternalController.cs
+++ b/samples/Quickstarts/4_JavaScriptClient/src/IdentityServer/Quickstart/Account/ExternalController.cs
@@ -1,4 +1,4 @@
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4;
using IdentityServer4.Events;
using IdentityServer4.Services;
@@ -58,20 +58,20 @@ public IActionResult Challenge(string scheme, string returnUrl)
// user might have clicked on a malicious link - should be logged
throw new Exception("invalid return URL");
}
-
+
// start challenge and roundtrip the return URL and scheme
var props = new AuthenticationProperties
{
- RedirectUri = Url.Action(nameof(Callback)),
+ RedirectUri = Url.Action(nameof(Callback)),
Items =
{
- { "returnUrl", returnUrl },
+ { "returnUrl", returnUrl },
{ "scheme", scheme },
}
};
return Challenge(props, scheme);
-
+
}
///
@@ -109,7 +109,7 @@ public async Task Callback()
var additionalLocalClaims = new List();
var localSignInProps = new AuthenticationProperties();
ProcessLoginCallback(result, additionalLocalClaims, localSignInProps);
-
+
// issue authentication cookie for user
var isuser = new IdentityServerUser(user.SubjectId)
{
diff --git a/samples/Quickstarts/4_JavaScriptClient/src/IdentityServer/Quickstart/Diagnostics/DiagnosticsViewModel.cs b/samples/Quickstarts/4_JavaScriptClient/src/IdentityServer/Quickstart/Diagnostics/DiagnosticsViewModel.cs
index f43c7685b..1d4286529 100644
--- a/samples/Quickstarts/4_JavaScriptClient/src/IdentityServer/Quickstart/Diagnostics/DiagnosticsViewModel.cs
+++ b/samples/Quickstarts/4_JavaScriptClient/src/IdentityServer/Quickstart/Diagnostics/DiagnosticsViewModel.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using Microsoft.AspNetCore.Authentication;
using Newtonsoft.Json;
using System.Collections.Generic;
diff --git a/samples/Quickstarts/4_JavaScriptClient/src/IdentityServer/Quickstart/TestUsers.cs b/samples/Quickstarts/4_JavaScriptClient/src/IdentityServer/Quickstart/TestUsers.cs
index 2acb95405..37f2be4a9 100644
--- a/samples/Quickstarts/4_JavaScriptClient/src/IdentityServer/Quickstart/TestUsers.cs
+++ b/samples/Quickstarts/4_JavaScriptClient/src/IdentityServer/Quickstart/TestUsers.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Test;
using System.Collections.Generic;
using System.Security.Claims;
@@ -24,7 +24,7 @@ public static List Users
postal_code = 69118,
country = "Germany"
};
-
+
return new List
{
new TestUser
diff --git a/samples/Quickstarts/5_EntityFramework/src/Client/Client.csproj b/samples/Quickstarts/5_EntityFramework/src/Client/Client.csproj
index 81fc26a6a..d9fb60367 100644
--- a/samples/Quickstarts/5_EntityFramework/src/Client/Client.csproj
+++ b/samples/Quickstarts/5_EntityFramework/src/Client/Client.csproj
@@ -6,7 +6,7 @@
-
+
-
+
\ No newline at end of file
diff --git a/samples/Quickstarts/5_EntityFramework/src/IdentityServer/Quickstart/Account/AccountController.cs b/samples/Quickstarts/5_EntityFramework/src/IdentityServer/Quickstart/Account/AccountController.cs
index 2d51c3cd0..11b891951 100644
--- a/samples/Quickstarts/5_EntityFramework/src/IdentityServer/Quickstart/Account/AccountController.cs
+++ b/samples/Quickstarts/5_EntityFramework/src/IdentityServer/Quickstart/Account/AccountController.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4;
using IdentityServer4.Events;
using IdentityServer4.Extensions;
@@ -125,7 +125,8 @@ public async Task Login(LoginInputModel model, string button)
IsPersistent = true,
ExpiresUtc = DateTimeOffset.UtcNow.Add(AccountOptions.RememberMeLoginDuration)
};
- };
+ }
+ ;
// issue authentication cookie with subject ID and username
var isuser = new IdentityServerUser(user.SubjectId)
@@ -164,7 +165,7 @@ public async Task Login(LoginInputModel model, string button)
}
}
- await _events.RaiseAsync(new UserLoginFailureEvent(model.Username, "invalid credentials", clientId:context?.Client.ClientId));
+ await _events.RaiseAsync(new UserLoginFailureEvent(model.Username, "invalid credentials", clientId: context?.Client.ClientId));
ModelState.AddModelError(string.Empty, AccountOptions.InvalidCredentialsErrorMessage);
}
@@ -173,7 +174,7 @@ public async Task Login(LoginInputModel model, string button)
return View(vm);
}
-
+
///
/// Show logout page
///
diff --git a/samples/Quickstarts/5_EntityFramework/src/IdentityServer/Quickstart/Account/ExternalController.cs b/samples/Quickstarts/5_EntityFramework/src/IdentityServer/Quickstart/Account/ExternalController.cs
index 1a7479ea1..4c50816a3 100644
--- a/samples/Quickstarts/5_EntityFramework/src/IdentityServer/Quickstart/Account/ExternalController.cs
+++ b/samples/Quickstarts/5_EntityFramework/src/IdentityServer/Quickstart/Account/ExternalController.cs
@@ -1,4 +1,4 @@
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4;
using IdentityServer4.Events;
using IdentityServer4.Services;
@@ -58,20 +58,20 @@ public IActionResult Challenge(string scheme, string returnUrl)
// user might have clicked on a malicious link - should be logged
throw new Exception("invalid return URL");
}
-
+
// start challenge and roundtrip the return URL and scheme
var props = new AuthenticationProperties
{
- RedirectUri = Url.Action(nameof(Callback)),
+ RedirectUri = Url.Action(nameof(Callback)),
Items =
{
- { "returnUrl", returnUrl },
+ { "returnUrl", returnUrl },
{ "scheme", scheme },
}
};
return Challenge(props, scheme);
-
+
}
///
@@ -109,7 +109,7 @@ public async Task Callback()
var additionalLocalClaims = new List();
var localSignInProps = new AuthenticationProperties();
ProcessLoginCallback(result, additionalLocalClaims, localSignInProps);
-
+
// issue authentication cookie for user
var isuser = new IdentityServerUser(user.SubjectId)
{
diff --git a/samples/Quickstarts/5_EntityFramework/src/IdentityServer/Quickstart/Diagnostics/DiagnosticsViewModel.cs b/samples/Quickstarts/5_EntityFramework/src/IdentityServer/Quickstart/Diagnostics/DiagnosticsViewModel.cs
index f43c7685b..1d4286529 100644
--- a/samples/Quickstarts/5_EntityFramework/src/IdentityServer/Quickstart/Diagnostics/DiagnosticsViewModel.cs
+++ b/samples/Quickstarts/5_EntityFramework/src/IdentityServer/Quickstart/Diagnostics/DiagnosticsViewModel.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using Microsoft.AspNetCore.Authentication;
using Newtonsoft.Json;
using System.Collections.Generic;
diff --git a/samples/Quickstarts/5_EntityFramework/src/IdentityServer/Quickstart/TestUsers.cs b/samples/Quickstarts/5_EntityFramework/src/IdentityServer/Quickstart/TestUsers.cs
index 2acb95405..37f2be4a9 100644
--- a/samples/Quickstarts/5_EntityFramework/src/IdentityServer/Quickstart/TestUsers.cs
+++ b/samples/Quickstarts/5_EntityFramework/src/IdentityServer/Quickstart/TestUsers.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Test;
using System.Collections.Generic;
using System.Security.Claims;
@@ -24,7 +24,7 @@ public static List Users
postal_code = 69118,
country = "Germany"
};
-
+
return new List
{
new TestUser
diff --git a/samples/Quickstarts/6_AspNetIdentity/src/Client/Client.csproj b/samples/Quickstarts/6_AspNetIdentity/src/Client/Client.csproj
index 81fc26a6a..d9fb60367 100644
--- a/samples/Quickstarts/6_AspNetIdentity/src/Client/Client.csproj
+++ b/samples/Quickstarts/6_AspNetIdentity/src/Client/Client.csproj
@@ -6,7 +6,7 @@
-
+
-
+
\ No newline at end of file
diff --git a/samples/Quickstarts/6_AspNetIdentity/src/IdentityServerAspNetIdentity/Quickstart/Account/AccountController.cs b/samples/Quickstarts/6_AspNetIdentity/src/IdentityServerAspNetIdentity/Quickstart/Account/AccountController.cs
index 04f1bc7eb..506915277 100644
--- a/samples/Quickstarts/6_AspNetIdentity/src/IdentityServerAspNetIdentity/Quickstart/Account/AccountController.cs
+++ b/samples/Quickstarts/6_AspNetIdentity/src/IdentityServerAspNetIdentity/Quickstart/Account/AccountController.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Events;
using IdentityServer4.Extensions;
using IdentityServer4.Models;
@@ -139,7 +139,7 @@ public async Task Login(LoginInputModel model, string button)
}
}
- await _events.RaiseAsync(new UserLoginFailureEvent(model.Username, "invalid credentials", clientId:context?.Client.ClientId));
+ await _events.RaiseAsync(new UserLoginFailureEvent(model.Username, "invalid credentials", clientId: context?.Client.ClientId));
ModelState.AddModelError(string.Empty, AccountOptions.InvalidCredentialsErrorMessage);
}
@@ -148,7 +148,7 @@ public async Task Login(LoginInputModel model, string button)
return View(vm);
}
-
+
///
/// Show logout page
///
diff --git a/samples/Quickstarts/6_AspNetIdentity/src/IdentityServerAspNetIdentity/Quickstart/Account/ExternalController.cs b/samples/Quickstarts/6_AspNetIdentity/src/IdentityServerAspNetIdentity/Quickstart/Account/ExternalController.cs
index bfa61b4bc..4cd914aeb 100644
--- a/samples/Quickstarts/6_AspNetIdentity/src/IdentityServerAspNetIdentity/Quickstart/Account/ExternalController.cs
+++ b/samples/Quickstarts/6_AspNetIdentity/src/IdentityServerAspNetIdentity/Quickstart/Account/ExternalController.cs
@@ -3,7 +3,7 @@
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4;
using IdentityServer4.Events;
using IdentityServer4.Services;
@@ -59,20 +59,20 @@ public IActionResult Challenge(string scheme, string returnUrl)
// user might have clicked on a malicious link - should be logged
throw new Exception("invalid return URL");
}
-
+
// start challenge and roundtrip the return URL and scheme
var props = new AuthenticationProperties
{
- RedirectUri = Url.Action(nameof(Callback)),
+ RedirectUri = Url.Action(nameof(Callback)),
Items =
{
- { "returnUrl", returnUrl },
+ { "returnUrl", returnUrl },
{ "scheme", scheme },
}
};
return Challenge(props, scheme);
-
+
}
///
@@ -110,14 +110,14 @@ public async Task Callback()
var additionalLocalClaims = new List();
var localSignInProps = new AuthenticationProperties();
ProcessLoginCallback(result, additionalLocalClaims, localSignInProps);
-
+
// issue authentication cookie for user
// we must issue the cookie maually, and can't use the SignInManager because
// it doesn't expose an API to issue additional claims from the login workflow
var principal = await _signInManager.CreateUserPrincipalAsync(user);
additionalLocalClaims.AddRange(principal.Claims);
var name = principal.FindFirst(JwtClaimTypes.Name)?.Value ?? user.Id;
-
+
var isuser = new IdentityServerUser(user.Id)
{
DisplayName = name,
diff --git a/samples/Quickstarts/6_AspNetIdentity/src/IdentityServerAspNetIdentity/Quickstart/Diagnostics/DiagnosticsViewModel.cs b/samples/Quickstarts/6_AspNetIdentity/src/IdentityServerAspNetIdentity/Quickstart/Diagnostics/DiagnosticsViewModel.cs
index f43c7685b..1d4286529 100644
--- a/samples/Quickstarts/6_AspNetIdentity/src/IdentityServerAspNetIdentity/Quickstart/Diagnostics/DiagnosticsViewModel.cs
+++ b/samples/Quickstarts/6_AspNetIdentity/src/IdentityServerAspNetIdentity/Quickstart/Diagnostics/DiagnosticsViewModel.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using Microsoft.AspNetCore.Authentication;
using Newtonsoft.Json;
using System.Collections.Generic;
diff --git a/samples/Quickstarts/6_AspNetIdentity/src/IdentityServerAspNetIdentity/Quickstart/TestUsers.cs b/samples/Quickstarts/6_AspNetIdentity/src/IdentityServerAspNetIdentity/Quickstart/TestUsers.cs
index b4d2f821f..86f03ef30 100644
--- a/samples/Quickstarts/6_AspNetIdentity/src/IdentityServerAspNetIdentity/Quickstart/TestUsers.cs
+++ b/samples/Quickstarts/6_AspNetIdentity/src/IdentityServerAspNetIdentity/Quickstart/TestUsers.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Test;
using System.Collections.Generic;
using System.Security.Claims;
@@ -13,8 +13,8 @@ public class TestUsers
{
public static List Users = new List
{
- new TestUser{SubjectId = "818727", Username = "alice", Password = "alice",
- Claims =
+ new TestUser{SubjectId = "818727", Username = "alice", Password = "alice",
+ Claims =
{
new Claim(JwtClaimTypes.Name, "Alice Smith"),
new Claim(JwtClaimTypes.GivenName, "Alice"),
@@ -25,8 +25,8 @@ public class TestUsers
new Claim(JwtClaimTypes.Address, @"{ 'street_address': 'One Hacker Way', 'locality': 'Heidelberg', 'postal_code': 69118, 'country': 'Germany' }", IdentityServer4.IdentityServerConstants.ClaimValueTypes.Json)
}
},
- new TestUser{SubjectId = "88421113", Username = "bob", Password = "bob",
- Claims =
+ new TestUser{SubjectId = "88421113", Username = "bob", Password = "bob",
+ Claims =
{
new Claim(JwtClaimTypes.Name, "Bob Smith"),
new Claim(JwtClaimTypes.GivenName, "Bob"),
diff --git a/samples/Quickstarts/6_AspNetIdentity/src/IdentityServerAspNetIdentity/SeedData.cs b/samples/Quickstarts/6_AspNetIdentity/src/IdentityServerAspNetIdentity/SeedData.cs
index 87d2fea6b..1d288343a 100644
--- a/samples/Quickstarts/6_AspNetIdentity/src/IdentityServerAspNetIdentity/SeedData.cs
+++ b/samples/Quickstarts/6_AspNetIdentity/src/IdentityServerAspNetIdentity/SeedData.cs
@@ -5,7 +5,7 @@
using System;
using System.Linq;
using System.Security.Claims;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServerAspNetIdentity.Data;
using IdentityServerAspNetIdentity.Models;
using Microsoft.AspNetCore.Identity;
diff --git a/samples/Quickstarts/Directory.Build.targets b/samples/Quickstarts/Directory.Build.targets
index 1611f8603..8d2b57450 100644
--- a/samples/Quickstarts/Directory.Build.targets
+++ b/samples/Quickstarts/Directory.Build.targets
@@ -5,7 +5,7 @@
-
+
diff --git a/src/AspNetIdentity/build/build.csproj b/src/AspNetIdentity/build/build.csproj
index d1be6f152..120e3ac37 100644
--- a/src/AspNetIdentity/build/build.csproj
+++ b/src/AspNetIdentity/build/build.csproj
@@ -2,7 +2,7 @@
Exe
- net7.0
+ net9.0
@@ -13,5 +13,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/src/AspNetIdentity/host/Configuration/Resources.cs b/src/AspNetIdentity/host/Configuration/Resources.cs
index 12a33bbf4..2c136d4af 100644
--- a/src/AspNetIdentity/host/Configuration/Resources.cs
+++ b/src/AspNetIdentity/host/Configuration/Resources.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Models;
using System.Collections.Generic;
using static IdentityServer4.IdentityServerConstants;
@@ -49,7 +49,7 @@ public class Resources
};
// API resources are more formal representation of a resource with processing rules and their scopes (if any)
- public static readonly IEnumerable ApiResources =
+ public static readonly IEnumerable ApiResources =
new[]
{
new ApiResource("resource1", "Resource 1")
diff --git a/src/AspNetIdentity/host/Host.csproj b/src/AspNetIdentity/host/Host.csproj
index e0fad87eb..397b2627e 100644
--- a/src/AspNetIdentity/host/Host.csproj
+++ b/src/AspNetIdentity/host/Host.csproj
@@ -1,21 +1,21 @@
- net7.0
+ net9.0
-
-
-
-
+
+
+
+
-
+
diff --git a/src/AspNetIdentity/host/Quickstart/Account/AccountController.cs b/src/AspNetIdentity/host/Quickstart/Account/AccountController.cs
index d427b051e..7d9ff91ce 100644
--- a/src/AspNetIdentity/host/Quickstart/Account/AccountController.cs
+++ b/src/AspNetIdentity/host/Quickstart/Account/AccountController.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4;
using IdentityServer4.Events;
using IdentityServer4.Extensions;
@@ -139,7 +139,7 @@ public async Task Login(LoginInputModel model, string button)
}
}
- await _events.RaiseAsync(new UserLoginFailureEvent(model.Username, "invalid credentials", clientId:context?.Client.ClientId));
+ await _events.RaiseAsync(new UserLoginFailureEvent(model.Username, "invalid credentials", clientId: context?.Client.ClientId));
ModelState.AddModelError(string.Empty, AccountOptions.InvalidCredentialsErrorMessage);
}
@@ -148,7 +148,7 @@ public async Task Login(LoginInputModel model, string button)
return View(vm);
}
-
+
///
/// Show logout page
///
diff --git a/src/AspNetIdentity/host/Quickstart/Account/ExternalController.cs b/src/AspNetIdentity/host/Quickstart/Account/ExternalController.cs
index 0e66bee4e..28935f151 100644
--- a/src/AspNetIdentity/host/Quickstart/Account/ExternalController.cs
+++ b/src/AspNetIdentity/host/Quickstart/Account/ExternalController.cs
@@ -3,7 +3,7 @@
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4;
using IdentityServer4.Events;
using IdentityServer4.Models;
@@ -59,20 +59,20 @@ public IActionResult Challenge(string scheme, string returnUrl)
// user might have clicked on a malicious link - should be logged
throw new Exception("invalid return URL");
}
-
+
// start challenge and roundtrip the return URL and scheme
var props = new AuthenticationProperties
{
- RedirectUri = Url.Action(nameof(Callback)),
+ RedirectUri = Url.Action(nameof(Callback)),
Items =
{
- { "returnUrl", returnUrl },
+ { "returnUrl", returnUrl },
{ "scheme", scheme },
}
};
return Challenge(props, scheme);
-
+
}
///
@@ -110,14 +110,14 @@ public async Task Callback()
var additionalLocalClaims = new List();
var localSignInProps = new AuthenticationProperties();
ProcessLoginCallback(result, additionalLocalClaims, localSignInProps);
-
+
// issue authentication cookie for user
// we must issue the cookie maually, and can't use the SignInManager because
// it doesn't expose an API to issue additional claims from the login workflow
var principal = await _signInManager.CreateUserPrincipalAsync(user);
additionalLocalClaims.AddRange(principal.Claims);
var name = principal.FindFirst(JwtClaimTypes.Name)?.Value ?? user.Id;
-
+
var isuser = new IdentityServerUser(user.Id)
{
DisplayName = name,
diff --git a/src/AspNetIdentity/host/Quickstart/Diagnostics/DiagnosticsViewModel.cs b/src/AspNetIdentity/host/Quickstart/Diagnostics/DiagnosticsViewModel.cs
index f43c7685b..1d4286529 100644
--- a/src/AspNetIdentity/host/Quickstart/Diagnostics/DiagnosticsViewModel.cs
+++ b/src/AspNetIdentity/host/Quickstart/Diagnostics/DiagnosticsViewModel.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using Microsoft.AspNetCore.Authentication;
using Newtonsoft.Json;
using System.Collections.Generic;
diff --git a/src/AspNetIdentity/host/Quickstart/TestUsers.cs b/src/AspNetIdentity/host/Quickstart/TestUsers.cs
index b4d2f821f..86f03ef30 100644
--- a/src/AspNetIdentity/host/Quickstart/TestUsers.cs
+++ b/src/AspNetIdentity/host/Quickstart/TestUsers.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Test;
using System.Collections.Generic;
using System.Security.Claims;
@@ -13,8 +13,8 @@ public class TestUsers
{
public static List Users = new List
{
- new TestUser{SubjectId = "818727", Username = "alice", Password = "alice",
- Claims =
+ new TestUser{SubjectId = "818727", Username = "alice", Password = "alice",
+ Claims =
{
new Claim(JwtClaimTypes.Name, "Alice Smith"),
new Claim(JwtClaimTypes.GivenName, "Alice"),
@@ -25,8 +25,8 @@ public class TestUsers
new Claim(JwtClaimTypes.Address, @"{ 'street_address': 'One Hacker Way', 'locality': 'Heidelberg', 'postal_code': 69118, 'country': 'Germany' }", IdentityServer4.IdentityServerConstants.ClaimValueTypes.Json)
}
},
- new TestUser{SubjectId = "88421113", Username = "bob", Password = "bob",
- Claims =
+ new TestUser{SubjectId = "88421113", Username = "bob", Password = "bob",
+ Claims =
{
new Claim(JwtClaimTypes.Name, "Bob Smith"),
new Claim(JwtClaimTypes.GivenName, "Bob"),
diff --git a/src/AspNetIdentity/migrations/SqlServer/SeedData.cs b/src/AspNetIdentity/migrations/SqlServer/SeedData.cs
index 7765bdb92..86871bad9 100644
--- a/src/AspNetIdentity/migrations/SqlServer/SeedData.cs
+++ b/src/AspNetIdentity/migrations/SqlServer/SeedData.cs
@@ -6,7 +6,7 @@
using System.Linq;
using System.Security.Claims;
using IdentityServerHost.Data;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Models;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
diff --git a/src/AspNetIdentity/migrations/SqlServer/SqlServer.csproj b/src/AspNetIdentity/migrations/SqlServer/SqlServer.csproj
index 122839dd2..5568b45f9 100644
--- a/src/AspNetIdentity/migrations/SqlServer/SqlServer.csproj
+++ b/src/AspNetIdentity/migrations/SqlServer/SqlServer.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
@@ -13,4 +13,4 @@
-
+
\ No newline at end of file
diff --git a/src/AspNetIdentity/src/IdentityServer4.AspNetIdentity.csproj b/src/AspNetIdentity/src/IdentityServer4.AspNetIdentity.csproj
index 1124cd8b6..bc65c60fe 100644
--- a/src/AspNetIdentity/src/IdentityServer4.AspNetIdentity.csproj
+++ b/src/AspNetIdentity/src/IdentityServer4.AspNetIdentity.csproj
@@ -2,7 +2,7 @@
Cnblogs.IdentityServer4.AspNetIdentity
- net7.0
+ net9.0
ASP.NET Core Identity Integration for IdentityServer4
Brock Allen;Dominick Baier
@@ -15,7 +15,8 @@
true
true
- $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
+
+ $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
../../../key.snk
true
diff --git a/src/AspNetIdentity/src/IdentityServerBuilderExtensions.cs b/src/AspNetIdentity/src/IdentityServerBuilderExtensions.cs
index 7eaa91355..51eb27f66 100644
--- a/src/AspNetIdentity/src/IdentityServerBuilderExtensions.cs
+++ b/src/AspNetIdentity/src/IdentityServerBuilderExtensions.cs
@@ -4,7 +4,7 @@
using System;
using System.Linq;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4;
using IdentityServer4.AspNetIdentity;
using IdentityServer4.Configuration;
diff --git a/src/AspNetIdentity/src/ResourceOwnerPasswordValidator.cs b/src/AspNetIdentity/src/ResourceOwnerPasswordValidator.cs
index 81a2feac3..c242f34f3 100644
--- a/src/AspNetIdentity/src/ResourceOwnerPasswordValidator.cs
+++ b/src/AspNetIdentity/src/ResourceOwnerPasswordValidator.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
+// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
@@ -7,9 +7,7 @@
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
-using static IdentityModel.OidcConstants;
-using IdentityServer4.Services;
-using IdentityServer4.Events;
+using static Duende.IdentityModel.OidcConstants;
namespace IdentityServer4.AspNetIdentity
{
diff --git a/src/AspNetIdentity/src/UserClaimsFactory.cs b/src/AspNetIdentity/src/UserClaimsFactory.cs
index 3dc69c7df..ee6af597f 100644
--- a/src/AspNetIdentity/src/UserClaimsFactory.cs
+++ b/src/AspNetIdentity/src/UserClaimsFactory.cs
@@ -7,7 +7,7 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using System.Security.Claims;
-using IdentityModel;
+using Duende.IdentityModel;
namespace IdentityServer4.AspNetIdentity
{
@@ -42,7 +42,7 @@ public async Task CreateAsync(TUser user)
identity.AddClaim(new Claim(JwtClaimTypes.PreferredUserName, username));
}
- if (!identity.HasClaim(x=>x.Type == JwtClaimTypes.Name))
+ if (!identity.HasClaim(x => x.Type == JwtClaimTypes.Name))
{
identity.AddClaim(new Claim(JwtClaimTypes.Name, username));
}
diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets
index 0a472224f..2306e9c15 100644
--- a/src/Directory.Build.targets
+++ b/src/Directory.Build.targets
@@ -1,69 +1,74 @@
-
- 7.0.0
- 7.0.0
- 7.0.0
- 4.2.0
-
+
+ 9.0.4
+ 9.0.4
+ 9.0.4
+ 4.3.0
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
+
+
+
+
+
-
-
- $(MinVerMajor).$(MinVerMinor).$(MinVerPatch).0
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(MinVerMajor).$(MinVerMinor).$(MinVerPatch).0
+
+
\ No newline at end of file
diff --git a/src/EntityFramework.Storage/build/build.csproj b/src/EntityFramework.Storage/build/build.csproj
index d1be6f152..120e3ac37 100644
--- a/src/EntityFramework.Storage/build/build.csproj
+++ b/src/EntityFramework.Storage/build/build.csproj
@@ -2,7 +2,7 @@
Exe
- net7.0
+ net9.0
@@ -13,5 +13,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/src/EntityFramework.Storage/host/ConsoleHost/ConsoleHost.csproj b/src/EntityFramework.Storage/host/ConsoleHost/ConsoleHost.csproj
index f6ef34066..1a09555d0 100644
--- a/src/EntityFramework.Storage/host/ConsoleHost/ConsoleHost.csproj
+++ b/src/EntityFramework.Storage/host/ConsoleHost/ConsoleHost.csproj
@@ -2,7 +2,7 @@
Exe
- net7.0
+ net9.0
@@ -14,4 +14,4 @@
-
+
\ No newline at end of file
diff --git a/src/EntityFramework.Storage/migrations/SqlServer/SqlServer.csproj b/src/EntityFramework.Storage/migrations/SqlServer/SqlServer.csproj
index ed3bb30d8..b0041a3ab 100644
--- a/src/EntityFramework.Storage/migrations/SqlServer/SqlServer.csproj
+++ b/src/EntityFramework.Storage/migrations/SqlServer/SqlServer.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
@@ -9,5 +9,5 @@
-
+
\ No newline at end of file
diff --git a/src/EntityFramework.Storage/src/IdentityServer4.EntityFramework.Storage.csproj b/src/EntityFramework.Storage/src/IdentityServer4.EntityFramework.Storage.csproj
index 461ff2fb3..3b7b5e074 100644
--- a/src/EntityFramework.Storage/src/IdentityServer4.EntityFramework.Storage.csproj
+++ b/src/EntityFramework.Storage/src/IdentityServer4.EntityFramework.Storage.csproj
@@ -2,8 +2,8 @@
Cnblogs.IdentityServer4.EntityFramework.Storage
- net7.0
-
+ net9.0
+
EntityFramework persistence layer for IdentityServer4
Brock Allen;Dominick Baier;Scott Brady
OAuth2;OAuth 2.0;OpenID Connect;Security;Identity;IdentityServer;EntityFramework
@@ -12,10 +12,11 @@
Apache-2.0
https://github.com/cnblogs/IdentityServer4/releases
true
-
+
true
true
- $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
+
+ $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
../../../key.snk
true
@@ -30,14 +31,14 @@
-
+
-
+
-
+
\ No newline at end of file
diff --git a/src/EntityFramework.Storage/src/Stores/DeviceFlowStore.cs b/src/EntityFramework.Storage/src/Stores/DeviceFlowStore.cs
index e4053009c..f8be2f725 100644
--- a/src/EntityFramework.Storage/src/Stores/DeviceFlowStore.cs
+++ b/src/EntityFramework.Storage/src/Stores/DeviceFlowStore.cs
@@ -5,7 +5,7 @@
using System;
using System.Linq;
using System.Threading.Tasks;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.EntityFramework.Entities;
using IdentityServer4.EntityFramework.Interfaces;
using IdentityServer4.Models;
@@ -44,8 +44,8 @@ public class DeviceFlowStore : IDeviceFlowStore
/// The serializer
/// The logger.
public DeviceFlowStore(
- IPersistedGrantDbContext context,
- IPersistentGrantSerializer serializer,
+ IPersistedGrantDbContext context,
+ IPersistentGrantSerializer serializer,
ILogger logger)
{
Context = context;
@@ -141,7 +141,7 @@ public virtual async Task RemoveByDeviceCodeAsync(string deviceCode)
var deviceFlowCodes = (await Context.DeviceFlowCodes.Where(x => x.DeviceCode == deviceCode).ToArrayAsync())
.SingleOrDefault(x => x.DeviceCode == deviceCode);
- if(deviceFlowCodes != null)
+ if (deviceFlowCodes != null)
{
Logger.LogDebug("removing {deviceCode} device code from database", deviceCode);
diff --git a/src/EntityFramework.Storage/test/IntegrationTests/DbContexts/ClientDbContextTests.cs b/src/EntityFramework.Storage/test/IntegrationTests/DbContexts/ClientDbContextTests.cs
index bc4e16bcb..4a89bfb1a 100644
--- a/src/EntityFramework.Storage/test/IntegrationTests/DbContexts/ClientDbContextTests.cs
+++ b/src/EntityFramework.Storage/test/IntegrationTests/DbContexts/ClientDbContextTests.cs
@@ -1,12 +1,12 @@
-// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
+// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using IdentityServer4.EntityFramework.DbContexts;
-using Microsoft.EntityFrameworkCore;
-using System.Linq;
using IdentityServer4.EntityFramework.Entities;
using IdentityServer4.EntityFramework.Options;
+using Microsoft.EntityFrameworkCore;
+using System.Linq;
using Xunit;
namespace IdentityServer4.EntityFramework.IntegrationTests.DbContexts
@@ -15,7 +15,7 @@ public class ClientDbContextTests : IntegrationTest fixture) : base(fixture)
{
- foreach (var options in TestDatabaseProviders.SelectMany(x => x.Select(y => (DbContextOptions)y)).ToList())
+ foreach (var options in TestDatabaseProviders.SelectMany(x => x.Select(y => (DbContextOptions) y)).ToList())
{
using (var context = new ConfigurationDbContext(options, StoreOptions))
context.Database.EnsureCreated();
diff --git a/src/EntityFramework.Storage/test/IntegrationTests/IdentityServer4.EntityFramework.IntegrationTests.csproj b/src/EntityFramework.Storage/test/IntegrationTests/IdentityServer4.EntityFramework.IntegrationTests.csproj
index 29fd3391b..7d68b3479 100644
--- a/src/EntityFramework.Storage/test/IntegrationTests/IdentityServer4.EntityFramework.IntegrationTests.csproj
+++ b/src/EntityFramework.Storage/test/IntegrationTests/IdentityServer4.EntityFramework.IntegrationTests.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
../../../../key.snk
true
@@ -11,7 +11,7 @@
-
+
@@ -19,12 +19,12 @@
-
+
-
+
diff --git a/src/EntityFramework.Storage/test/IntegrationTests/IntegrationTest.cs b/src/EntityFramework.Storage/test/IntegrationTests/IntegrationTest.cs
index aee3156d8..0e3c29b9e 100644
--- a/src/EntityFramework.Storage/test/IntegrationTests/IntegrationTest.cs
+++ b/src/EntityFramework.Storage/test/IntegrationTests/IntegrationTest.cs
@@ -1,8 +1,9 @@
-using System;
-using System.Linq;
-using System.Runtime.InteropServices;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
using Xunit;
namespace IdentityServer4.EntityFramework.IntegrationTests
@@ -17,7 +18,7 @@ namespace IdentityServer4.EntityFramework.IntegrationTests
public class IntegrationTest : IClassFixture>
where TDbContext : DbContext
{
- public static readonly TheoryData> TestDatabaseProviders;
+ public static readonly IReadOnlyCollection
-
+
\ No newline at end of file
diff --git a/src/EntityFramework/build/build.csproj b/src/EntityFramework/build/build.csproj
index d1be6f152..120e3ac37 100644
--- a/src/EntityFramework/build/build.csproj
+++ b/src/EntityFramework/build/build.csproj
@@ -2,7 +2,7 @@
Exe
- net7.0
+ net9.0
@@ -13,5 +13,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/src/EntityFramework/host/Host.csproj b/src/EntityFramework/host/Host.csproj
index 9a8fff68f..21715c1d6 100644
--- a/src/EntityFramework/host/Host.csproj
+++ b/src/EntityFramework/host/Host.csproj
@@ -1,13 +1,13 @@
- net7.0
+ net9.0
-
-
-
-
+
+
+
+
@@ -17,4 +17,4 @@
-
+
\ No newline at end of file
diff --git a/src/EntityFramework/host/Quickstart/Account/AccountController.cs b/src/EntityFramework/host/Quickstart/Account/AccountController.cs
index 2d51c3cd0..11b891951 100644
--- a/src/EntityFramework/host/Quickstart/Account/AccountController.cs
+++ b/src/EntityFramework/host/Quickstart/Account/AccountController.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4;
using IdentityServer4.Events;
using IdentityServer4.Extensions;
@@ -125,7 +125,8 @@ public async Task Login(LoginInputModel model, string button)
IsPersistent = true,
ExpiresUtc = DateTimeOffset.UtcNow.Add(AccountOptions.RememberMeLoginDuration)
};
- };
+ }
+ ;
// issue authentication cookie with subject ID and username
var isuser = new IdentityServerUser(user.SubjectId)
@@ -164,7 +165,7 @@ public async Task Login(LoginInputModel model, string button)
}
}
- await _events.RaiseAsync(new UserLoginFailureEvent(model.Username, "invalid credentials", clientId:context?.Client.ClientId));
+ await _events.RaiseAsync(new UserLoginFailureEvent(model.Username, "invalid credentials", clientId: context?.Client.ClientId));
ModelState.AddModelError(string.Empty, AccountOptions.InvalidCredentialsErrorMessage);
}
@@ -173,7 +174,7 @@ public async Task Login(LoginInputModel model, string button)
return View(vm);
}
-
+
///
/// Show logout page
///
diff --git a/src/EntityFramework/host/Quickstart/Account/ExternalController.cs b/src/EntityFramework/host/Quickstart/Account/ExternalController.cs
index 1a7479ea1..4c50816a3 100644
--- a/src/EntityFramework/host/Quickstart/Account/ExternalController.cs
+++ b/src/EntityFramework/host/Quickstart/Account/ExternalController.cs
@@ -1,4 +1,4 @@
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4;
using IdentityServer4.Events;
using IdentityServer4.Services;
@@ -58,20 +58,20 @@ public IActionResult Challenge(string scheme, string returnUrl)
// user might have clicked on a malicious link - should be logged
throw new Exception("invalid return URL");
}
-
+
// start challenge and roundtrip the return URL and scheme
var props = new AuthenticationProperties
{
- RedirectUri = Url.Action(nameof(Callback)),
+ RedirectUri = Url.Action(nameof(Callback)),
Items =
{
- { "returnUrl", returnUrl },
+ { "returnUrl", returnUrl },
{ "scheme", scheme },
}
};
return Challenge(props, scheme);
-
+
}
///
@@ -109,7 +109,7 @@ public async Task Callback()
var additionalLocalClaims = new List();
var localSignInProps = new AuthenticationProperties();
ProcessLoginCallback(result, additionalLocalClaims, localSignInProps);
-
+
// issue authentication cookie for user
var isuser = new IdentityServerUser(user.SubjectId)
{
diff --git a/src/EntityFramework/host/Quickstart/Diagnostics/DiagnosticsViewModel.cs b/src/EntityFramework/host/Quickstart/Diagnostics/DiagnosticsViewModel.cs
index f43c7685b..1d4286529 100644
--- a/src/EntityFramework/host/Quickstart/Diagnostics/DiagnosticsViewModel.cs
+++ b/src/EntityFramework/host/Quickstart/Diagnostics/DiagnosticsViewModel.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using Microsoft.AspNetCore.Authentication;
using Newtonsoft.Json;
using System.Collections.Generic;
diff --git a/src/EntityFramework/host/Quickstart/TestUsers.cs b/src/EntityFramework/host/Quickstart/TestUsers.cs
index b4d2f821f..86f03ef30 100644
--- a/src/EntityFramework/host/Quickstart/TestUsers.cs
+++ b/src/EntityFramework/host/Quickstart/TestUsers.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Test;
using System.Collections.Generic;
using System.Security.Claims;
@@ -13,8 +13,8 @@ public class TestUsers
{
public static List Users = new List
{
- new TestUser{SubjectId = "818727", Username = "alice", Password = "alice",
- Claims =
+ new TestUser{SubjectId = "818727", Username = "alice", Password = "alice",
+ Claims =
{
new Claim(JwtClaimTypes.Name, "Alice Smith"),
new Claim(JwtClaimTypes.GivenName, "Alice"),
@@ -25,8 +25,8 @@ public class TestUsers
new Claim(JwtClaimTypes.Address, @"{ 'street_address': 'One Hacker Way', 'locality': 'Heidelberg', 'postal_code': 69118, 'country': 'Germany' }", IdentityServer4.IdentityServerConstants.ClaimValueTypes.Json)
}
},
- new TestUser{SubjectId = "88421113", Username = "bob", Password = "bob",
- Claims =
+ new TestUser{SubjectId = "88421113", Username = "bob", Password = "bob",
+ Claims =
{
new Claim(JwtClaimTypes.Name, "Bob Smith"),
new Claim(JwtClaimTypes.GivenName, "Bob"),
diff --git a/src/EntityFramework/migrations/SqlServer/Configuration/Resources.cs b/src/EntityFramework/migrations/SqlServer/Configuration/Resources.cs
index 12a33bbf4..2c136d4af 100644
--- a/src/EntityFramework/migrations/SqlServer/Configuration/Resources.cs
+++ b/src/EntityFramework/migrations/SqlServer/Configuration/Resources.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Models;
using System.Collections.Generic;
using static IdentityServer4.IdentityServerConstants;
@@ -49,7 +49,7 @@ public class Resources
};
// API resources are more formal representation of a resource with processing rules and their scopes (if any)
- public static readonly IEnumerable ApiResources =
+ public static readonly IEnumerable ApiResources =
new[]
{
new ApiResource("resource1", "Resource 1")
diff --git a/src/EntityFramework/migrations/SqlServer/SqlServer.csproj b/src/EntityFramework/migrations/SqlServer/SqlServer.csproj
index 5ab278b59..5f2229af8 100644
--- a/src/EntityFramework/migrations/SqlServer/SqlServer.csproj
+++ b/src/EntityFramework/migrations/SqlServer/SqlServer.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
@@ -10,4 +10,4 @@
-
+
\ No newline at end of file
diff --git a/src/EntityFramework/src/IdentityServer4.EntityFramework.csproj b/src/EntityFramework/src/IdentityServer4.EntityFramework.csproj
index 8e39ed552..f4509e2cb 100644
--- a/src/EntityFramework/src/IdentityServer4.EntityFramework.csproj
+++ b/src/EntityFramework/src/IdentityServer4.EntityFramework.csproj
@@ -2,7 +2,7 @@
Cnblogs.IdentityServer4.EntityFramework
- net7.0
+ net9.0
EntityFramework persistence layer for IdentityServer4
Brock Allen;Dominick Baier;Scott Brady
@@ -13,10 +13,11 @@
Apache-2.0
https://github.com/cnblogs/IdentityServer4/releases
true
-
+
true
true
- $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
+
+ $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
../../../key.snk
true
@@ -35,7 +36,7 @@
-
+
\ No newline at end of file
diff --git a/src/EntityFramework/test/IdentityServer4.EntityFramework.Tests/IdentityServer4.EntityFramework.Tests.csproj b/src/EntityFramework/test/IdentityServer4.EntityFramework.Tests/IdentityServer4.EntityFramework.Tests.csproj
index 5e45ae7b8..85176c081 100644
--- a/src/EntityFramework/test/IdentityServer4.EntityFramework.Tests/IdentityServer4.EntityFramework.Tests.csproj
+++ b/src/EntityFramework/test/IdentityServer4.EntityFramework.Tests/IdentityServer4.EntityFramework.Tests.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
false
@@ -11,7 +11,7 @@
-
+
@@ -20,7 +20,6 @@
-
-
-
+
+
\ No newline at end of file
diff --git a/src/EntityFramework/test/IdentityServer4.EntityFramework.Tests/IntegrationTest.cs b/src/EntityFramework/test/IdentityServer4.EntityFramework.Tests/IntegrationTest.cs
index 1ab6a7ace..ed0e4ada9 100644
--- a/src/EntityFramework/test/IdentityServer4.EntityFramework.Tests/IntegrationTest.cs
+++ b/src/EntityFramework/test/IdentityServer4.EntityFramework.Tests/IntegrationTest.cs
@@ -1,8 +1,9 @@
-using System;
-using System.Linq;
-using System.Runtime.InteropServices;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
using Xunit;
namespace IdentityServer4.EntityFramework.IntegrationTests
@@ -17,7 +18,7 @@ namespace IdentityServer4.EntityFramework.IntegrationTests
public class IntegrationTest : IClassFixture>
where TDbContext : DbContext
{
- public static readonly TheoryData> TestDatabaseProviders;
+ public static readonly IReadOnlyCollection
protected ISystemClock Clock { get; }
-
+
///
/// The IdentityServerTools used to create and the JWT.
///
diff --git a/src/IdentityServer4/src/Services/Default/DefaultClaimsService.cs b/src/IdentityServer4/src/Services/Default/DefaultClaimsService.cs
index 9ce46ab76..45bf2beeb 100644
--- a/src/IdentityServer4/src/Services/Default/DefaultClaimsService.cs
+++ b/src/IdentityServer4/src/Services/Default/DefaultClaimsService.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Extensions;
using IdentityServer4.Models;
using IdentityServer4.Validation;
@@ -179,7 +179,7 @@ public virtual async Task> GetAccessTokenClaimsAsync(ClaimsPr
}
}
- foreach(var scope in resourceResult.Resources.ApiScopes)
+ foreach (var scope in resourceResult.Resources.ApiScopes)
{
// add claims configured on scopes
if (scope.UserClaims != null)
diff --git a/src/IdentityServer4/src/Services/Default/DefaultHandleGenerationService.cs b/src/IdentityServer4/src/Services/Default/DefaultHandleGenerationService.cs
index ec81caf42..207734235 100644
--- a/src/IdentityServer4/src/Services/Default/DefaultHandleGenerationService.cs
+++ b/src/IdentityServer4/src/Services/Default/DefaultHandleGenerationService.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using System.Threading.Tasks;
namespace IdentityServer4.Services
diff --git a/src/IdentityServer4/src/Services/Default/DefaultJwtRequestUriHttpClient.cs b/src/IdentityServer4/src/Services/Default/DefaultJwtRequestUriHttpClient.cs
index e816f1b35..90571fa8f 100644
--- a/src/IdentityServer4/src/Services/Default/DefaultJwtRequestUriHttpClient.cs
+++ b/src/IdentityServer4/src/Services/Default/DefaultJwtRequestUriHttpClient.cs
@@ -7,7 +7,7 @@
using Microsoft.Extensions.Logging;
using System.Net.Http;
using System.Threading.Tasks;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Configuration;
namespace IdentityServer4.Services
@@ -55,11 +55,11 @@ public async Task GetJwtAsync(string url, Client client)
}
_logger.LogDebug("Success http response from jwt url {url}", url);
-
+
var json = await response.Content.ReadAsStringAsync();
return json;
}
-
+
_logger.LogError("Invalid http status code {status} from jwt url {url}", response.StatusCode, url);
return null;
}
diff --git a/src/IdentityServer4/src/Services/Default/DefaultRefreshTokenService.cs b/src/IdentityServer4/src/Services/Default/DefaultRefreshTokenService.cs
index af2c2c33c..cf71e956c 100644
--- a/src/IdentityServer4/src/Services/Default/DefaultRefreshTokenService.cs
+++ b/src/IdentityServer4/src/Services/Default/DefaultRefreshTokenService.cs
@@ -8,7 +8,7 @@
using Microsoft.Extensions.Logging;
using System.Security.Claims;
using System.Threading.Tasks;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Logging.Models;
using IdentityServer4.Validation;
using Microsoft.AspNetCore.Authentication;
@@ -68,7 +68,8 @@ public virtual async Task ValidateRefreshTokenAsync(strin
{
var invalidGrant = new TokenValidationResult
{
- IsError = true, Error = OidcConstants.TokenErrors.InvalidGrant
+ IsError = true,
+ Error = OidcConstants.TokenErrors.InvalidGrant
};
Logger.LogTrace("Start refresh token validation");
@@ -91,7 +92,7 @@ public virtual async Task ValidateRefreshTokenAsync(strin
Logger.LogWarning("Refresh token has expired.");
return invalidGrant;
}
-
+
/////////////////////////////////////////////
// check if client belongs to requested refresh token
/////////////////////////////////////////////
@@ -109,7 +110,7 @@ public virtual async Task ValidateRefreshTokenAsync(strin
Logger.LogError("{clientId} does not have access to offline_access scope anymore", client.ClientId);
return invalidGrant;
}
-
+
/////////////////////////////////////////////
// check if refresh token has been consumed
/////////////////////////////////////////////
@@ -121,7 +122,7 @@ public virtual async Task ValidateRefreshTokenAsync(strin
return invalidGrant;
}
}
-
+
/////////////////////////////////////////////
// make sure user is enabled
/////////////////////////////////////////////
@@ -137,11 +138,11 @@ public virtual async Task ValidateRefreshTokenAsync(strin
Logger.LogError("{subjectId} has been disabled", refreshToken.Subject.GetSubjectId());
return invalidGrant;
}
-
+
return new TokenValidationResult
{
- IsError = false,
- RefreshToken = refreshToken,
+ IsError = false,
+ RefreshToken = refreshToken,
Client = client
};
}
@@ -198,7 +199,9 @@ public virtual async Task CreateRefreshTokenAsync(ClaimsPrincipal subjec
var refreshToken = new RefreshToken
{
- CreationTime = Clock.UtcNow.UtcDateTime, Lifetime = lifetime, AccessToken = accessToken
+ CreationTime = Clock.UtcNow.UtcDateTime,
+ Lifetime = lifetime,
+ AccessToken = accessToken
};
var handle = await RefreshTokenStore.StoreRefreshTokenAsync(refreshToken);
diff --git a/src/IdentityServer4/src/Services/Default/DefaultTokenCreationService.cs b/src/IdentityServer4/src/Services/Default/DefaultTokenCreationService.cs
index 8ac48388c..65c67789c 100644
--- a/src/IdentityServer4/src/Services/Default/DefaultTokenCreationService.cs
+++ b/src/IdentityServer4/src/Services/Default/DefaultTokenCreationService.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Configuration;
using IdentityServer4.Extensions;
using IdentityServer4.Models;
diff --git a/src/IdentityServer4/src/Services/Default/DefaultTokenService.cs b/src/IdentityServer4/src/Services/Default/DefaultTokenService.cs
index 628f571b9..0af4cee37 100644
--- a/src/IdentityServer4/src/Services/Default/DefaultTokenService.cs
+++ b/src/IdentityServer4/src/Services/Default/DefaultTokenService.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Configuration;
using IdentityServer4.Extensions;
using IdentityServer4.Models;
@@ -201,7 +201,7 @@ public virtual async Task CreateAccessTokenAsync(TokenCreationRequest req
{
claims.Add(new Claim(JwtClaimTypes.SessionId, request.ValidatedRequest.SessionId));
}
-
+
// iat claim as required by JWT profile
claims.Add(new Claim(JwtClaimTypes.IssuedAt, Clock.UtcNow.ToUnixTimeSeconds().ToString(),
ClaimValueTypes.Integer64));
@@ -246,7 +246,7 @@ public virtual async Task CreateAccessTokenAsync(TokenCreationRequest req
}
}
}
-
+
return token;
}
diff --git a/src/IdentityServer4/src/Services/Default/DefaultUserSession.cs b/src/IdentityServer4/src/Services/Default/DefaultUserSession.cs
index ea92aa28b..3ae8cf42e 100644
--- a/src/IdentityServer4/src/Services/Default/DefaultUserSession.cs
+++ b/src/IdentityServer4/src/Services/Default/DefaultUserSession.cs
@@ -3,7 +3,7 @@
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Configuration;
using IdentityServer4.Extensions;
using Microsoft.AspNetCore.Http;
@@ -58,7 +58,7 @@ public class DefaultUserSession : IUserSession
/// The name of the check session cookie.
///
protected string CheckSessionCookieName => Options.Authentication.CheckSessionCookieName;
-
+
///
/// Gets the domain of the check session cookie.
///
diff --git a/src/IdentityServer4/src/Services/Default/LogoutNotificationService.cs b/src/IdentityServer4/src/Services/Default/LogoutNotificationService.cs
index a922fceb2..970c3fe1d 100644
--- a/src/IdentityServer4/src/Services/Default/LogoutNotificationService.cs
+++ b/src/IdentityServer4/src/Services/Default/LogoutNotificationService.cs
@@ -1,7 +1,7 @@
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Extensions;
using IdentityServer4.Models;
using IdentityServer4.Stores;
@@ -28,7 +28,7 @@ public class LogoutNotificationService : ILogoutNotificationService
///
public LogoutNotificationService(
IClientStore clientStore,
- IHttpContextAccessor httpContextAccessor,
+ IHttpContextAccessor httpContextAccessor,
ILogger logger)
{
_clientStore = clientStore;
diff --git a/src/IdentityServer4/src/Stores/Default/DistributedCacheAuthorizationParametersMessageStore.cs b/src/IdentityServer4/src/Stores/Default/DistributedCacheAuthorizationParametersMessageStore.cs
index 25d1a478f..bec285896 100644
--- a/src/IdentityServer4/src/Stores/Default/DistributedCacheAuthorizationParametersMessageStore.cs
+++ b/src/IdentityServer4/src/Stores/Default/DistributedCacheAuthorizationParametersMessageStore.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Models;
using IdentityServer4.Services;
using Microsoft.Extensions.Caching.Distributed;
@@ -27,7 +27,7 @@ public DistributedCacheAuthorizationParametersMessageStore(IDistributedCache dis
}
private string CacheKeyPrefix => "DistributedCacheAuthorizationParametersMessageStore";
-
+
///
public async Task WriteAsync(Message> message)
{
@@ -39,7 +39,7 @@ public async Task WriteAsync(Message> mess
var key = await _handleGenerationService.GenerateAsync();
var cacheKey = $"{CacheKeyPrefix}-{key}";
-
+
var json = ObjectSerializer.ToString(message);
var options = new DistributedCacheEntryOptions();
diff --git a/src/IdentityServer4/src/Stores/Default/ProtectedDataMessageStore.cs b/src/IdentityServer4/src/Stores/Default/ProtectedDataMessageStore.cs
index 0fd5ad77a..5fdd88326 100644
--- a/src/IdentityServer4/src/Stores/Default/ProtectedDataMessageStore.cs
+++ b/src/IdentityServer4/src/Stores/Default/ProtectedDataMessageStore.cs
@@ -5,7 +5,7 @@
using IdentityServer4.Models;
using System.Threading.Tasks;
using Microsoft.AspNetCore.DataProtection;
-using IdentityModel;
+using Duende.IdentityModel;
using System.Text;
using System;
using Microsoft.Extensions.Logging;
@@ -55,7 +55,7 @@ public virtual Task> ReadAsync(string value)
var json = Encoding.UTF8.GetString(bytes);
result = ObjectSerializer.FromString>(json);
}
- catch(Exception ex)
+ catch (Exception ex)
{
Logger.LogError(ex, "Exception reading protected message");
}
@@ -76,7 +76,7 @@ public virtual Task WriteAsync(Message message)
bytes = Protector.Protect(bytes);
value = Base64Url.Encode(bytes);
}
- catch(Exception ex)
+ catch (Exception ex)
{
Logger.LogError(ex, "Exception writing protected message");
}
diff --git a/src/IdentityServer4/src/Test/TestUser.cs b/src/IdentityServer4/src/Test/TestUser.cs
index 09cb8c02d..e6a5c7ad6 100644
--- a/src/IdentityServer4/src/Test/TestUser.cs
+++ b/src/IdentityServer4/src/Test/TestUser.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using System.Collections.Generic;
using System.Security.Claims;
diff --git a/src/IdentityServer4/src/Test/TestUserResourceOwnerPasswordValidator.cs b/src/IdentityServer4/src/Test/TestUserResourceOwnerPasswordValidator.cs
index 81a7f5eda..5f978ed06 100644
--- a/src/IdentityServer4/src/Test/TestUserResourceOwnerPasswordValidator.cs
+++ b/src/IdentityServer4/src/Test/TestUserResourceOwnerPasswordValidator.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Validation;
using System.Threading.Tasks;
using System;
@@ -41,8 +41,8 @@ public Task ValidateAsync(ResourceOwnerPasswordValidationContext context)
{
var user = _users.FindByUsername(context.UserName);
context.Result = new GrantValidationResult(
- user.SubjectId ?? throw new ArgumentException("Subject ID not set", nameof(user.SubjectId)),
- OidcConstants.AuthenticationMethods.Password, _clock.UtcNow.UtcDateTime,
+ user.SubjectId ?? throw new ArgumentException("Subject ID not set", nameof(user.SubjectId)),
+ OidcConstants.AuthenticationMethods.Password, _clock.UtcNow.UtcDateTime,
user.Claims);
}
diff --git a/src/IdentityServer4/src/Test/TestUserStore.cs b/src/IdentityServer4/src/Test/TestUserStore.cs
index 5084eb12a..3122981bc 100644
--- a/src/IdentityServer4/src/Test/TestUserStore.cs
+++ b/src/IdentityServer4/src/Test/TestUserStore.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
@@ -36,17 +36,17 @@ public TestUserStore(List users)
public bool ValidateCredentials(string username, string password)
{
var user = FindByUsername(username);
-
+
if (user != null)
{
if (string.IsNullOrWhiteSpace(user.Password) && string.IsNullOrWhiteSpace(password))
{
return true;
}
-
+
return user.Password.Equals(password);
}
-
+
return false;
}
diff --git a/src/IdentityServer4/src/Validation/Default/AuthorizeRequestValidator.cs b/src/IdentityServer4/src/Validation/Default/AuthorizeRequestValidator.cs
index 6fa4bb721..2bd64708d 100644
--- a/src/IdentityServer4/src/Validation/Default/AuthorizeRequestValidator.cs
+++ b/src/IdentityServer4/src/Validation/Default/AuthorizeRequestValidator.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Configuration;
using IdentityServer4.Extensions;
using IdentityServer4.Models;
@@ -65,7 +65,7 @@ public async Task ValidateAsync(NameValueColle
Subject = subject ?? Principal.Anonymous,
Raw = parameters ?? throw new ArgumentNullException(nameof(parameters))
};
-
+
// load client_id
// client_id must always be present on the request
var loadClientResult = await LoadClientAsync(request);
@@ -272,9 +272,9 @@ private async Task ValidateRequestObjectAsync(
foreach (var key in jwtRequestValidationResult.Payload.Keys)
{
if (ignoreKeys.Contains(key)) continue;
-
+
var value = jwtRequestValidationResult.Payload[key];
-
+
var qsValue = request.Raw.Get(key);
if (qsValue != null)
{
diff --git a/src/IdentityServer4/src/Validation/Default/BasicAuthenticationSecretParser.cs b/src/IdentityServer4/src/Validation/Default/BasicAuthenticationSecretParser.cs
index 5d2297083..e19a8e3c5 100644
--- a/src/IdentityServer4/src/Validation/Default/BasicAuthenticationSecretParser.cs
+++ b/src/IdentityServer4/src/Validation/Default/BasicAuthenticationSecretParser.cs
@@ -10,7 +10,7 @@
using System.Text;
using System.Threading.Tasks;
using System.Linq;
-using IdentityModel;
+using Duende.IdentityModel;
using Microsoft.AspNetCore.Http;
namespace IdentityServer4.Validation
diff --git a/src/IdentityServer4/src/Validation/Default/BearerTokenUsageValidator.cs b/src/IdentityServer4/src/Validation/Default/BearerTokenUsageValidator.cs
index 040194b3f..21551ac87 100644
--- a/src/IdentityServer4/src/Validation/Default/BearerTokenUsageValidator.cs
+++ b/src/IdentityServer4/src/Validation/Default/BearerTokenUsageValidator.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Extensions;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
diff --git a/src/IdentityServer4/src/Validation/Default/DeviceAuthorizationRequestValidator.cs b/src/IdentityServer4/src/Validation/Default/DeviceAuthorizationRequestValidator.cs
index 089a15666..99e8a6b56 100644
--- a/src/IdentityServer4/src/Validation/Default/DeviceAuthorizationRequestValidator.cs
+++ b/src/IdentityServer4/src/Validation/Default/DeviceAuthorizationRequestValidator.cs
@@ -7,7 +7,7 @@
using System.Collections.Specialized;
using System.Linq;
using System.Threading.Tasks;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Configuration;
using IdentityServer4.Extensions;
using IdentityServer4.Logging;
@@ -21,7 +21,7 @@ internal class DeviceAuthorizationRequestValidator : IDeviceAuthorizationRequest
private readonly IdentityServerOptions _options;
private readonly IResourceValidator _resourceValidator;
private readonly ILogger _logger;
-
+
public DeviceAuthorizationRequestValidator(
IdentityServerOptions options,
IResourceValidator resourceValidator,
@@ -152,8 +152,9 @@ private async Task ValidateScopeAsyn
//////////////////////////////////////////////////////////
// check if scopes are valid/supported
//////////////////////////////////////////////////////////
- var validatedResources = await _resourceValidator.ValidateRequestedResourcesAsync(new ResourceValidationRequest{
- Client = request.Client,
+ var validatedResources = await _resourceValidator.ValidateRequestedResourcesAsync(new ResourceValidationRequest
+ {
+ Client = request.Client,
Scopes = request.RequestedScopes
});
@@ -163,7 +164,7 @@ private async Task ValidateScopeAsyn
{
return Invalid(request, OidcConstants.AuthorizeErrors.InvalidScope);
}
-
+
return Invalid(request, OidcConstants.AuthorizeErrors.UnauthorizedClient, "Invalid scope");
}
@@ -174,7 +175,7 @@ private async Task ValidateScopeAsyn
}
request.ValidatedResources = validatedResources;
-
+
return Valid(request);
}
}
diff --git a/src/IdentityServer4/src/Validation/Default/DeviceCodeValidator.cs b/src/IdentityServer4/src/Validation/Default/DeviceCodeValidator.cs
index c95e70d12..c5e7cf804 100644
--- a/src/IdentityServer4/src/Validation/Default/DeviceCodeValidator.cs
+++ b/src/IdentityServer4/src/Validation/Default/DeviceCodeValidator.cs
@@ -4,7 +4,7 @@
using System.Linq;
using System.Threading.Tasks;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Extensions;
using IdentityServer4.Models;
using IdentityServer4.Services;
@@ -61,7 +61,7 @@ public async Task ValidateAsync(DeviceCodeValidationContext context)
context.Result = new TokenRequestValidationResult(context.Request, OidcConstants.TokenErrors.InvalidGrant);
return;
}
-
+
// validate client binding
if (deviceCode.ClientId != context.Request.Client.ClientId)
{
diff --git a/src/IdentityServer4/src/Validation/Default/EndSessionRequestValidator.cs b/src/IdentityServer4/src/Validation/Default/EndSessionRequestValidator.cs
index a6f2b0db0..e9cabea57 100644
--- a/src/IdentityServer4/src/Validation/Default/EndSessionRequestValidator.cs
+++ b/src/IdentityServer4/src/Validation/Default/EndSessionRequestValidator.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Extensions;
using Microsoft.Extensions.Logging;
using System.Collections.Specialized;
diff --git a/src/IdentityServer4/src/Validation/Default/HashedSharedSecretValidator.cs b/src/IdentityServer4/src/Validation/Default/HashedSharedSecretValidator.cs
index 0b2ba62cc..74f649b45 100644
--- a/src/IdentityServer4/src/Validation/Default/HashedSharedSecretValidator.cs
+++ b/src/IdentityServer4/src/Validation/Default/HashedSharedSecretValidator.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Extensions;
using IdentityServer4.Models;
using Microsoft.Extensions.Logging;
diff --git a/src/IdentityServer4/src/Validation/Default/JwtBearerClientAssertionSecretParser.cs b/src/IdentityServer4/src/Validation/Default/JwtBearerClientAssertionSecretParser.cs
index e65383c01..072657136 100644
--- a/src/IdentityServer4/src/Validation/Default/JwtBearerClientAssertionSecretParser.cs
+++ b/src/IdentityServer4/src/Validation/Default/JwtBearerClientAssertionSecretParser.cs
@@ -6,7 +6,7 @@
using System.Threading.Tasks;
using System.Linq;
using System.IdentityModel.Tokens.Jwt;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Configuration;
using IdentityServer4.Extensions;
using IdentityServer4.Models;
diff --git a/src/IdentityServer4/src/Validation/Default/JwtRequestValidator.cs b/src/IdentityServer4/src/Validation/Default/JwtRequestValidator.cs
index a2ae23fe4..4b8fb540e 100644
--- a/src/IdentityServer4/src/Validation/Default/JwtRequestValidator.cs
+++ b/src/IdentityServer4/src/Validation/Default/JwtRequestValidator.cs
@@ -7,7 +7,7 @@
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Threading.Tasks;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Configuration;
using IdentityServer4.Extensions;
using IdentityServer4.Models;
@@ -183,7 +183,7 @@ protected virtual Task ValidateJwtAsync(string jwtTokenString,
Handler.ValidateToken(jwtTokenString, tokenValidationParameters, out var token);
- return Task.FromResult((JwtSecurityToken) token);
+ return Task.FromResult((JwtSecurityToken)token);
}
///
diff --git a/src/IdentityServer4/src/Validation/Default/PlainTextSharedSecretValidator.cs b/src/IdentityServer4/src/Validation/Default/PlainTextSharedSecretValidator.cs
index bac03ee7b..5a1fb2b82 100644
--- a/src/IdentityServer4/src/Validation/Default/PlainTextSharedSecretValidator.cs
+++ b/src/IdentityServer4/src/Validation/Default/PlainTextSharedSecretValidator.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Extensions;
using IdentityServer4.Models;
using Microsoft.Extensions.Logging;
diff --git a/src/IdentityServer4/src/Validation/Default/PostBodySecretParser.cs b/src/IdentityServer4/src/Validation/Default/PostBodySecretParser.cs
index 799e93c7a..9c1f2aafc 100644
--- a/src/IdentityServer4/src/Validation/Default/PostBodySecretParser.cs
+++ b/src/IdentityServer4/src/Validation/Default/PostBodySecretParser.cs
@@ -8,7 +8,7 @@
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
using System.Linq;
-using IdentityModel;
+using Duende.IdentityModel;
using Microsoft.AspNetCore.Http;
namespace IdentityServer4.Validation
diff --git a/src/IdentityServer4/src/Validation/Default/TokenRequestValidator.cs b/src/IdentityServer4/src/Validation/Default/TokenRequestValidator.cs
index ecdb1de98..67445e8ca 100644
--- a/src/IdentityServer4/src/Validation/Default/TokenRequestValidator.cs
+++ b/src/IdentityServer4/src/Validation/Default/TokenRequestValidator.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Configuration;
using IdentityServer4.Events;
using IdentityServer4.Extensions;
@@ -57,19 +57,19 @@ internal class TokenRequestValidator : ITokenRequestValidator
/// The events.
/// The clock.
/// The logger.
- public TokenRequestValidator(IdentityServerOptions options,
- IAuthorizationCodeStore authorizationCodeStore,
- IResourceOwnerPasswordValidator resourceOwnerValidator,
- IProfileService profile,
- IDeviceCodeValidator deviceCodeValidator,
- ExtensionGrantValidator extensionGrantValidator,
+ public TokenRequestValidator(IdentityServerOptions options,
+ IAuthorizationCodeStore authorizationCodeStore,
+ IResourceOwnerPasswordValidator resourceOwnerValidator,
+ IProfileService profile,
+ IDeviceCodeValidator deviceCodeValidator,
+ ExtensionGrantValidator extensionGrantValidator,
ICustomTokenRequestValidator customRequestValidator,
IResourceValidator resourceValidator,
IResourceStore resourceStore,
- ITokenValidator tokenValidator,
+ ITokenValidator tokenValidator,
IRefreshTokenService refreshTokenService,
- IEventService events,
- ISystemClock clock,
+ IEventService events,
+ ISystemClock clock,
ILogger logger)
{
_logger = logger;
@@ -235,7 +235,7 @@ private async Task ValidateAuthorizationCodeReques
LogError("Invalid authorization code", new { code });
return Invalid(OidcConstants.TokenErrors.InvalidGrant);
}
-
+
/////////////////////////////////////////////
// validate client binding
/////////////////////////////////////////////
@@ -527,7 +527,7 @@ private async Task ValidateRefreshTokenRequestAsyn
_logger.LogDebug("Validation of refresh token request success");
// todo: more logging - similar to TokenValidator before
-
+
return Valid();
}
@@ -711,7 +711,8 @@ private async Task ValidateRequestedScopesAsync(NameValueCollection parame
return false;
}
- var resourceValidationResult = await _resourceValidator.ValidateRequestedResourcesAsync(new ResourceValidationRequest {
+ var resourceValidationResult = await _resourceValidator.ValidateRequestedResourcesAsync(new ResourceValidationRequest
+ {
Client = _validatedRequest.Client,
Scopes = requestedScopes
});
@@ -732,7 +733,7 @@ private async Task ValidateRequestedScopesAsync(NameValueCollection parame
_validatedRequest.RequestedScopes = requestedScopes;
_validatedRequest.ValidatedResources = resourceValidationResult;
-
+
return true;
}
diff --git a/src/IdentityServer4/src/Validation/Default/TokenRevocationRequestValidator.cs b/src/IdentityServer4/src/Validation/Default/TokenRevocationRequestValidator.cs
index 1d3ed007c..cb42e8e35 100644
--- a/src/IdentityServer4/src/Validation/Default/TokenRevocationRequestValidator.cs
+++ b/src/IdentityServer4/src/Validation/Default/TokenRevocationRequestValidator.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Extensions;
using IdentityServer4.Models;
using Microsoft.Extensions.Logging;
diff --git a/src/IdentityServer4/src/Validation/Default/TokenValidator.cs b/src/IdentityServer4/src/Validation/Default/TokenValidator.cs
index 342693557..f04618781 100644
--- a/src/IdentityServer4/src/Validation/Default/TokenValidator.cs
+++ b/src/IdentityServer4/src/Validation/Default/TokenValidator.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Extensions;
using IdentityServer4.Models;
using IdentityServer4.Services;
@@ -286,7 +286,7 @@ private async Task ValidateJwtAsync(string jwt, IEnumerab
}
}
-
+
// if access token contains an ID, log it
var jwtId = id.FindFirst(JwtClaimTypes.JwtId);
if (jwtId != null)
@@ -307,7 +307,7 @@ private async Task ValidateJwtAsync(string jwt, IEnumerab
}
var claims = id.Claims.ToList();
-
+
// check the scope format (array vs space delimited string)
var scopes = claims.Where(c => c.Type == JwtClaimTypes.Scope).ToArray();
if (scopes.Any())
@@ -317,7 +317,7 @@ private async Task ValidateJwtAsync(string jwt, IEnumerab
if (scope.Value.Contains(" "))
{
claims.Remove(scope);
-
+
var values = scope.Value.Split(' ', StringSplitOptions.RemoveEmptyEntries);
foreach (var value in values)
{
diff --git a/src/IdentityServer4/src/Validation/Default/UserInfoRequestValidator.cs b/src/IdentityServer4/src/Validation/Default/UserInfoRequestValidator.cs
index f613413b5..db27bc7ef 100644
--- a/src/IdentityServer4/src/Validation/Default/UserInfoRequestValidator.cs
+++ b/src/IdentityServer4/src/Validation/Default/UserInfoRequestValidator.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Extensions;
using IdentityServer4.Models;
using IdentityServer4.Services;
@@ -29,7 +29,7 @@ internal class UserInfoRequestValidator : IUserInfoRequestValidator
/// The profile service
/// The logger.
public UserInfoRequestValidator(
- ITokenValidator tokenValidator,
+ ITokenValidator tokenValidator,
IProfileService profile,
ILogger logger)
{
diff --git a/src/IdentityServer4/src/Validation/Models/GrantValidationResult.cs b/src/IdentityServer4/src/Validation/Models/GrantValidationResult.cs
index f4f6a1cb4..e4b48b5d2 100644
--- a/src/IdentityServer4/src/Validation/Models/GrantValidationResult.cs
+++ b/src/IdentityServer4/src/Validation/Models/GrantValidationResult.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Extensions;
using IdentityServer4.Models;
using System.Collections.Generic;
diff --git a/src/IdentityServer4/src/Validation/Models/ValidatedAuthorizeRequest.cs b/src/IdentityServer4/src/Validation/Models/ValidatedAuthorizeRequest.cs
index 441cb0d99..649118771 100644
--- a/src/IdentityServer4/src/Validation/Models/ValidatedAuthorizeRequest.cs
+++ b/src/IdentityServer4/src/Validation/Models/ValidatedAuthorizeRequest.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using System.Collections.Generic;
using System.Linq;
@@ -181,7 +181,7 @@ public class ValidatedAuthorizeRequest : ValidatedRequest
/// The request object
///
public string RequestObject { get; set; }
-
+
///
/// Gets a value indicating whether an access token was requested.
///
diff --git a/src/IdentityServer4/src/Validation/Models/ValidatedRequest.cs b/src/IdentityServer4/src/Validation/Models/ValidatedRequest.cs
index 235ed9178..69bbd0298 100644
--- a/src/IdentityServer4/src/Validation/Models/ValidatedRequest.cs
+++ b/src/IdentityServer4/src/Validation/Models/ValidatedRequest.cs
@@ -7,7 +7,7 @@
using IdentityServer4.Models;
using System.Collections.Specialized;
using System.Security.Claims;
-using IdentityModel;
+using Duende.IdentityModel;
using System.Linq;
using System;
@@ -75,7 +75,7 @@ public class ValidatedRequest
/// The session identifier.
///
public string SessionId { get; set; }
-
+
///
/// Gets or sets the identity server options.
///
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/ClientAssertionClient.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/ClientAssertionClient.cs
index 9cd8d2003..56765deb2 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/ClientAssertionClient.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/ClientAssertionClient.cs
@@ -2,17 +2,9 @@
// 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.IdentityModel.Tokens.Jwt;
-using System.Linq;
-using System.Net.Http;
-using System.Security.Claims;
-using System.Text;
-using System.Threading.Tasks;
+using Duende.IdentityModel;
+using Duende.IdentityModel.Client;
using FluentAssertions;
-using IdentityModel;
-using IdentityModel.Client;
using IdentityServer.IntegrationTests.Clients.Setup;
using IdentityServer.IntegrationTests.Common;
using Microsoft.AspNetCore.Hosting;
@@ -20,6 +12,14 @@
using Microsoft.IdentityModel.Tokens;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.IdentityModel.Tokens.Jwt;
+using System.Linq;
+using System.Net.Http;
+using System.Security.Claims;
+using System.Text;
+using System.Threading.Tasks;
using Xunit;
namespace IdentityServer.IntegrationTests.Clients
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/ClientCredentialsAndResourceOwnerClient.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/ClientCredentialsAndResourceOwnerClient.cs
index 7a4d2a30c..c9c777f7b 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/ClientCredentialsAndResourceOwnerClient.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/ClientCredentialsAndResourceOwnerClient.cs
@@ -2,13 +2,13 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using System.Net.Http;
-using System.Threading.Tasks;
+using Duende.IdentityModel.Client;
using FluentAssertions;
-using IdentityModel.Client;
using IdentityServer.IntegrationTests.Clients.Setup;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
+using System.Net.Http;
+using System.Threading.Tasks;
using Xunit;
namespace IdentityServer.IntegrationTests.Clients
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/ClientCredentialsClient.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/ClientCredentialsClient.cs
index 95fa0f445..e4a12d2b6 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/ClientCredentialsClient.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/ClientCredentialsClient.cs
@@ -2,20 +2,20 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using System.Collections.Generic;
-using System.Linq;
-using System.Net;
-using System.Net.Http;
-using System.Text;
-using System.Threading.Tasks;
+using Duende.IdentityModel;
+using Duende.IdentityModel.Client;
using FluentAssertions;
-using IdentityModel;
-using IdentityModel.Client;
using IdentityServer.IntegrationTests.Clients.Setup;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Text;
+using System.Threading.Tasks;
using Xunit;
namespace IdentityServer.IntegrationTests.Clients
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/CustomTokenRequestValidatorClient.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/CustomTokenRequestValidatorClient.cs
index 5fe13da5a..3989e56a5 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/CustomTokenRequestValidatorClient.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/CustomTokenRequestValidatorClient.cs
@@ -1,15 +1,15 @@
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using System.Collections.Generic;
-using System.Net.Http;
-using System.Threading.Tasks;
+using Duende.IdentityModel.Client;
using FluentAssertions;
-using IdentityModel.Client;
using IdentityServer.IntegrationTests.Clients.Setup;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
using Newtonsoft.Json;
+using System.Collections.Generic;
+using System.Net.Http;
+using System.Threading.Tasks;
using Xunit;
namespace IdentityServer.IntegrationTests.Clients
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/CustomTokenResponseClients.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/CustomTokenResponseClients.cs
index 7ef382300..acb78030f 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/CustomTokenResponseClients.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/CustomTokenResponseClients.cs
@@ -2,21 +2,20 @@
// 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;
-using System.Net.Http;
-using System.Text;
-using System.Text.Json;
-using System.Threading.Tasks;
+using Duende.IdentityModel;
+using Duende.IdentityModel.Client;
using FluentAssertions;
-using IdentityModel;
-using IdentityModel.Client;
using IdentityServer.IntegrationTests.Clients.Setup;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http;
+using System.Text;
+using System.Threading.Tasks;
using Xunit;
namespace IdentityServer.IntegrationTests.Clients
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/DiscoveryClient.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/DiscoveryClient.cs
index 35b561e84..18e192c21 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/DiscoveryClient.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/DiscoveryClient.cs
@@ -2,14 +2,14 @@
// 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.Client;
+using IdentityServer.IntegrationTests.Clients.Setup;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
-using IdentityServer.IntegrationTests.Clients.Setup;
using Xunit;
namespace IdentityServer.IntegrationTests.Clients
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/ExtensionGrantClient.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/ExtensionGrantClient.cs
index 6288becce..bd35318c6 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/ExtensionGrantClient.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/ExtensionGrantClient.cs
@@ -2,6 +2,14 @@
// 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 IdentityServer.IntegrationTests.Clients.Setup;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.TestHost;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
@@ -10,14 +18,6 @@
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
-using FluentAssertions;
-using IdentityModel;
-using IdentityModel.Client;
-using IdentityServer.IntegrationTests.Clients.Setup;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.TestHost;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
using Xunit;
namespace IdentityServer.IntegrationTests.Clients
@@ -164,7 +164,7 @@ public async Task Valid_client_with_refreshed_extra_claim_should_succeed()
var refreshResponse = await _client.RequestRefreshTokenAsync(new RefreshTokenRequest
{
Address = TokenEndpoint,
-
+
ClientId = "client.custom",
ClientSecret = "secret",
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/RefreshTokenClient.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/RefreshTokenClient.cs
index 6751fd615..a90a111c2 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/RefreshTokenClient.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/RefreshTokenClient.cs
@@ -2,13 +2,13 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using System.Net.Http;
-using System.Threading.Tasks;
+using Duende.IdentityModel.Client;
using FluentAssertions;
-using IdentityModel.Client;
using IdentityServer.IntegrationTests.Clients.Setup;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
+using System.Net.Http;
+using System.Threading.Tasks;
using Xunit;
namespace IdentityServer.IntegrationTests.Clients
@@ -142,7 +142,7 @@ public async Task Refreshing_a_refresh_token_with_reuse_should_return_same_refre
rt1.Should().BeEquivalentTo(rt2);
}
-
+
[Fact]
public async Task Refreshing_a_refresh_token_with_one_time_only_should_return_different_refresh_token()
{
@@ -184,7 +184,7 @@ public async Task Refreshing_a_refresh_token_with_one_time_only_should_return_di
rt1.Should().NotBeEquivalentTo(rt2);
}
-
+
[Fact]
public async Task Replaying_a_rotated_token_should_fail()
{
@@ -223,7 +223,7 @@ public async Task Replaying_a_rotated_token_should_fail()
response.TokenType.Should().Be("Bearer");
response.IdentityToken.Should().NotBeNull();
response.RefreshToken.Should().NotBeNull();
-
+
// refresh token (again)
response = await _client.RequestRefreshTokenAsync(new RefreshTokenRequest
{
@@ -237,7 +237,7 @@ public async Task Replaying_a_rotated_token_should_fail()
response.IsError.Should().BeTrue();
response.Error.Should().Be("invalid_grant");
}
-
+
[Fact]
public async Task Using_a_valid_refresh_token_should_succeed()
{
@@ -273,7 +273,7 @@ public async Task Using_a_valid_refresh_token_should_succeed()
response.IsError.Should().BeFalse();
}
-
+
[Fact]
public async Task Using_a_revoked_refresh_token_should_fail()
{
@@ -310,7 +310,7 @@ public async Task Using_a_revoked_refresh_token_should_fail()
});
revocationResponse.IsError.Should().Be(false);
-
+
// refresh token
response = await _client.RequestRefreshTokenAsync(new RefreshTokenRequest
{
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/ResourceOwnerClient.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/ResourceOwnerClient.cs
index c214ba394..e20d91ed3 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/ResourceOwnerClient.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/ResourceOwnerClient.cs
@@ -2,20 +2,20 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using System.Collections.Generic;
-using System.Linq;
-using System.Net;
-using System.Net.Http;
-using System.Text;
-using System.Threading.Tasks;
+using Duende.IdentityModel;
+using Duende.IdentityModel.Client;
using FluentAssertions;
-using IdentityModel;
-using IdentityModel.Client;
using IdentityServer.IntegrationTests.Clients.Setup;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Text;
+using System.Threading.Tasks;
using Xunit;
namespace IdentityServer.IntegrationTests.Clients
@@ -64,10 +64,10 @@ public async Task Valid_user_should_succeed_with_expected_response_payload()
payload.Should().Contain("idp", "local");
payload.Keys.Should().Contain("jti");
payload.Keys.Should().Contain("iat");
-
+
payload["aud"].Should().Be("api");
- var scopes = ((JArray)payload["scope"]).Select(x => x.ToString());
+ var scopes = ((JArray) payload["scope"]).Select(x => x.ToString());
scopes.Count().Should().Be(1);
scopes.Should().Contain("api1");
@@ -96,7 +96,7 @@ public async Task Request_with_no_explicit_scopes_should_return_allowed_scopes()
response.RefreshToken.Should().NotBeNull();
var payload = GetPayload(response);
-
+
payload.Should().Contain("iss", "https://idsvr4");
payload.Should().Contain("client_id", "roclient");
payload.Should().Contain("sub", "88421113");
@@ -108,7 +108,7 @@ public async Task Request_with_no_explicit_scopes_should_return_allowed_scopes()
amr.Count().Should().Be(1);
amr.First().ToString().Should().Be("pwd");
- var scopes = ((JArray)payload["scope"]).Select(x => x.ToString());
+ var scopes = ((JArray) payload["scope"]).Select(x => x.ToString());
scopes.Count().Should().Be(8);
// {[ "address", "api1", "api2", "api4.with.roles", "email", "offline_access", "openid", "role"]}
@@ -159,7 +159,7 @@ public async Task Request_containing_identity_scopes_should_return_expected_payl
amr.Count().Should().Be(1);
amr.First().ToString().Should().Be("pwd");
- var scopes = ((JArray)payload["scope"]).Select(x=>x.ToString());
+ var scopes = ((JArray) payload["scope"]).Select(x => x.ToString());
scopes.Count().Should().Be(3);
scopes.Should().Contain("api1");
scopes.Should().Contain("email");
@@ -202,7 +202,7 @@ public async Task Request_for_refresh_token_should_return_expected_payload()
amr.Count().Should().Be(1);
amr.First().ToString().Should().Be("pwd");
- var scopes = ((JArray)payload["scope"]).Select(x => x.ToString());
+ var scopes = ((JArray) payload["scope"]).Select(x => x.ToString());
scopes.Count().Should().Be(4);
scopes.Should().Contain("api1");
scopes.Should().Contain("email");
@@ -229,7 +229,7 @@ public async Task Unknown_user_should_fail()
response.HttpStatusCode.Should().Be(HttpStatusCode.BadRequest);
response.Error.Should().Be("invalid_grant");
}
-
+
[Fact]
public async Task User_with_empty_password_should_succeed()
{
@@ -269,7 +269,7 @@ public async Task User_with_invalid_password_should_fail(string password)
}
- private static Dictionary GetPayload(IdentityModel.Client.TokenResponse response)
+ private static Dictionary GetPayload(TokenResponse response)
{
var token = response.AccessToken.Split('.').Skip(1).Take(1).First();
var dictionary = JsonConvert.DeserializeObject>(
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/RevocationClient.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/RevocationClient.cs
index f97ed76ae..268901155 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/RevocationClient.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/RevocationClient.cs
@@ -2,13 +2,13 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using System.Net.Http;
-using System.Threading.Tasks;
+using Duende.IdentityModel.Client;
using FluentAssertions;
-using IdentityModel.Client;
using IdentityServer.IntegrationTests.Clients.Setup;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
+using System.Net.Http;
+using System.Threading.Tasks;
using Xunit;
namespace IdentityServer.IntegrationTests.Clients
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/Setup/Users.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/Setup/Users.cs
index 6bb5d3b98..bde3c7716 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/Setup/Users.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/Setup/Users.cs
@@ -4,7 +4,7 @@
using System.Collections.Generic;
using System.Security.Claims;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4;
using IdentityServer4.Test;
@@ -16,7 +16,7 @@ public static List Get()
{
var users = new List
{
- new TestUser{SubjectId = "818727", Username = "alice", Password = "alice",
+ new TestUser{SubjectId = "818727", Username = "alice", Password = "alice",
Claims = new Claim[]
{
new Claim(JwtClaimTypes.Name, "Alice Smith"),
@@ -30,7 +30,7 @@ public static List Get()
new Claim(JwtClaimTypes.Address, @"{ 'street_address': 'One Hacker Way', 'locality': 'Heidelberg', 'postal_code': 69118, 'country': 'Germany' }", IdentityServerConstants.ClaimValueTypes.Json)
}
},
- new TestUser{SubjectId = "88421113", Username = "bob", Password = "bob",
+ new TestUser{SubjectId = "88421113", Username = "bob", Password = "bob",
Claims = new Claim[]
{
new Claim(JwtClaimTypes.Name, "Bob Smith"),
@@ -44,7 +44,7 @@ public static List Get()
new Claim(JwtClaimTypes.Address, @"{ 'street_address': 'One Hacker Way', 'locality': 'Heidelberg', 'postal_code': 69118, 'country': 'Germany' }", IdentityServerConstants.ClaimValueTypes.Json)
}
},
- new TestUser{SubjectId = "88421113", Username = "bob_no_password",
+ new TestUser{SubjectId = "88421113", Username = "bob_no_password",
Claims = new Claim[]
{
new Claim(JwtClaimTypes.Name, "Bob Smith"),
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/UserInfoClient.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/UserInfoClient.cs
index 0008b0ef5..157445f45 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/UserInfoClient.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Clients/UserInfoClient.cs
@@ -2,20 +2,20 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using System.Collections.Generic;
-using System.Linq;
-using System.Net;
-using System.Net.Http;
-using System.Text;
-using System.Threading.Tasks;
+using Duende.IdentityModel;
+using Duende.IdentityModel.Client;
using FluentAssertions;
-using IdentityModel;
-using IdentityModel.Client;
using IdentityServer.IntegrationTests.Clients.Setup;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Text;
+using System.Threading.Tasks;
using Xunit;
namespace IdentityServer.IntegrationTests.Clients
@@ -194,7 +194,7 @@ public async Task Complex_json_should_be_correct()
Token = response.AccessToken
});
- roles = (userInfo.Json.TryGetStringArray("role")).Select(x => x.ToString()).ToArray();
+ roles = (userInfo.Json?.TryGetStringArray("role")).Select(x => x.ToString()).ToArray();
roles.Length.Should().Be(2);
roles.Should().Contain("Geek");
roles.Should().Contain("Developer");
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Common/IdentityServerPipeline.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Common/IdentityServerPipeline.cs
index d40687a41..8a8285c65 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Common/IdentityServerPipeline.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Common/IdentityServerPipeline.cs
@@ -2,16 +2,8 @@
// 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;
-using System.Net;
-using System.Net.Http;
-using System.Security.Claims;
-using System.Threading;
-using System.Threading.Tasks;
+using Duende.IdentityModel.Client;
using FluentAssertions;
-using IdentityModel.Client;
using IdentityServer4;
using IdentityServer4.Configuration;
using IdentityServer4.Extensions;
@@ -25,6 +17,14 @@
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Security.Claims;
+using System.Threading;
+using System.Threading.Tasks;
namespace IdentityServer.IntegrationTests.Common
{
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Conformance/Basic/ClientAuthenticationTests.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Conformance/Basic/ClientAuthenticationTests.cs
index 7380ac6a4..7033ea9e2 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Conformance/Basic/ClientAuthenticationTests.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Conformance/Basic/ClientAuthenticationTests.cs
@@ -2,21 +2,21 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
+using Duende.IdentityModel.Client;
+using FluentAssertions;
+using IdentityServer.IntegrationTests.Common;
+using IdentityServer4.Models;
+using IdentityServer4.Test;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Security.Claims;
using System.Threading.Tasks;
-using FluentAssertions;
-using IdentityModel.Client;
-using IdentityServer.IntegrationTests.Common;
-using IdentityServer4.Models;
-using IdentityServer4.Test;
using Xunit;
namespace IdentityServer.IntegrationTests.Conformance.Basic
{
- public class ClientAuthenticationTests
+ public class ClientAuthenticationTests
{
private const string Category = "Conformance.Basic.ClientAuthenticationTests";
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Conformance/Basic/CodeFlowTests.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Conformance/Basic/CodeFlowTests.cs
index cc3aa7189..92ef168b3 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Conformance/Basic/CodeFlowTests.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Conformance/Basic/CodeFlowTests.cs
@@ -2,6 +2,12 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
+using Duende.IdentityModel.Client;
+using FluentAssertions;
+using IdentityServer.IntegrationTests.Common;
+using IdentityServer4.Configuration;
+using IdentityServer4.Models;
+using IdentityServer4.Test;
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
@@ -9,17 +15,11 @@
using System.Net.Http;
using System.Security.Claims;
using System.Threading.Tasks;
-using FluentAssertions;
-using IdentityModel.Client;
-using IdentityServer.IntegrationTests.Common;
-using IdentityServer4.Configuration;
-using IdentityServer4.Models;
-using IdentityServer4.Test;
using Xunit;
namespace IdentityServer.IntegrationTests.Conformance.Basic
{
- public class CodeFlowTests
+ public class CodeFlowTests
{
private const string Category = "Conformance.Basic.CodeFlowTests";
@@ -107,7 +107,7 @@ public async Task No_state_should_not_result_in_shash()
tokenResult.IdentityToken.Should().NotBeNull();
var token = new JwtSecurityToken(tokenResult.IdentityToken);
-
+
var s_hash = token.Claims.FirstOrDefault(c => c.Type == "s_hash");
s_hash.Should().BeNull();
}
@@ -156,7 +156,7 @@ public async Task State_should_result_in_shash()
tokenResult.IdentityToken.Should().NotBeNull();
var token = new JwtSecurityToken(tokenResult.IdentityToken);
-
+
var s_hash = token.Claims.FirstOrDefault(c => c.Type == "s_hash");
s_hash.Should().NotBeNull();
s_hash.Value.Should().Be(CryptoHelper.CreateHashClaimValue("state", "RS256"));
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Conformance/Basic/ResponseTypeResponseModeTests.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Conformance/Basic/ResponseTypeResponseModeTests.cs
index e397a18c5..03ec665af 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Conformance/Basic/ResponseTypeResponseModeTests.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Conformance/Basic/ResponseTypeResponseModeTests.cs
@@ -1,16 +1,17 @@
-// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
+// Copyright (c) Brock Allen & Dominick Baier. 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 IdentityServer.IntegrationTests.Common;
+using IdentityServer4.Models;
+using IdentityServer4.Test;
using System;
using System.Collections.Generic;
using System.Net;
using System.Security.Claims;
using System.Threading.Tasks;
-using FluentAssertions;
-using IdentityServer.IntegrationTests.Common;
-using IdentityServer4.Models;
-using IdentityServer4.Test;
using Xunit;
namespace IdentityServer.IntegrationTests.Conformance.Basic
@@ -82,36 +83,10 @@ public async Task Request_with_response_type_code_supported()
var response = await _mockPipeline.BrowserClient.GetAsync(url);
response.StatusCode.Should().Be(HttpStatusCode.Found);
- var authorization = new IdentityModel.Client.AuthorizeResponse(response.Headers.Location.ToString());
+ var authorization = new AuthorizeResponse(response.Headers.Location.ToString());
authorization.IsError.Should().BeFalse();
authorization.Code.Should().NotBeNull();
authorization.State.Should().Be(state);
}
-
- // this might not be in sync with the actual conformance tests
- // since we dead-end on the error page due to changes
- // to follow the RFC to address open redirect in original OAuth RFC
- [Fact]
- [Trait("Category", Category)]
- public async Task Request_missing_response_type_rejected()
- {
- await _mockPipeline.LoginAsync("bob");
-
- var state = Guid.NewGuid().ToString();
- var nonce = Guid.NewGuid().ToString();
-
- var url = _mockPipeline.CreateAuthorizeUrl(
- clientId: "code_client",
- responseType: null, // missing
- scope: "openid",
- redirectUri: "https://code_client/callback",
- state: state,
- nonce: nonce);
-
- _mockPipeline.BrowserClient.AllowAutoRedirect = true;
- var response = await _mockPipeline.BrowserClient.GetAsync(url);
-
- _mockPipeline.ErrorMessage.Error.Should().Be("unsupported_response_type");
- }
}
}
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Conformance/Pkce/PkceTests.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Conformance/Pkce/PkceTests.cs
index ba35f7dda..5404ccb47 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Conformance/Pkce/PkceTests.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Conformance/Pkce/PkceTests.cs
@@ -2,18 +2,18 @@
// 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.Security.Claims;
-using System.Text;
-using System.Threading.Tasks;
+using Duende.IdentityModel;
+using Duende.IdentityModel.Client;
using FluentAssertions;
-using IdentityModel;
-using IdentityModel.Client;
using IdentityServer.IntegrationTests.Common;
using IdentityServer4;
using IdentityServer4.Models;
using IdentityServer4.Test;
+using System;
+using System.Collections.Generic;
+using System.Security.Claims;
+using System.Text;
+using System.Threading.Tasks;
using Xunit;
namespace IdentityServer.IntegrationTests.Conformance.Pkce
@@ -280,7 +280,7 @@ public async Task Authorize_request_needs_code_challenge(string clientId)
authorizeResponse.Should().BeNull();
}
-
+
[Fact]
[Trait("Category", Category)]
public async Task Code_verifier_should_not_be_accepted_if_no_code_challenge_was_used()
@@ -329,7 +329,7 @@ public async Task Authorize_request_code_challenge_cannot_be_too_short(string cl
IdentityServerConstants.StandardScopes.OpenId,
redirect_uri,
nonce: nonce,
- codeChallenge:"a");
+ codeChallenge: "a");
_pipeline.ErrorWasCalled.Should().BeTrue();
_pipeline.ErrorMessage.Error.Should().Be(OidcConstants.AuthorizeErrors.InvalidRequest);
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Authorize/AuthorizeTests.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Authorize/AuthorizeTests.cs
index a9e1ff327..cf87da452 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Authorize/AuthorizeTests.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Authorize/AuthorizeTests.cs
@@ -2,15 +2,9 @@
// 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.Net;
-using System.Net.Http;
-using System.Security.Claims;
-using System.Threading.Tasks;
+using Duende.IdentityModel;
+using Duende.IdentityModel.Client;
using FluentAssertions;
-using IdentityModel;
-using IdentityModel.Client;
using IdentityServer.IntegrationTests.Common;
using IdentityServer4;
using IdentityServer4.Models;
@@ -18,6 +12,12 @@
using IdentityServer4.Stores.Default;
using IdentityServer4.Test;
using Microsoft.Extensions.DependencyInjection;
+using System;
+using System.Collections.Generic;
+using System.Net;
+using System.Net.Http;
+using System.Security.Claims;
+using System.Threading.Tasks;
using Xunit;
namespace IdentityServer.IntegrationTests.Endpoints.Authorize
@@ -234,7 +234,7 @@ public async Task signin_response_should_allow_successful_authorization_response
response.StatusCode.Should().Be(HttpStatusCode.Redirect);
response.Headers.Location.ToString().Should().StartWith("https://client1/callback");
- var authorization = new IdentityModel.Client.AuthorizeResponse(response.Headers.Location.ToString());
+ var authorization = new AuthorizeResponse(response.Headers.Location.ToString());
authorization.IsError.Should().BeFalse();
authorization.IdentityToken.Should().NotBeNull();
authorization.State.Should().Be("123_state");
@@ -260,7 +260,7 @@ public async Task authenticated_user_with_valid_request_should_receive_authoriza
response.StatusCode.Should().Be(HttpStatusCode.Redirect);
response.Headers.Location.ToString().Should().StartWith("https://client1/callback");
- var authorization = new IdentityModel.Client.AuthorizeResponse(response.Headers.Location.ToString());
+ var authorization = new AuthorizeResponse(response.Headers.Location.ToString());
authorization.IsError.Should().BeFalse();
authorization.IdentityToken.Should().NotBeNull();
authorization.State.Should().Be("123_state");
@@ -303,7 +303,7 @@ public async Task login_response_and_consent_response_should_receive_authorizati
response.StatusCode.Should().Be(HttpStatusCode.Redirect);
response.Headers.Location.ToString().Should().StartWith("https://client2/callback");
- var authorization = new IdentityModel.Client.AuthorizeResponse(response.Headers.Location.ToString());
+ var authorization = new AuthorizeResponse(response.Headers.Location.ToString());
authorization.IsError.Should().BeFalse();
authorization.IdentityToken.Should().NotBeNull();
authorization.State.Should().Be("123_state");
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Authorize/ConsentTests.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Authorize/ConsentTests.cs
index c685bbdb5..fe2ee5db1 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Authorize/ConsentTests.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Authorize/ConsentTests.cs
@@ -2,20 +2,19 @@
// 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.Net;
-using System.Reflection.Metadata;
-using System.Security.Claims;
-using System.Threading.Tasks;
+using Duende.IdentityModel.Client;
using FluentAssertions;
-using IdentityModel.Client;
using IdentityServer.IntegrationTests.Common;
using IdentityServer4.Models;
using IdentityServer4.Stores;
using IdentityServer4.Stores.Default;
using IdentityServer4.Test;
using Microsoft.Extensions.DependencyInjection;
+using System;
+using System.Collections.Generic;
+using System.Net;
+using System.Security.Claims;
+using System.Threading.Tasks;
using Xunit;
namespace IdentityServer.IntegrationTests.Endpoints.Authorize
@@ -200,7 +199,7 @@ public async Task consent_response_should_allow_successful_authorization_respons
response.StatusCode.Should().Be(HttpStatusCode.Redirect);
response.Headers.Location.ToString().Should().StartWith("https://client2/callback");
- var authorization = new IdentityModel.Client.AuthorizeResponse(response.Headers.Location.ToString());
+ var authorization = new AuthorizeResponse(response.Headers.Location.ToString());
authorization.IsError.Should().BeFalse();
authorization.IdentityToken.Should().NotBeNull();
authorization.State.Should().Be("123_state");
@@ -268,7 +267,7 @@ public async Task consent_response_missing_required_scopes_should_error()
response.StatusCode.Should().Be(HttpStatusCode.Redirect);
response.Headers.Location.ToString().Should().StartWith("https://client2/callback");
- var authorization = new IdentityModel.Client.AuthorizeResponse(response.Headers.Location.ToString());
+ var authorization = new AuthorizeResponse(response.Headers.Location.ToString());
authorization.IsError.Should().BeTrue();
authorization.Error.Should().Be("access_denied");
authorization.State.Should().Be("123_state");
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Authorize/JwtRequestAuthorizeTests.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Authorize/JwtRequestAuthorizeTests.cs
index 965754f76..5607f9151 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Authorize/JwtRequestAuthorizeTests.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Authorize/JwtRequestAuthorizeTests.cs
@@ -2,17 +2,9 @@
// 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.IdentityModel.Tokens.Jwt;
-using System.Net.Http;
-using System.Net.Http.Headers;
-using System.Security.Claims;
-using System.Security.Cryptography.X509Certificates;
-using System.Threading.Tasks;
+using Duende.IdentityModel;
+using Duende.IdentityModel.Client;
using FluentAssertions;
-using IdentityModel;
-using IdentityModel.Client;
using IdentityServer.IntegrationTests.Common;
using IdentityServer4;
using IdentityServer4.Configuration;
@@ -20,7 +12,15 @@
using IdentityServer4.Test;
using Microsoft.IdentityModel.Logging;
using Microsoft.IdentityModel.Tokens;
-using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.IdentityModel.Tokens.Jwt;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Security.Claims;
+using System.Security.Cryptography.X509Certificates;
+using System.Text.Json;
+using System.Threading.Tasks;
using Xunit;
namespace IdentityServer.IntegrationTests.Endpoints.Authorize
@@ -29,10 +29,10 @@ public class JwtRequestAuthorizeTests
{
private const string Category = "Authorize endpoint with JWT requests";
- private readonly IdentityServerPipeline _mockPipeline = new IdentityServerPipeline();
+ private readonly IdentityServerPipeline _mockPipeline = new();
private readonly Client _client;
- private readonly string _symmetricJwk = @"{ 'kty': 'oct', 'use': 'sig', 'kid': '1', 'k': 'nYA-IFt8xTsdBHe9hunvizcp3Dt7f6qGqudq18kZHNtvqEGjJ9Ud-9x3kbQ-LYfLHS3xM2MpFQFg1JzT_0U_F8DI40oby4TvBDGszP664UgA8_5GjB7Flnrlsap1NlitvNpgQX3lpyTvC2zVuQ-UVsXbBDAaSBUSlnw7SE4LM8Ye2WYZrdCCXL8yAX9vIR7vf77yvNTEcBCI6y4JlvZaqMB4YKVSfygs8XqGGCHjLpE5bvI-A4ESbAUX26cVFvCeDg9pR6HK7BmwPMlO96krgtKZcXEJtUELYPys6-rbwAIdmxJxKxpgRpt0FRv_9fm6YPwG7QivYBX-vRwaodL1TA', 'alg': 'HS256'}";
+ private readonly string _symmetricJwk = @"{ ""kty"": ""oct"", ""use"": ""sig"", ""kid"": ""1"", ""k"": ""nYA-IFt8xTsdBHe9hunvizcp3Dt7f6qGqudq18kZHNtvqEGjJ9Ud-9x3kbQ-LYfLHS3xM2MpFQFg1JzT_0U_F8DI40oby4TvBDGszP664UgA8_5GjB7Flnrlsap1NlitvNpgQX3lpyTvC2zVuQ-UVsXbBDAaSBUSlnw7SE4LM8Ye2WYZrdCCXL8yAX9vIR7vf77yvNTEcBCI6y4JlvZaqMB4YKVSfygs8XqGGCHjLpE5bvI-A4ESbAUX26cVFvCeDg9pR6HK7BmwPMlO96krgtKZcXEJtUELYPys6-rbwAIdmxJxKxpgRpt0FRv_9fm6YPwG7QivYBX-vRwaodL1TA"", ""alg"": ""HS256""}";
private readonly RsaSecurityKey _rsaKey;
public JwtRequestAuthorizeTests()
@@ -70,13 +70,13 @@ public JwtRequestAuthorizeTests()
{
// RSA key as JWK
Type = IdentityServerConstants.SecretTypes.JsonWebKey,
- Value = JsonConvert.SerializeObject(JsonWebKeyConverter.ConvertFromRSASecurityKey(_rsaKey))
+ Value = JsonSerializer.Serialize(JsonWebKeyConverter.ConvertFromRSASecurityKey(_rsaKey))
},
new Secret
{
// x509 cert as JWK
Type = IdentityServerConstants.SecretTypes.JsonWebKey,
- Value = JsonConvert.SerializeObject(JsonWebKeyConverter.ConvertFromX509SecurityKey(new X509SecurityKey(TestCert.Load())))
+ Value = JsonSerializer.Serialize(JsonWebKeyConverter.ConvertFromX509SecurityKey(new X509SecurityKey(TestCert.Load())))
}
},
@@ -114,13 +114,13 @@ public JwtRequestAuthorizeTests()
{
// RSA key as JWK
Type = IdentityServerConstants.SecretTypes.JsonWebKey,
- Value = JsonConvert.SerializeObject(JsonWebKeyConverter.ConvertFromRSASecurityKey(_rsaKey))
+ Value = JsonSerializer.Serialize(JsonWebKeyConverter.ConvertFromRSASecurityKey(_rsaKey))
},
new Secret
{
// x509 cert as JWK
Type = IdentityServerConstants.SecretTypes.JsonWebKey,
- Value = JsonConvert.SerializeObject(JsonWebKeyConverter.ConvertFromX509SecurityKey(new X509SecurityKey(TestCert.Load())))
+ Value = JsonSerializer.Serialize(JsonWebKeyConverter.ConvertFromX509SecurityKey(new X509SecurityKey(TestCert.Load())))
}
},
@@ -485,63 +485,10 @@ public async Task mismatch_in_jwt_values_should_error()
_mockPipeline.LoginRequest.Should().BeNull();
}
- [Fact]
- [Trait("Category", Category)]
+ [Obsolete]
public async Task authorize_should_accept_complex_objects_in_request_object()
{
- var someObj = new { foo = new { bar = "bar" }, baz = "baz" };
- var someObjJson = JsonConvert.SerializeObject(someObj);
- var someArr = new[] { "a", "b", "c" };
- var someArrJson = JsonConvert.SerializeObject(someArr);
-
-
- var requestJwt = CreateRequestJwt(
- issuer: _client.ClientId,
- audience: IdentityServerPipeline.BaseUrl,
- credential: new X509SigningCredentials(TestCert.Load()),
- claims: new[] {
- new Claim("client_id", _client.ClientId),
- new Claim("response_type", "id_token"),
- new Claim("scope", "openid profile"),
- new Claim("state", "123state"),
- new Claim("nonce", "123nonce"),
- new Claim("redirect_uri", "https://client/callback"),
- new Claim("acr_values", "acr_1 acr_2 tenant:tenant_value idp:idp_value"),
- new Claim("login_hint", "login_hint_value"),
- new Claim("display", "popup"),
- new Claim("ui_locales", "ui_locale_value"),
- new Claim("foo", "123foo"),
- new Claim("someObj", someObjJson, Microsoft.IdentityModel.JsonWebTokens.JsonClaimValueTypes.Json),
- new Claim("someArr", someArrJson, Microsoft.IdentityModel.JsonWebTokens.JsonClaimValueTypes.JsonArray),
- });
-
- var url = _mockPipeline.CreateAuthorizeUrl(
- clientId: _client.ClientId,
- responseType: "id_token",
- extra: Parameters.FromObject(new
- {
- request = requestJwt
- }));
- var response = await _mockPipeline.BrowserClient.GetAsync(url);
-
- _mockPipeline.LoginRequest.Should().NotBeNull();
-
- _mockPipeline.LoginRequest.Parameters["someObj"].Should().NotBeNull();
- var someObj2 = JsonConvert.DeserializeObject(_mockPipeline.LoginRequest.Parameters["someObj"], someObj.GetType());
- someObj.Should().BeEquivalentTo(someObj2);
- _mockPipeline.LoginRequest.Parameters["someArr"].Should().NotBeNull();
- var someArr2 = JsonConvert.DeserializeObject(_mockPipeline.LoginRequest.Parameters["someArr"]);
- someArr2.Should().Contain(new[] { "a", "c", "b" });
- someArr2.Length.Should().Be(3);
-
- _mockPipeline.LoginRequest.RequestObjectValues.Count.Should().Be(13);
- _mockPipeline.LoginRequest.RequestObjectValues["someObj"].Should().NotBeNull();
- someObj2 = JsonConvert.DeserializeObject(_mockPipeline.LoginRequest.RequestObjectValues["someObj"], someObj.GetType());
- someObj.Should().BeEquivalentTo(someObj2);
- _mockPipeline.LoginRequest.RequestObjectValues["someArr"].Should().NotBeNull();
- someArr2 = JsonConvert.DeserializeObject(_mockPipeline.LoginRequest.Parameters["someArr"]);
- someArr2.Should().Contain(new[] { "a", "c", "b" });
- someArr2.Length.Should().Be(3);
+ // See https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/issues/2585
}
[Fact]
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Authorize/RestrictAccessTokenViaBrowserTests.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Authorize/RestrictAccessTokenViaBrowserTests.cs
index c154c79b2..799973b20 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Authorize/RestrictAccessTokenViaBrowserTests.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Authorize/RestrictAccessTokenViaBrowserTests.cs
@@ -2,15 +2,16 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using System.Collections.Generic;
-using System.Net;
-using System.Security.Claims;
-using System.Threading.Tasks;
+using Duende.IdentityModel.Client;
using FluentAssertions;
using IdentityServer.IntegrationTests.Common;
using IdentityServer4;
using IdentityServer4.Models;
using IdentityServer4.Test;
+using System.Collections.Generic;
+using System.Net;
+using System.Security.Claims;
+using System.Threading.Tasks;
using Xunit;
namespace IdentityServer.IntegrationTests.Endpoints.Authorize
@@ -101,7 +102,7 @@ public async Task Unrestricted_implicit_client_can_request_IdToken()
response.StatusCode.Should().Be(HttpStatusCode.Found);
response.Headers.Location.AbsoluteUri.Should().StartWith("https://client1/callback");
- var authorization = new IdentityModel.Client.AuthorizeResponse(response.Headers.Location.ToString());
+ var authorization = new AuthorizeResponse(response.Headers.Location.ToString());
authorization.IdentityToken.Should().NotBeNull();
authorization.AccessToken.Should().BeNull();
}
@@ -120,7 +121,7 @@ public async Task Unrestricted_implicit_client_can_request_IdTokenToken()
response.StatusCode.Should().Be(HttpStatusCode.Found);
response.Headers.Location.AbsoluteUri.Should().StartWith("https://client1/callback");
- var authorization = new IdentityModel.Client.AuthorizeResponse(response.Headers.Location.ToString());
+ var authorization = new AuthorizeResponse(response.Headers.Location.ToString());
authorization.IdentityToken.Should().NotBeNull();
authorization.AccessToken.Should().NotBeNull();
}
@@ -139,7 +140,7 @@ public async Task Restricted_implicit_client_can_request_IdToken()
response.StatusCode.Should().Be(HttpStatusCode.Found);
response.Headers.Location.AbsoluteUri.Should().StartWith("https://client2/callback");
- var authorization = new IdentityModel.Client.AuthorizeResponse(response.Headers.Location.ToString());
+ var authorization = new AuthorizeResponse(response.Headers.Location.ToString());
authorization.IdentityToken.Should().NotBeNull();
authorization.AccessToken.Should().BeNull();
}
@@ -172,7 +173,7 @@ public async Task Unrestricted_hybrid_client_can_request_CodeIdToken()
response.StatusCode.Should().Be(HttpStatusCode.Found);
response.Headers.Location.AbsoluteUri.Should().StartWith("https://client3/callback");
- var authorization = new IdentityModel.Client.AuthorizeResponse(response.Headers.Location.ToString());
+ var authorization = new AuthorizeResponse(response.Headers.Location.ToString());
authorization.IdentityToken.Should().NotBeNull();
authorization.AccessToken.Should().BeNull();
authorization.Code.Should().NotBeNull();
@@ -192,7 +193,7 @@ public async Task Unrestricted_hybrid_client_can_request_CodeIdTokenToken()
response.StatusCode.Should().Be(HttpStatusCode.Found);
response.Headers.Location.AbsoluteUri.Should().StartWith("https://client3/callback");
- var authorization = new IdentityModel.Client.AuthorizeResponse(response.Headers.Location.ToString());
+ var authorization = new AuthorizeResponse(response.Headers.Location.ToString());
authorization.IdentityToken.Should().NotBeNull();
authorization.AccessToken.Should().NotBeNull();
authorization.Code.Should().NotBeNull();
@@ -213,7 +214,7 @@ public async Task Restricted_hybrid_client_can_request_CodeIdToken()
response.StatusCode.Should().Be(HttpStatusCode.Found);
response.Headers.Location.AbsoluteUri.Should().StartWith("https://client4/callback");
- var authorization = new IdentityModel.Client.AuthorizeResponse(response.Headers.Location.ToString());
+ var authorization = new AuthorizeResponse(response.Headers.Location.ToString());
authorization.IdentityToken.Should().NotBeNull();
authorization.AccessToken.Should().BeNull();
authorization.Code.Should().NotBeNull();
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/DeviceAuthorization/DeviceAuthorizationTests.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/DeviceAuthorization/DeviceAuthorizationTests.cs
index 9669d8bda..4e71d27ae 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/DeviceAuthorization/DeviceAuthorizationTests.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/DeviceAuthorization/DeviceAuthorizationTests.cs
@@ -6,7 +6,7 @@
using System.Text;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.IntegrationTests.Common;
using IdentityServer4.Models;
using Newtonsoft.Json;
@@ -25,9 +25,9 @@ public DeviceAuthorizationTests()
_mockPipeline.Clients.Add(new Client
{
ClientId = "client1",
- ClientSecrets = {new Secret("secret".Sha256())},
+ ClientSecrets = { new Secret("secret".Sha256()) },
AllowedGrantTypes = GrantTypes.DeviceFlow,
- AllowedScopes = {"openid"}
+ AllowedScopes = { "openid" }
});
_mockPipeline.IdentityScopes.AddRange(new IdentityResource[] {
@@ -115,7 +115,7 @@ public async Task valid_should_return_json()
response.StatusCode.Should().Be(HttpStatusCode.OK);
response.Content.Headers.ContentType.MediaType.Should().Be("application/json");
-
+
var resultDto = ParseJsonBody(await response.Content.ReadAsStreamAsync());
resultDto.Should().NotBeNull();
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Discovery/DiscoveryEndpointTests.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Discovery/DiscoveryEndpointTests.cs
index 1a4b3efe9..f40befe9e 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Discovery/DiscoveryEndpointTests.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Discovery/DiscoveryEndpointTests.cs
@@ -2,8 +2,8 @@
// 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.Client;
using IdentityServer.IntegrationTests.Common;
using IdentityServer4;
using IdentityServer4.Configuration;
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/EndSession/EndSessionTests.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/EndSession/EndSessionTests.cs
index 946a22382..4ede87fdb 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/EndSession/EndSessionTests.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/EndSession/EndSessionTests.cs
@@ -2,6 +2,14 @@
// 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 IdentityServer.IntegrationTests.Common;
+using IdentityServer4.Models;
+using IdentityServer4.Test;
+using Microsoft.AspNetCore.WebUtilities;
+using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -11,13 +19,6 @@
using System.Text;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
-using FluentAssertions;
-using IdentityModel;
-using IdentityServer.IntegrationTests.Common;
-using IdentityServer4.Models;
-using IdentityServer4.Test;
-using Microsoft.AspNetCore.WebUtilities;
-using Newtonsoft.Json.Linq;
using Xunit;
using static IdentityServer4.IdentityServerConstants;
@@ -137,7 +138,7 @@ public async Task get_request_should_redirect_to_configured_logout_path()
_mockPipeline.BrowserClient.AllowAutoRedirect = false;
var response = await _mockPipeline.BrowserClient.GetAsync(url);
- var authorization = new IdentityModel.Client.AuthorizeResponse(response.Headers.Location.ToString());
+ var authorization = new AuthorizeResponse(response.Headers.Location.ToString());
var id_token = authorization.IdentityToken;
response = await _mockPipeline.BrowserClient.GetAsync(IdentityServerPipeline.EndSessionEndpoint +
@@ -224,7 +225,7 @@ public async Task signout_should_support_POST()
_mockPipeline.BrowserClient.AllowAutoRedirect = false;
var response = await _mockPipeline.BrowserClient.GetAsync(url);
- var authorization = new IdentityModel.Client.AuthorizeResponse(response.Headers.Location.ToString());
+ var authorization = new AuthorizeResponse(response.Headers.Location.ToString());
var id_token = authorization.IdentityToken;
_mockPipeline.BrowserClient.AllowAutoRedirect = true;
@@ -272,7 +273,7 @@ public async Task signout_callback_with_mismatched_post_logout_redirect_uri_shou
_mockPipeline.BrowserClient.AllowAutoRedirect = false;
var response = await _mockPipeline.BrowserClient.GetAsync(url);
- var authorization = new IdentityModel.Client.AuthorizeResponse(response.Headers.Location.ToString());
+ var authorization = new AuthorizeResponse(response.Headers.Location.ToString());
var id_token = authorization.IdentityToken;
_mockPipeline.BrowserClient.AllowAutoRedirect = true;
@@ -305,7 +306,7 @@ public async Task signout_callback_with_mismatched_id_token_hint_should_not_pass
_mockPipeline.BrowserClient.AllowAutoRedirect = false;
var response = await _mockPipeline.BrowserClient.GetAsync(url);
- var authorization = new IdentityModel.Client.AuthorizeResponse(response.Headers.Location.ToString());
+ var authorization = new AuthorizeResponse(response.Headers.Location.ToString());
var id_token = authorization.IdentityToken;
await _mockPipeline.LoginAsync("alice");
@@ -429,11 +430,11 @@ public async Task valid_id_token_hint_but_no_post_logout_redirect_uri_should_not
state: "123_state",
nonce: "123_nonce");
var response = await _mockPipeline.BrowserClient.GetAsync(url);
- var authorization = new IdentityModel.Client.AuthorizeResponse(response.Headers.Location.ToString());
+ var authorization = new AuthorizeResponse(response.Headers.Location.ToString());
var id_token = authorization.IdentityToken;
_mockPipeline.BrowserClient.AllowAutoRedirect = true;
- response = await _mockPipeline.BrowserClient.GetAsync(IdentityServerPipeline.EndSessionEndpoint +
+ response = await _mockPipeline.BrowserClient.GetAsync(IdentityServerPipeline.EndSessionEndpoint +
"?id_token_hint=" + id_token);
_mockPipeline.LogoutRequest.PostLogoutRedirectUri.Should().BeNull();
@@ -454,7 +455,7 @@ public async Task valid_id_token_hint_but_no_post_logout_redirect_uri_should_not
state: "123_state",
nonce: "123_nonce");
var response = await _mockPipeline.BrowserClient.GetAsync(url);
- var authorization = new IdentityModel.Client.AuthorizeResponse(response.Headers.Location.ToString());
+ var authorization = new AuthorizeResponse(response.Headers.Location.ToString());
var id_token = authorization.IdentityToken;
_mockPipeline.BrowserClient.AllowAutoRedirect = true;
@@ -523,12 +524,12 @@ public async Task logout_should_invoke_back_channel_logout()
payload["sid"].Should().NotBeNull();
payload["events"].Type.Should().Be(JTokenType.Object);
- var events = (JObject)payload["events"];
+ var events = (JObject) payload["events"];
events.Count.Should().Be(1);
events["http://schemas.openid.net/event/backchannel-logout"].Should().NotBeNull();
events["http://schemas.openid.net/event/backchannel-logout"].Type.Should().Be(JTokenType.Object);
- var evt = (JObject)events["http://schemas.openid.net/event/backchannel-logout"];
+ var evt = (JObject) events["http://schemas.openid.net/event/backchannel-logout"];
evt.Count.Should().Be(0);
};
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Introspection/IntrospectionTests.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Introspection/IntrospectionTests.cs
index 2939e8a10..e60701690 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Introspection/IntrospectionTests.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Introspection/IntrospectionTests.cs
@@ -2,21 +2,20 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
+using Duende.IdentityModel.Client;
+using FluentAssertions;
+using IdentityServer.IntegrationTests.Endpoints.Introspection.Setup;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.TestHost;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
-using System.Text.Json;
using System.Threading.Tasks;
-using FluentAssertions;
-using IdentityModel.Client;
-using IdentityServer.IntegrationTests.Endpoints.Introspection.Setup;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.TestHost;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
using Xunit;
namespace IdentityServer.IntegrationTests.Endpoints.Introspection
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Revocation/RevocationTests.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Revocation/RevocationTests.cs
index 11a09c025..8301f1ed9 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Revocation/RevocationTests.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Endpoints/Revocation/RevocationTests.cs
@@ -2,16 +2,17 @@
// 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 IdentityServer.IntegrationTests.Common;
+using IdentityServer4.Models;
+using IdentityServer4.Test;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Security.Claims;
using System.Threading.Tasks;
-using FluentAssertions;
-using IdentityModel.Client;
-using IdentityServer.IntegrationTests.Common;
-using IdentityServer4.Models;
-using IdentityServer4.Test;
using Xunit;
namespace IdentityServer.IntegrationTests.Endpoints.Revocation
@@ -175,7 +176,7 @@ private async Task IsAccessTokenValidAsync(string token)
ClientSecret = scope_secret,
Token = token,
- TokenTypeHint = IdentityModel.OidcConstants.TokenTypes.AccessToken
+ TokenTypeHint = OidcConstants.TokenTypes.AccessToken
});
return response.IsError == false && response.IsActive;
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Extensibility/CustomProfileServiceTests.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Extensibility/CustomProfileServiceTests.cs
index ce5d956f3..a6fb888cd 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Extensibility/CustomProfileServiceTests.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Extensibility/CustomProfileServiceTests.cs
@@ -1,14 +1,15 @@
-using System.Net;
-using System.Security.Claims;
-using System.Text;
-using System.Threading.Tasks;
+using Duende.IdentityModel;
+using Duende.IdentityModel.Client;
using FluentAssertions;
-using IdentityModel;
using IdentityServer.IntegrationTests.Common;
using IdentityServer4.Models;
using IdentityServer4.Services;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json.Linq;
+using System.Net;
+using System.Security.Claims;
+using System.Text;
+using System.Threading.Tasks;
using Xunit;
namespace IdentityServer.IntegrationTests.Extensibility
@@ -67,7 +68,7 @@ public async Task custom_profile_should_return_claims_for_implicit_client()
response.StatusCode.Should().Be(HttpStatusCode.Redirect);
response.Headers.Location.ToString().Should().StartWith("https://client/callback");
- var authorization = new IdentityModel.Client.AuthorizeResponse(response.Headers.Location.ToString());
+ var authorization = new AuthorizeResponse(response.Headers.Location.ToString());
authorization.IsError.Should().BeFalse();
authorization.IdentityToken.Should().NotBeNull();
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/IdentityServer.IntegrationTests.csproj b/src/IdentityServer4/test/IdentityServer.IntegrationTests/IdentityServer.IntegrationTests.csproj
index bba945688..efb18135b 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/IdentityServer.IntegrationTests.csproj
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/IdentityServer.IntegrationTests.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
@@ -18,7 +18,7 @@
-
+
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Pipeline/FederatedSignoutTests.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Pipeline/FederatedSignoutTests.cs
index 9677626fd..86336aca2 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Pipeline/FederatedSignoutTests.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Pipeline/FederatedSignoutTests.cs
@@ -9,7 +9,7 @@
using System.Security.Claims;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.IntegrationTests.Common;
using IdentityServer4;
using IdentityServer4.Models;
diff --git a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Pipeline/SubpathHosting.cs b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Pipeline/SubpathHosting.cs
index 02bc5034d..49d4fa9e3 100644
--- a/src/IdentityServer4/test/IdentityServer.IntegrationTests/Pipeline/SubpathHosting.cs
+++ b/src/IdentityServer4/test/IdentityServer.IntegrationTests/Pipeline/SubpathHosting.cs
@@ -2,14 +2,14 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using System.Collections.Generic;
-using System.Security.Claims;
-using System.Threading.Tasks;
+using Duende.IdentityModel.Client;
using FluentAssertions;
-using IdentityModel.Client;
using IdentityServer.IntegrationTests.Common;
using IdentityServer4.Models;
using IdentityServer4.Test;
+using System.Collections.Generic;
+using System.Security.Claims;
+using System.Threading.Tasks;
using Xunit;
namespace IdentityServer.IntegrationTests.Pipeline
@@ -53,7 +53,7 @@ public SubpathHosting()
new IdentityResources.Profile(),
new IdentityResources.Email()
});
-
+
_mockPipeline.Initialize("/subpath");
}
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Endpoints/Results/AuthorizeResultTests.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Endpoints/Results/AuthorizeResultTests.cs
index 28839af68..74e7e157f 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Endpoints/Results/AuthorizeResultTests.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Endpoints/Results/AuthorizeResultTests.cs
@@ -7,7 +7,7 @@
using System.Linq;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Common;
using IdentityServer4.Configuration;
using IdentityServer4.Endpoints.Results;
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Extensions/IdentityServerBuilderExtensionsCryptoTests.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Extensions/IdentityServerBuilderExtensionsCryptoTests.cs
index 1cad80a09..4619abb5e 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Extensions/IdentityServerBuilderExtensionsCryptoTests.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Extensions/IdentityServerBuilderExtensionsCryptoTests.cs
@@ -1,10 +1,11 @@
-// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
+// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using IdentityServer4;
using IdentityServer4.Configuration;
using Microsoft.Extensions.DependencyInjection;
+using Microsoft.IdentityModel.Logging;
using Microsoft.IdentityModel.Tokens;
using System;
using System.IO;
@@ -21,7 +22,9 @@ public void AddSigningCredential_with_json_web_key_containing_asymmetric_key_sho
IServiceCollection services = new ServiceCollection();
IIdentityServerBuilder identityServerBuilder = new IdentityServerBuilder(services);
- String json =
+ IdentityModelEventSource.ShowPII = true;
+
+ var json =
@"{
""alg"" : ""RS256"",
""kty"" : ""RSA"",
@@ -33,11 +36,11 @@ public void AddSigningCredential_with_json_web_key_containing_asymmetric_key_sho
""q"" : ""yDKBrS8l1DOx4dwP9hdwhqZJ3XahidiIZSL7m46I/6+cjaki/1mtNiA60MOgqTKegP7Fo7jAYvliqQwnvVGmQvLv19cfKywlIuKN9DdkLHnKh75hfo7aakEbO7GJ5zVgsNnKOdf8wvpclfvIuRDEVva4cksPzsJy6K7C8ENCSCM="",
""dp"" : ""GlYJ6o6wgawxCEQ5z5uWwETau5CS/Fk7kI2ceI14SZVHzlJQC2WglAcnQcqhmQCk57Xsy5iLM6vKyi8sdMJPh+nvR2HlyNA+w7YBy4L7odqn01VmLgv7zVVjZpNq4ZXEoDC1Q+xjtF1LoYaUt7wsRLp+a7znuPyHBXj1sAAeBwk="",
""dq"" : ""W8OK3S83T8VCTBzq1Ap6cb3XLcQq11yBaJpYaj0zXr/IKsbUW+dnFeBAFWEWS3gAX3Bod1tAFB3rs0D3FjhO1XE1ruHUT520iAEAwGiDaj+JLh994NzqELo3GW2PoIM/BtFNeKYgHd9UgQsgPnQJCzOb6Aev/z3yHeW9RRQPVbE="",
- ""qi"" : ""w4KdmiDN1GtK71JxaasqmEKPNfV3v2KZDXKnfyhUsdx/idKbdTVjvMOkxFPJ4FqV4yIVn06f3QHTm4NEG18Diqxsrzd6kXQIHOa858tLsCcmt9FoGfrgCFgVceh3K/Zah/r8rl9Y61u0Z1kZumwMvFpFE+mVU01t9HgTEAVkHTc="",
+ ""qi"" : ""w4KdmiDN1GtK71JxaasqmEKPNfV3v2KZDXKnfyhUsdx/idKbdTVjvMOkxFPJ4FqV4yIVn06f3QHTm4NEG18Diqxsrzd6kXQIHOa858tLsCcmt9FoGfrgCFgVceh3K/Zah/r8rl9Y61u0Z1kZumwMvFpFE+mVU01t9HgTEAVkHTc=""
}";
- JsonWebKey jsonWebKey = new JsonWebKey(json);
- SigningCredentials credentials = new SigningCredentials(jsonWebKey, jsonWebKey.Alg);
+ var jsonWebKey = new JsonWebKey(json);
+ var credentials = new SigningCredentials(jsonWebKey, jsonWebKey.Alg);
identityServerBuilder.AddSigningCredential(credentials);
}
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Extensions/JwtPayloadCreationTests.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Extensions/JwtPayloadCreationTests.cs
index 9d0179144..a8f138e4b 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Extensions/JwtPayloadCreationTests.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Extensions/JwtPayloadCreationTests.cs
@@ -3,7 +3,7 @@
using System.Linq;
using System.Security.Claims;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Common;
using IdentityServer4.Configuration;
using IdentityServer4.Extensions;
@@ -16,7 +16,7 @@ namespace IdentityServer.UnitTests.Extensions
public class JwtPayloadCreationTests
{
private Token _token;
-
+
public JwtPayloadCreationTests()
{
var claims = new List
@@ -25,7 +25,7 @@ public JwtPayloadCreationTests()
new Claim(JwtClaimTypes.Scope, "scope2"),
new Claim(JwtClaimTypes.Scope, "scope3"),
};
-
+
_token = new Token(OidcConstants.TokenTypes.AccessToken)
{
CreationTime = DateTime.UtcNow,
@@ -35,7 +35,7 @@ public JwtPayloadCreationTests()
ClientId = "client"
};
}
-
+
[Fact]
public void Should_create_scopes_as_array_by_default()
{
@@ -49,7 +49,7 @@ public void Should_create_scopes_as_array_by_default()
scopes[1].Value.Should().Be("scope2");
scopes[2].Value.Should().Be("scope3");
}
-
+
[Fact]
public void Should_create_scopes_as_string()
{
@@ -57,7 +57,7 @@ public void Should_create_scopes_as_string()
{
EmitScopesAsSpaceDelimitedStringInJwt = true
};
-
+
var payload = _token.CreateJwtPayload(new SystemClock(), options, TestLogger.Create());
payload.Should().NotBeNull();
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/IdentityServer.UnitTests.csproj b/src/IdentityServer4/test/IdentityServer.UnitTests/IdentityServer.UnitTests.csproj
index 2ef5235a7..196f5ff1c 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/IdentityServer.UnitTests.csproj
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/IdentityServer.UnitTests.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
@@ -34,4 +34,4 @@
-
+
\ No newline at end of file
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/ResponseHandling/AuthorizeInteractionResponseGenerator/AuthorizeInteractionResponseGeneratorTests.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/ResponseHandling/AuthorizeInteractionResponseGenerator/AuthorizeInteractionResponseGeneratorTests.cs
index 41a9172be..5691a6b62 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/ResponseHandling/AuthorizeInteractionResponseGenerator/AuthorizeInteractionResponseGeneratorTests.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/ResponseHandling/AuthorizeInteractionResponseGenerator/AuthorizeInteractionResponseGeneratorTests.cs
@@ -2,17 +2,17 @@
// 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.Threading.Tasks;
using FluentAssertions;
using IdentityServer.UnitTests.Common;
using IdentityServer4;
using IdentityServer4.Configuration;
using IdentityServer4.Models;
using IdentityServer4.Validation;
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
using Xunit;
-using static IdentityModel.OidcConstants;
+using static Duende.IdentityModel.OidcConstants;
namespace IdentityServer.UnitTests.ResponseHandling.AuthorizeInteractionResponseGenerator
{
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/ResponseHandling/AuthorizeInteractionResponseGenerator/AuthorizeInteractionResponseGeneratorTests_Consent.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/ResponseHandling/AuthorizeInteractionResponseGenerator/AuthorizeInteractionResponseGeneratorTests_Consent.cs
index 93fa080bf..a692e388d 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/ResponseHandling/AuthorizeInteractionResponseGenerator/AuthorizeInteractionResponseGeneratorTests_Consent.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/ResponseHandling/AuthorizeInteractionResponseGenerator/AuthorizeInteractionResponseGeneratorTests_Consent.cs
@@ -8,7 +8,7 @@
using System.Security.Claims;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Common;
using IdentityServer4.Configuration;
using IdentityServer4.Models;
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/ResponseHandling/AuthorizeInteractionResponseGenerator/AuthorizeInteractionResponseGeneratorTests_Custom.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/ResponseHandling/AuthorizeInteractionResponseGenerator/AuthorizeInteractionResponseGeneratorTests_Custom.cs
index d20faf8c3..6f2f329a7 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/ResponseHandling/AuthorizeInteractionResponseGenerator/AuthorizeInteractionResponseGeneratorTests_Custom.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/ResponseHandling/AuthorizeInteractionResponseGenerator/AuthorizeInteractionResponseGeneratorTests_Custom.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using System.Threading.Tasks;
using FluentAssertions;
using IdentityServer.UnitTests.Common;
using IdentityServer4;
@@ -13,8 +12,9 @@
using IdentityServer4.Validation;
using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.Logging;
+using System.Threading.Tasks;
using Xunit;
-using static IdentityModel.OidcConstants;
+using static Duende.IdentityModel.OidcConstants;
namespace IdentityServer.UnitTests.ResponseHandling.AuthorizeInteractionResponseGenerator
{
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/ResponseHandling/AuthorizeInteractionResponseGenerator/AuthorizeInteractionResponseGeneratorTests_Login.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/ResponseHandling/AuthorizeInteractionResponseGenerator/AuthorizeInteractionResponseGeneratorTests_Login.cs
index a9b54d83d..69283c4f5 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/ResponseHandling/AuthorizeInteractionResponseGenerator/AuthorizeInteractionResponseGeneratorTests_Login.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/ResponseHandling/AuthorizeInteractionResponseGenerator/AuthorizeInteractionResponseGeneratorTests_Login.cs
@@ -7,7 +7,7 @@
using System.Collections.Specialized;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Common;
using IdentityServer4;
using IdentityServer4.Configuration;
@@ -72,12 +72,13 @@ public async Task Authenticated_User_with_allowed_current_Idp_must_not_SignIn()
var request = new ValidatedAuthorizeRequest
{
ClientId = "foo",
- Subject = new IdentityServerUser("123") {
+ Subject = new IdentityServerUser("123")
+ {
IdentityProvider = IdentityServerConstants.LocalIdentityProvider
}.CreatePrincipal(),
- Client = new Client
+ Client = new Client
{
- IdentityProviderRestrictions = new List
+ IdentityProviderRestrictions = new List
{
IdentityServerConstants.LocalIdentityProvider
}
@@ -102,7 +103,7 @@ public async Task Authenticated_User_with_restricted_current_Idp_must_SignIn()
Client = new Client
{
EnableLocalLogin = false,
- IdentityProviderRestrictions = new List
+ IdentityProviderRestrictions = new List
{
"some_idp"
}
@@ -121,7 +122,7 @@ public async Task Authenticated_User_with_allowed_requested_Idp_must_not_SignIn(
{
ClientId = "foo",
Client = new Client(),
- AuthenticationContextReferenceClasses = new List{
+ AuthenticationContextReferenceClasses = new List{
"idp:" + IdentityServerConstants.LocalIdentityProvider
},
Subject = new IdentityServerUser("123")
@@ -162,7 +163,8 @@ public async Task Authenticated_User_within_client_user_sso_lifetime_should_not_
var request = new ValidatedAuthorizeRequest
{
ClientId = "foo",
- Client = new Client() {
+ Client = new Client()
+ {
UserSsoLifetime = 3600 // 1h
},
Subject = new IdentityServerUser("123")
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Services/Default/DefaultClaimsServiceTests.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Services/Default/DefaultClaimsServiceTests.cs
index e5c1432a6..3ce55977d 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Services/Default/DefaultClaimsServiceTests.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Services/Default/DefaultClaimsServiceTests.cs
@@ -6,7 +6,7 @@
using System.Security.Claims;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Common;
using IdentityServer4;
using IdentityServer4.Configuration;
@@ -178,7 +178,7 @@ public async Task GetAccessTokenClaimsAsync_should_contain_scopes()
scopes.Count().Should().Be(4);
scopes.ToArray().Should().BeEquivalentTo(new string[] { "api1", "api2", "id1", "id2" });
}
-
+
[Fact]
public async Task GetAccessTokenClaimsAsync_should_contain_parameterized_scope_values()
{
@@ -206,7 +206,7 @@ public async Task GetAccessTokenClaimsAsync_when_no_ApiScopes_should_not_contain
var scopes = claims.Where(x => x.Type == JwtClaimTypes.Scope).Select(x => x.Value);
scopes.Count().Should().Be(0);
}
-
+
[Fact]
public async Task GetAccessTokenClaimsAsync_should_only_consider_parsed_scope_values_and_not_ApiScope()
{
@@ -245,7 +245,7 @@ public async Task GetAccessTokenClaimsAsync_when_multiple_resources_with_same_sc
scopes.Count().Should().Be(1);
scopes.ToArray().Should().BeEquivalentTo(new string[] { "resource" });
}
-
+
[Fact]
public async Task GetAccessTokenClaimsAsync_should_contain_offline_scope()
{
@@ -351,7 +351,7 @@ public async Task GetAccessTokenClaimsAsync_should_request_both_api_and_api_scop
new ApiResource("api")
{
UserClaims = { "foo" },
- Scopes = { "api1" }
+ Scopes = { "api1" }
}
);
_resources.ApiScopes.Add(
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Services/Default/DefaultConsentServiceTests.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Services/Default/DefaultConsentServiceTests.cs
index 2de92f8f9..f541e02d7 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Services/Default/DefaultConsentServiceTests.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Services/Default/DefaultConsentServiceTests.cs
@@ -7,7 +7,7 @@
using System.Security.Claims;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Common;
using IdentityServer4;
using IdentityServer4.Extensions;
@@ -70,7 +70,7 @@ public async Task UpdateConsentAsync_when_client_does_not_allow_remember_consent
{
_client.AllowRememberConsent = false;
- await _subject.UpdateConsentAsync(_user, _client, new [] { new ParsedScopeValue("scope1"), new ParsedScopeValue("scope2") });
+ await _subject.UpdateConsentAsync(_user, _client, new[] { new ParsedScopeValue("scope1"), new ParsedScopeValue("scope2") });
var consent = await _userConsentStore.GetUserConsentAsync(_user.GetSubjectId(), _client.ClientId);
consent.Should().BeNull();
@@ -157,7 +157,7 @@ public async Task RequiresConsentAsync_prior_consent_with_more_scopes_should_not
{
await _subject.UpdateConsentAsync(_user, _client, new[] { new ParsedScopeValue("scope1"), new ParsedScopeValue("scope2"), new ParsedScopeValue("scope3") });
- var result = await _subject.RequiresConsentAsync(_user, _client, new [] { new ParsedScopeValue("scope2") });
+ var result = await _subject.RequiresConsentAsync(_user, _client, new[] { new ParsedScopeValue("scope2") });
result.Should().BeFalse();
}
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Services/Default/DefaultTokenServiceTests.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Services/Default/DefaultTokenServiceTests.cs
index e95c12301..5c680b647 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Services/Default/DefaultTokenServiceTests.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Services/Default/DefaultTokenServiceTests.cs
@@ -5,7 +5,7 @@
using System.Linq;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Common;
using IdentityServer4.Configuration;
using IdentityServer4.Models;
@@ -51,12 +51,13 @@ public DefaultTokenServiceTests()
[Fact]
public async Task CreateAccessTokenAsync_should_include_aud_for_each_ApiResource()
{
- var request = new TokenCreationRequest {
+ var request = new TokenCreationRequest
+ {
ValidatedResources = new ResourceValidationResult()
{
Resources = new Resources()
{
- ApiResources =
+ ApiResources =
{
new ApiResource("api1"){ Scopes = { "scope1" } },
new ApiResource("api2"){ Scopes = { "scope2" } },
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Services/Default/NumericUserCodeServiceTests.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Services/Default/NumericUserCodeServiceTests.cs
index aa1985c1c..5a24bac07 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Services/Default/NumericUserCodeServiceTests.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Services/Default/NumericUserCodeServiceTests.cs
@@ -1,6 +1,6 @@
-using System.Threading.Tasks;
using FluentAssertions;
using IdentityServer4.Services;
+using System.Threading.Tasks;
using Xunit;
namespace IdentityServer.UnitTests.Services.Default
@@ -15,8 +15,8 @@ public async Task GenerateAsync_should_return_expected_code()
var userCode = await sut.GenerateAsync();
var userCodeInt = int.Parse(userCode);
- userCodeInt.Should().BeGreaterOrEqualTo(100000000);
- userCodeInt.Should().BeLessOrEqualTo(999999999);
+ userCodeInt.Should().BeGreaterThanOrEqualTo(100000000);
+ userCodeInt.Should().BeLessThanOrEqualTo(999999999);
}
}
}
\ No newline at end of file
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AccessTokenValidation.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AccessTokenValidation.cs
index 3cb1b44f7..162b60b39 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AccessTokenValidation.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AccessTokenValidation.cs
@@ -7,7 +7,7 @@
using System.Linq;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Common;
using IdentityServer.UnitTests.Validation.Setup;
using IdentityServer4.Configuration;
@@ -129,7 +129,7 @@ public async Task Expired_Reference_Token()
now = DateTime.UtcNow;
var store = Factory.CreateReferenceTokenStore();
- var validator = Factory.CreateTokenValidator(store, clock:_clock);
+ var validator = Factory.CreateTokenValidator(store, clock: _clock);
var token = TokenFactory.CreateAccessToken(new Client { ClientId = "roclient" }, "valid", 2, "read", "write");
token.CreationTime = now;
@@ -168,7 +168,7 @@ public async Task Valid_JWT_Token()
result.IsError.Should().BeFalse();
}
-
+
[Theory]
[InlineData(true)]
[InlineData(false)]
@@ -177,7 +177,7 @@ public async Task JWT_Token_with_scopes_have_expected_claims(bool flag)
{
var options = TestIdentityServerOptions.Create();
options.EmitScopesAsSpaceDelimitedStringInJwt = flag;
-
+
var signer = Factory.CreateDefaultTokenCreator(options);
var jwt = await signer.CreateTokenAsync(TokenFactory.CreateAccessToken(new Client { ClientId = "roclient" }, "valid", 600, "read", "write"));
@@ -194,7 +194,7 @@ public async Task JWT_Token_with_scopes_have_expected_claims(bool flag)
scopes[0].Should().Be("read");
scopes[1].Should().Be("write");
}
-
+
[Fact]
[Trait("Category", Category)]
public async Task JWT_Token_invalid_Issuer()
@@ -217,7 +217,7 @@ public async Task JWT_Token_Too_Long()
{
var signer = Factory.CreateDefaultTokenCreator();
var jwt = await signer.CreateTokenAsync(TokenFactory.CreateAccessTokenLong(new Client { ClientId = "roclient" }, "valid", 600, 1000, "read", "write"));
-
+
var validator = Factory.CreateTokenValidator(null);
var result = await validator.ValidateAccessTokenAsync(jwt);
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ClientValidation_Code.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ClientValidation_Code.cs
index a58cef9fb..737495f83 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ClientValidation_Code.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ClientValidation_Code.cs
@@ -5,7 +5,7 @@
using System.Collections.Specialized;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Common;
using IdentityServer.UnitTests.Validation.Setup;
using IdentityServer4.Configuration;
@@ -29,7 +29,7 @@ public async Task Code_Request_Unknown_Scope()
var validator = Factory.CreateAuthorizeRequestValidator();
var result = await validator.ValidateAsync(parameters);
-
+
result.IsError.Should().BeTrue();
result.Error.Should().Be(OidcConstants.AuthorizeErrors.InvalidScope);
}
@@ -46,7 +46,7 @@ public async Task OpenId_Code_Request_Invalid_RedirectUri()
var validator = Factory.CreateAuthorizeRequestValidator();
var result = await validator.ValidateAsync(parameters);
-
+
result.IsError.Should().BeTrue();
result.Error.Should().Be(OidcConstants.AuthorizeErrors.InvalidRequest);
}
@@ -64,7 +64,7 @@ public async Task OpenId_Code_Request_Invalid_IdToken_ResponseType()
var validator = Factory.CreateAuthorizeRequestValidator();
var result = await validator.ValidateAsync(parameters);
-
+
result.IsError.Should().BeTrue();
result.Error.Should().Be(OidcConstants.AuthorizeErrors.UnauthorizedClient);
}
@@ -82,7 +82,7 @@ public async Task OpenId_Code_Request_Invalid_IdTokenToken_ResponseType()
var validator = Factory.CreateAuthorizeRequestValidator();
var result = await validator.ValidateAsync(parameters);
-
+
result.IsError.Should().BeTrue();
result.Error.Should().Be(OidcConstants.AuthorizeErrors.UnauthorizedClient);
}
@@ -99,7 +99,7 @@ public async Task OpenId_Code_Request_With_Unknown_Client()
var validator = Factory.CreateAuthorizeRequestValidator();
var result = await validator.ValidateAsync(parameters);
-
+
result.IsError.Should().BeTrue();
result.Error.Should().Be(OidcConstants.AuthorizeErrors.UnauthorizedClient);
}
@@ -116,7 +116,7 @@ public async Task OpenId_Code_Request_With_Restricted_Scope()
var validator = Factory.CreateAuthorizeRequestValidator();
var result = await validator.ValidateAsync(parameters);
-
+
result.IsError.Should().BeTrue();
result.Error.Should().Be(OidcConstants.AuthorizeErrors.InvalidScope);
}
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ClientValidation_IdToken.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ClientValidation_IdToken.cs
index 5a2de7fe5..bd0460202 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ClientValidation_IdToken.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ClientValidation_IdToken.cs
@@ -5,7 +5,7 @@
using System.Collections.Specialized;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Common;
using IdentityServer.UnitTests.Validation.Setup;
using IdentityServer4.Configuration;
@@ -31,7 +31,7 @@ public async Task Mixed_IdToken_Request()
var validator = Factory.CreateAuthorizeRequestValidator();
var result = await validator.ValidateAsync(parameters);
-
+
result.IsError.Should().BeTrue();
result.Error.Should().Be(OidcConstants.AuthorizeErrors.InvalidScope);
}
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ClientValidation_Invalid.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ClientValidation_Invalid.cs
index 3829cc1ad..385560229 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ClientValidation_Invalid.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ClientValidation_Invalid.cs
@@ -5,7 +5,7 @@
using System.Collections.Specialized;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Common;
using IdentityServer.UnitTests.Validation.Setup;
using IdentityServer4.Configuration;
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ClientValidation_Token.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ClientValidation_Token.cs
index 533b2e831..7d58930d3 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ClientValidation_Token.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ClientValidation_Token.cs
@@ -5,7 +5,7 @@
using System.Collections.Specialized;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Common;
using IdentityServer.UnitTests.Validation.Setup;
using IdentityServer4.Configuration;
@@ -31,7 +31,7 @@ public async Task Mixed_Token_Request_Without_OpenId_Scope()
var validator = Factory.CreateAuthorizeRequestValidator();
var result = await validator.ValidateAsync(parameters);
-
+
result.IsError.Should().BeTrue();
result.Error.Should().Be(OidcConstants.AuthorizeErrors.InvalidScope);
}
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ClientValidation_Valid.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ClientValidation_Valid.cs
index c6893bef4..50a923962 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ClientValidation_Valid.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ClientValidation_Valid.cs
@@ -5,7 +5,7 @@
using System.Collections.Specialized;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Common;
using IdentityServer.UnitTests.Validation.Setup;
using IdentityServer4.Configuration;
@@ -31,7 +31,7 @@ public async Task Valid_OpenId_Code_Request()
var validator = Factory.CreateAuthorizeRequestValidator();
var result = await validator.ValidateAsync(parameters);
-
+
result.IsError.Should().BeFalse();
}
@@ -47,7 +47,7 @@ public async Task Valid_Resource_Code_Request()
var validator = Factory.CreateAuthorizeRequestValidator();
var result = await validator.ValidateAsync(parameters);
-
+
result.IsError.Should().BeFalse();
}
@@ -63,7 +63,7 @@ public async Task Valid_Mixed_Code_Request()
var validator = Factory.CreateAuthorizeRequestValidator();
var result = await validator.ValidateAsync(parameters);
-
+
result.IsError.Should().BeFalse();
}
@@ -79,7 +79,7 @@ public async Task Valid_Mixed_Code_Request_Multiple_Scopes()
var validator = Factory.CreateAuthorizeRequestValidator();
var result = await validator.ValidateAsync(parameters);
-
+
result.IsError.Should().BeFalse();
}
@@ -181,7 +181,7 @@ public async Task Valid_Mixed_IdTokenToken_Request()
var validator = Factory.CreateAuthorizeRequestValidator();
var result = await validator.ValidateAsync(parameters);
-
+
result.IsError.Should().BeFalse();
}
@@ -198,7 +198,7 @@ public async Task Valid_Mixed_IdTokenToken_Request_Multiple_Scopes()
var validator = Factory.CreateAuthorizeRequestValidator();
var result = await validator.ValidateAsync(parameters);
-
+
result.IsError.Should().BeFalse();
}
@@ -214,7 +214,7 @@ public async Task Valid_Resource_Token_Request()
var validator = Factory.CreateAuthorizeRequestValidator();
var result = await validator.ValidateAsync(parameters);
-
+
result.IsError.Should().BeFalse();
}
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ProtocolValidation_CustomValidator.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ProtocolValidation_CustomValidator.cs
index d4ada7e39..8291d7d84 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ProtocolValidation_CustomValidator.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ProtocolValidation_CustomValidator.cs
@@ -6,7 +6,7 @@
using System.Collections.Specialized;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Validation.Setup;
using IdentityServer4.Validation;
using Xunit;
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ProtocolValidation_Invalid.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ProtocolValidation_Invalid.cs
index 90e687c68..abb0f6928 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ProtocolValidation_Invalid.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ProtocolValidation_Invalid.cs
@@ -6,7 +6,7 @@
using System.Collections.Specialized;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Validation.Setup;
using IdentityServer4;
using Xunit;
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ProtocolValidation_PKCE.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ProtocolValidation_PKCE.cs
index 73c593ebb..04a6a6169 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ProtocolValidation_PKCE.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ProtocolValidation_PKCE.cs
@@ -5,7 +5,7 @@
using System.Collections.Specialized;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Common;
using IdentityServer.UnitTests.Validation.Setup;
using IdentityServer4.Configuration;
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ProtocolValidation_Valid.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ProtocolValidation_Valid.cs
index a0e093146..7b42cd91a 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ProtocolValidation_Valid.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/AuthorizeRequest Validation/Authorize_ProtocolValidation_Valid.cs
@@ -6,7 +6,7 @@
using System.Linq;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Validation.Setup;
using IdentityServer4;
using Xunit;
@@ -185,7 +185,7 @@ public async Task anonymous_user_should_produce_session_state_value()
result.ValidatedRequest.SessionId.Should().NotBeNull();
}
-
+
[Fact]
[Trait("Category", Category)]
public async Task multiple_prompt_values_should_be_accepted()
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/DeviceAuthorizationRequestValidation.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/DeviceAuthorizationRequestValidation.cs
index 49fa646ea..9e54d54bd 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/DeviceAuthorizationRequestValidation.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/DeviceAuthorizationRequestValidation.cs
@@ -7,7 +7,7 @@
using System.Linq;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Validation.Setup;
using IdentityServer4;
using IdentityServer4.Models;
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/DeviceCodeValidation.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/DeviceCodeValidation.cs
index 828d8b587..b8f83cdf1 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/DeviceCodeValidation.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/DeviceCodeValidation.cs
@@ -6,7 +6,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Validation.Setup;
using IdentityServer4;
using IdentityServer4.Models;
@@ -231,10 +231,10 @@ public async Task Valid_DeviceCode()
var request = new ValidatedTokenRequest();
request.SetClient(client);
- var context = new DeviceCodeValidationContext {DeviceCode = handle, Request = request};
+ var context = new DeviceCodeValidationContext { DeviceCode = handle, Request = request };
await validator.ValidateAsync(context);
-
+
context.Result.IsError.Should().BeFalse();
}
}
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/IdentityTokenValidation.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/IdentityTokenValidation.cs
index ab5adce23..cd17eb311 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/IdentityTokenValidation.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/IdentityTokenValidation.cs
@@ -5,7 +5,7 @@
using System.IdentityModel.Tokens.Jwt;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Validation.Setup;
using Xunit;
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/RevocationRequestValidation.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/RevocationRequestValidation.cs
index bb7d71427..5d7dc36c7 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/RevocationRequestValidation.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/RevocationRequestValidation.cs
@@ -6,7 +6,7 @@
using System.Collections.Specialized;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Common;
using IdentityServer4;
using IdentityServer4.Models;
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/Secrets/PrivateKeyJwtSecretValidation.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/Secrets/PrivateKeyJwtSecretValidation.cs
index 7d4886b6f..8a8d4dd75 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/Secrets/PrivateKeyJwtSecretValidation.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/Secrets/PrivateKeyJwtSecretValidation.cs
@@ -8,7 +8,7 @@
using System.Security.Claims;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Common;
using IdentityServer.UnitTests.Services.Default;
using IdentityServer.UnitTests.Validation.Setup;
@@ -34,11 +34,11 @@ public PrivateKeyJwtSecretValidation()
_validator = new PrivateKeyJwtSecretValidator(
new MockHttpContextAccessor(
new IdentityServerOptions()
- {
- IssuerUri = "https://idsrv3.com"
- }
+ {
+ IssuerUri = "https://idsrv3.com"
+ }
),
- new DefaultReplayCache(new TestCache()),
+ new DefaultReplayCache(new TestCache()),
new LoggerFactory().CreateLogger()
);
_clients = new InMemoryClientStore(ClientValidationTestClients.Get());
@@ -122,14 +122,14 @@ public async Task Valid_Certificate_Base64()
result.Success.Should().BeTrue();
}
-
+
[Fact]
public async Task Invalid_Replay()
{
var clientId = "certificate_base64_valid";
var client = await _clients.FindEnabledClientByIdAsync(clientId);
var token = new JwtSecurityTokenHandler().WriteToken(CreateToken(clientId));
-
+
var secret = new ParsedSecret
{
Id = clientId,
@@ -139,7 +139,7 @@ public async Task Invalid_Replay()
var result = await _validator.ValidateAsync(client.ClientSecrets, secret);
result.Success.Should().BeTrue();
-
+
result = await _validator.ValidateAsync(client.ClientSecrets, secret);
result.Success.Should().BeFalse();
}
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/Setup/TokenFactory.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/Setup/TokenFactory.cs
index dfb4516de..6afb5244c 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/Setup/TokenFactory.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/Setup/TokenFactory.cs
@@ -6,7 +6,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Common;
using IdentityServer4.Models;
@@ -16,7 +16,7 @@ internal static class TokenFactory
{
public static Token CreateAccessToken(Client client, string subjectId, int lifetime, params string[] scopes)
{
- var claims = new List
+ var claims = new List
{
new Claim("client_id", client.ClientId),
new Claim("sub", subjectId)
@@ -71,7 +71,7 @@ public static Token CreateIdentityToken(string clientId, string subjectId)
{
var clients = Factory.CreateClientStore();
- var claims = new List
+ var claims = new List
{
new Claim("sub", subjectId)
};
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_ClientCredentials_Invalid.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_ClientCredentials_Invalid.cs
index c758a8571..16cd8229c 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_ClientCredentials_Invalid.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_ClientCredentials_Invalid.cs
@@ -6,7 +6,7 @@
using System.Linq;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Validation.Setup;
using IdentityServer4.Stores;
using Xunit;
@@ -55,7 +55,7 @@ public async Task Request_should_succeed_even_with_allowed_identity_scopes_becau
result.ValidatedRequest.ValidatedResources.Resources.ApiResources.First().Name.Should().Be("api");
result.ValidatedRequest.ValidatedResources.Resources.ApiScopes.Count.Should().Be(2);
- result.ValidatedRequest.ValidatedResources.Resources.ApiScopes.Select(x=>x.Name).Should().BeEquivalentTo(new[] { "resource", "resource2" });
+ result.ValidatedRequest.ValidatedResources.Resources.ApiScopes.Select(x => x.Name).Should().BeEquivalentTo(new[] { "resource", "resource2" });
}
[Fact]
@@ -64,7 +64,7 @@ public async Task Unknown_Scope()
{
var client = await _clients.FindEnabledClientByIdAsync("client");
var validator = Factory.CreateTokenRequestValidator();
-
+
var parameters = new NameValueCollection();
parameters.Add(OidcConstants.TokenRequest.GrantType, OidcConstants.GrantTypes.ClientCredentials);
parameters.Add(OidcConstants.TokenRequest.Scope, "unknown");
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_Code_Invalid.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_Code_Invalid.cs
index f3293feec..89a1254f6 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_Code_Invalid.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_Code_Invalid.cs
@@ -8,7 +8,7 @@
using System.Security.Claims;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Common;
using IdentityServer.UnitTests.Validation.Setup;
using IdentityServer4;
@@ -363,7 +363,7 @@ public async Task Reused_AuthorizationCode()
// request second time
validator = Factory.CreateTokenRequestValidator(
authorizationCodeStore: store);
-
+
result = await validator.ValidateRequestAsync(parameters, client.ToValidationResult());
result.IsError.Should().BeTrue();
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_DeviceCode_Invalid.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_DeviceCode_Invalid.cs
index da5b063b3..4d5979400 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_DeviceCode_Invalid.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_DeviceCode_Invalid.cs
@@ -6,7 +6,7 @@
using System.Collections.Specialized;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Common;
using IdentityServer.UnitTests.Validation.Setup;
using IdentityServer4;
@@ -31,7 +31,7 @@ public class TokenRequestValidation_DeviceCode_Invalid
IsOpenId = true,
Lifetime = 300,
CreationTime = DateTime.UtcNow,
- AuthorizedScopes = new[] {"openid", "profile", "resource"}
+ AuthorizedScopes = new[] { "openid", "profile", "resource" }
};
[Fact]
@@ -51,7 +51,7 @@ public async Task Missing_DeviceCode()
result.IsError.Should().BeTrue();
result.Error.Should().Be(OidcConstants.TokenErrors.InvalidRequest);
}
-
+
[Fact]
[Trait("Category", Category)]
public async Task DeviceCode_Too_Long()
@@ -59,7 +59,7 @@ public async Task DeviceCode_Too_Long()
var client = await _clients.FindClientByIdAsync("device_flow");
var longCode = "x".Repeat(new IdentityServerOptions().InputLengthRestrictions.AuthorizationCode + 1);
-
+
var validator = Factory.CreateTokenRequestValidator();
var parameters = new NameValueCollection
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_ExtensionGrants_Invalid.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_ExtensionGrants_Invalid.cs
index 452aa3fda..b5963df7e 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_ExtensionGrants_Invalid.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_ExtensionGrants_Invalid.cs
@@ -5,7 +5,7 @@
using System.Collections.Specialized;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Validation.Setup;
using IdentityServer4.Stores;
using Xunit;
@@ -94,7 +94,7 @@ public async Task inactive_user_should_fail()
};
var result = await validator.ValidateRequestAsync(
- parameters,
+ parameters,
client.ToValidationResult());
result.IsError.Should().BeTrue();
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_General_Invalid.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_General_Invalid.cs
index 19d401569..a620f6a5d 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_General_Invalid.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_General_Invalid.cs
@@ -7,7 +7,7 @@
using System.Security.Claims;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Validation.Setup;
using IdentityServer4;
using IdentityServer4.Models;
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_PKCE.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_PKCE.cs
index 48db2692d..c495d7163 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_PKCE.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_PKCE.cs
@@ -8,7 +8,7 @@
using System.Text;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Common;
using IdentityServer.UnitTests.Validation.Setup;
using IdentityServer4;
@@ -119,7 +119,7 @@ public async Task valid_pkce_token_request_with_sha256_method_should_succeed(str
var verifier = "x".Repeat(lengths.CodeVerifierMinLength);
var challenge = VerifierToSha256CodeChallenge(verifier);
-
+
var code = new AuthorizationCode
{
CreationTime = DateTime.UtcNow,
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_RefreshToken_Invalid.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_RefreshToken_Invalid.cs
index b6fc6b799..0e87ce87b 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_RefreshToken_Invalid.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_RefreshToken_Invalid.cs
@@ -8,7 +8,7 @@
using System.Security.Claims;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Common;
using IdentityServer.UnitTests.Validation.Setup;
using IdentityServer4.Configuration;
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_ResourceOwner_Invalid.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_ResourceOwner_Invalid.cs
index 7594310a6..92795a60f 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_ResourceOwner_Invalid.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_ResourceOwner_Invalid.cs
@@ -5,7 +5,7 @@
using System.Collections.Specialized;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Common;
using IdentityServer.UnitTests.Validation.Setup;
using IdentityServer4.Models;
@@ -168,7 +168,7 @@ public async Task Invalid_ResourceOwner_Credentials()
result.Error.Should().Be(OidcConstants.TokenErrors.InvalidGrant);
result.ErrorDescription.Should().Be("invalid_username_or_password");
}
-
+
[Fact]
[Trait("Category", Category)]
public async Task Missing_ResourceOwner_password_for_user_with_password_should_fail()
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_Valid.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_Valid.cs
index 9133fc1cf..70738fe8c 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_Valid.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/TokenRequest Validation/TokenRequestValidation_Valid.cs
@@ -8,7 +8,7 @@
using System.Security.Claims;
using System.Threading.Tasks;
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Validation.Setup;
using IdentityServer4;
using IdentityServer4.Models;
@@ -40,7 +40,7 @@ public async Task Missing_ResourceOwner_password_for_user_with_no_password_shoul
result.IsError.Should().BeFalse();
result.ValidatedRequest.UserName.Should().Be("bob_no_password");
}
-
+
[Fact]
[Trait("Category", Category)]
public async Task Valid_code_request_should_succeed()
@@ -139,7 +139,7 @@ public async Task Valid_client_credentials_request_with_default_scopes_should_su
var parameters = new NameValueCollection();
parameters.Add(OidcConstants.TokenRequest.GrantType, OidcConstants.GrantTypes.ClientCredentials);
-
+
var result = await validator.ValidateRequestAsync(parameters, client.ToValidationResult());
@@ -322,7 +322,7 @@ public async Task Valid_refresh_token_request_using_restricted_client_should_suc
result.IsError.Should().BeFalse();
}
-
+
[Fact]
[Trait("Category", Category)]
public async Task Valid_device_code_request_should_succeed()
diff --git a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/UserInfoRequestValidation.cs b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/UserInfoRequestValidation.cs
index 061fb2931..bf47a23df 100644
--- a/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/UserInfoRequestValidation.cs
+++ b/src/IdentityServer4/test/IdentityServer.UnitTests/Validation/UserInfoRequestValidation.cs
@@ -3,7 +3,7 @@
using FluentAssertions;
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer.UnitTests.Validation.Setup;
using IdentityServer4.Stores;
using IdentityServer4.Validation;
diff --git a/src/Storage/build/build.csproj b/src/Storage/build/build.csproj
index d1be6f152..120e3ac37 100644
--- a/src/Storage/build/build.csproj
+++ b/src/Storage/build/build.csproj
@@ -2,7 +2,7 @@
Exe
- net7.0
+ net9.0
@@ -13,5 +13,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/src/Storage/src/IdentityServer4.Storage.csproj b/src/Storage/src/IdentityServer4.Storage.csproj
index 1102960e0..9a7cd62b5 100644
--- a/src/Storage/src/IdentityServer4.Storage.csproj
+++ b/src/Storage/src/IdentityServer4.Storage.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
Cnblogs.IdentityServer4.Storage
Storage interfaces and models for IdentityServer4
@@ -15,7 +15,8 @@
true
true
- $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
+
+ $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
../../../key.snk
true
@@ -34,7 +35,7 @@
-
+
diff --git a/src/Storage/src/IdentityServerUser.cs b/src/Storage/src/IdentityServerUser.cs
index 75f96bf5a..4b8ee9fe8 100644
--- a/src/Storage/src/IdentityServerUser.cs
+++ b/src/Storage/src/IdentityServerUser.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using IdentityServer4.Extensions;
using System;
using System.Collections.Generic;
diff --git a/src/Storage/src/Models/Token.cs b/src/Storage/src/Models/Token.cs
index 505e8e7db..7fd59cccb 100644
--- a/src/Storage/src/Models/Token.cs
+++ b/src/Storage/src/Models/Token.cs
@@ -1,8 +1,8 @@
-// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
+// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -48,7 +48,7 @@ public Token(string tokenType)
/// The audiences.
///
public ICollection Audiences { get; set; } = new HashSet();
-
+
///
/// Gets or sets the issuer.
///
@@ -56,7 +56,7 @@ public Token(string tokenType)
/// The issuer.
///
public string Issuer { get; set; }
-
+
///
/// Gets or sets the creation time.
///
@@ -64,7 +64,7 @@ public Token(string tokenType)
/// The creation time.
///
public DateTime CreationTime { get; set; }
-
+
///
/// Gets or sets the lifetime.
///
@@ -104,7 +104,7 @@ public Token(string tokenType)
/// The description.
///
public string Description { get; set; }
-
+
///
/// Gets or sets the claims.
///
diff --git a/src/Storage/src/Stores/Serialization/ClaimsPrincipalConverter.cs b/src/Storage/src/Stores/Serialization/ClaimsPrincipalConverter.cs
index 40d5ed7d9..c9066b32b 100644
--- a/src/Storage/src/Stores/Serialization/ClaimsPrincipalConverter.cs
+++ b/src/Storage/src/Stores/Serialization/ClaimsPrincipalConverter.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
-using IdentityModel;
+using Duende.IdentityModel;
using Newtonsoft.Json;
using System;
using System.Linq;
diff --git a/src/build/Program.Partial.cs b/src/build/Program.Partial.cs
index 070466c8a..a5b4a527b 100644
--- a/src/build/Program.Partial.cs
+++ b/src/build/Program.Partial.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
@@ -32,17 +32,17 @@ static async Task Main(string[] args)
//Run("dotnet", "clean -c Release -v m --nologo", echoPrefix: Prefix);
});
- Target(Targets.Build, DependsOn(Targets.CleanBuildOutput), () =>
+ Target(Targets.Build, dependsOn: [Targets.CleanBuildOutput], () =>
{
Run("dotnet", "build -c Release --nologo", echoPrefix: Prefix);
});
- Target(Targets.SignBinary, DependsOn(Targets.Build), () =>
+ Target(Targets.SignBinary, dependsOn: [Targets.Build], () =>
{
Sign("./src/bin/Release", "*.dll");
});
- Target(Targets.Test, DependsOn(Targets.Build), () =>
+ Target(Targets.Test, dependsOn: [Targets.Build], () =>
{
Run("dotnet", $"test -c Release --no-build", echoPrefix: Prefix);
});
@@ -55,19 +55,19 @@ static async Task Main(string[] args)
}
});
- Target(Targets.Pack, DependsOn(Targets.Build, Targets.CleanPackOutput), () =>
+ Target(Targets.Pack, dependsOn: [Targets.Build, Targets.CleanPackOutput], () =>
{
var project = Directory.GetFiles("./src", "*.csproj", SearchOption.TopDirectoryOnly).OrderBy(_ => _).First();
Run("dotnet", $"pack {project} -c Release -o \"{Directory.CreateDirectory(packOutput).FullName}\" --no-build --nologo", echoPrefix: Prefix);
});
- Target(Targets.SignPackage, DependsOn(Targets.Pack), () =>
+ Target(Targets.SignPackage, dependsOn: [Targets.Pack], () =>
{
Sign(packOutput, "*.nupkg");
});
- Target(Targets.CopyPackOutput, DependsOn(Targets.Pack), () =>
+ Target(Targets.CopyPackOutput, dependsOn: [Targets.Pack], () =>
{
Directory.CreateDirectory(packOutputCopy);
@@ -77,13 +77,13 @@ static async Task Main(string[] args)
}
});
- Target("quick", DependsOn(Targets.CopyPackOutput));
+ Target("quick", dependsOn: [Targets.CopyPackOutput]);
- Target("default", DependsOn(Targets.Test, Targets.CopyPackOutput));
+ Target("default", dependsOn: [Targets.Test, Targets.CopyPackOutput]);
- Target("sign", DependsOn(Targets.SignBinary, Targets.Test, Targets.SignPackage, Targets.CopyPackOutput));
+ Target("sign", dependsOn: [Targets.SignBinary, Targets.Test, Targets.SignPackage, Targets.CopyPackOutput]);
- await RunTargetsAndExitAsync(args, ex => ex is SimpleExec.ExitCodeException || ex.Message.EndsWith(envVarMissing), ()=> Prefix);
+ await RunTargetsAndExitAsync(args, ex => ex is SimpleExec.ExitCodeException || ex.Message.EndsWith(envVarMissing), () => Prefix);
}
private static void Sign(string path, string searchTerm)