diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 2d75027..180e3c8 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -25,8 +25,7 @@ jobs:
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
- 6.0.x
- 7.0.x
+ 9.0.x
- run: dotnet --info
@@ -38,5 +37,4 @@ jobs:
env:
SignClientSecret: ${{ secrets.SIGNCLIENTSECRET }}
run: |
- ./build.cmd sign
- dotnet nuget push .\artifacts\*.nupkg -s https://www.myget.org/F/identity/api/v2/package -k ${{ secrets.MYGET }}
\ No newline at end of file
+ ./build.cmd sign
\ No newline at end of file
diff --git a/build/Program.cs b/build/Program.cs
index 77a7d08..484fe63 100644
--- a/build/Program.cs
+++ b/build/Program.cs
@@ -1,5 +1,6 @@
using System;
using System.IO;
+using System.Threading.Tasks;
using static Bullseye.Targets;
using static SimpleExec.Command;
@@ -22,7 +23,7 @@ private static class Targets
public const string SignPackage = "sign-package";
}
- internal static void Main(string[] args)
+ internal static async Task Main(string[] args)
{
Target(Targets.RestoreTools, () =>
{
@@ -34,12 +35,12 @@ internal static void Main(string[] args)
Run("dotnet", "clean -c Release -v m --nologo");
});
- Target(Targets.Build, DependsOn(Targets.CleanBuildOutput), () =>
+ Target(Targets.Build, dependsOn: [Targets.CleanBuildOutput], () =>
{
Run("dotnet", "build -c Release --nologo");
});
- Target(Targets.Test, DependsOn(Targets.Build), () =>
+ Target(Targets.Test, dependsOn: [Targets.Build], () =>
{
Run("dotnet", "test -c Release --no-build --nologo");
});
@@ -52,21 +53,21 @@ internal static void Main(string[] args)
}
});
- Target(Targets.Pack, DependsOn(Targets.Build, Targets.CleanPackOutput), () =>
+ Target(Targets.Pack, dependsOn: [Targets.Build, Targets.CleanPackOutput], () =>
{
Run("dotnet", $"pack ./src/IdentityModel.AspNetCore.OAuth2Introspection.csproj -c Release -o {Directory.CreateDirectory(packOutput).FullName} --no-build --nologo");
});
- Target(Targets.SignPackage, DependsOn(Targets.Pack, Targets.RestoreTools), () =>
+ Target(Targets.SignPackage, dependsOn: [Targets.Pack, Targets.RestoreTools], () =>
{
SignNuGet();
});
- Target("default", DependsOn(Targets.Test, Targets.Pack));
+ Target("default", dependsOn: [Targets.Test, Targets.Pack]);
- Target("sign", DependsOn(Targets.Test, Targets.SignPackage));
+ Target("sign", dependsOn: [Targets.Test, Targets.SignPackage]);
- RunTargetsAndExit(args, ex => ex is SimpleExec.NonZeroExitCodeException || ex.Message.EndsWith(envVarMissing));
+ await RunTargetsAndExitAsync(args, ex => ex is SimpleExec.ExitCodeException || ex.Message.EndsWith(envVarMissing));
}
private static void SignNuGet()
@@ -92,7 +93,7 @@ private static void SignNuGet()
"--azure-key-vault-tenant-id ed3089f0-5401-4758-90eb-066124e2d907 " +
$"--azure-key-vault-client-secret {signClientSecret} " +
"--azure-key-vault-certificate CodeSigning"
- ,noEcho: true);
+ , noEcho: true);
}
}
}
diff --git a/build/build.csproj b/build/build.csproj
index 0fb8f67..1bae3dd 100644
--- a/build/build.csproj
+++ b/build/build.csproj
@@ -2,12 +2,12 @@
Exe
- net6.0
+ net9.0
-
-
+
+
-
+
diff --git a/global.json b/global.json
index b7e9313..ce21b3e 100644
--- a/global.json
+++ b/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "6.0.100",
+ "version": "9.0.203",
"rollForward": "latestMajor",
"allowPrerelease": false
}
diff --git a/src/IdentityModel.AspNetCore.OAuth2Introspection.csproj b/src/IdentityModel.AspNetCore.OAuth2Introspection.csproj
index e29242b..0c8510d 100644
--- a/src/IdentityModel.AspNetCore.OAuth2Introspection.csproj
+++ b/src/IdentityModel.AspNetCore.OAuth2Introspection.csproj
@@ -1,6 +1,6 @@
- net6.0
+ net8.0;net9.0
IdentityModel.AspNetCore.OAuth2Introspection
ASP.NET Core authentication handler for validating tokens using OAuth 2.0 introspection
@@ -11,7 +11,7 @@
Apache-2.0
true
-
+
true
true
@@ -29,7 +29,7 @@
-
-
+
+
diff --git a/src/OAuth2IntrospectionHandler.cs b/src/OAuth2IntrospectionHandler.cs
index 5c25a54..ad35659 100644
--- a/src/OAuth2IntrospectionHandler.cs
+++ b/src/OAuth2IntrospectionHandler.cs
@@ -1,6 +1,12 @@
// Copyright (c) Duende Software. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
+using IdentityModel.Client;
+using Microsoft.AspNetCore.Authentication;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Caching.Distributed;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -8,12 +14,6 @@
using System.Security.Claims;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
-using IdentityModel.Client;
-using Microsoft.AspNetCore.Authentication;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Caching.Distributed;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
namespace IdentityModel.AspNetCore.OAuth2Introspection
{
@@ -33,16 +33,14 @@ public class OAuth2IntrospectionHandler : AuthenticationHandler
/// The options.
/// The URL encoder.
- /// The clock.
/// The logger factory.
/// The cache.
public OAuth2IntrospectionHandler(
IOptionsMonitor options,
UrlEncoder urlEncoder,
- ISystemClock clock,
ILoggerFactory loggerFactory,
IDistributedCache cache = null)
- : base(options, loggerFactory, urlEncoder, clock)
+ : base(options, loggerFactory, urlEncoder)
{
_logger = loggerFactory.CreateLogger();
_cache = cache;
@@ -154,10 +152,10 @@ await _cache.SetClaimsAsync(Options, token, claimsWithExp, Options.CacheDuration
}
private static async Task ReportNonSuccessAndReturn(
- string error,
- HttpContext httpContext,
- AuthenticationScheme scheme,
- OAuth2IntrospectionEvents events,
+ string error,
+ HttpContext httpContext,
+ AuthenticationScheme scheme,
+ OAuth2IntrospectionEvents events,
OAuth2IntrospectionOptions options)
{
var authenticationFailedContext = new AuthenticationFailedContext(httpContext, scheme, options)
@@ -171,11 +169,11 @@ private static async Task ReportNonSuccessAndReturn(
}
private static async Task LoadClaimsForToken(
- string token,
- HttpContext context,
- AuthenticationScheme scheme,
- OAuth2IntrospectionEvents events,
- OAuth2IntrospectionOptions options)
+ string token,
+ HttpContext context,
+ AuthenticationScheme scheme,
+ OAuth2IntrospectionEvents events,
+ OAuth2IntrospectionOptions options)
{
var introspectionClient = await options.IntrospectionClient.Value.ConfigureAwait(false);
using var request = CreateTokenIntrospectionRequest(token, context, scheme, events, options);
@@ -191,10 +189,10 @@ private static async Task LoadClaimsForToken(
}
private static TokenIntrospectionRequest CreateTokenIntrospectionRequest(
- string token,
- HttpContext context,
- AuthenticationScheme scheme,
- OAuth2IntrospectionEvents events,
+ string token,
+ HttpContext context,
+ AuthenticationScheme scheme,
+ OAuth2IntrospectionEvents events,
OAuth2IntrospectionOptions options)
{
if (options.ClientSecret == null && options.ClientAssertionExpirationTime <= DateTime.UtcNow)
@@ -231,10 +229,10 @@ private static TokenIntrospectionRequest CreateTokenIntrospectionRequest(
}
private static async Task CreateTicket(
- IEnumerable claims,
- string token,
- HttpContext httpContext,
- AuthenticationScheme scheme,
+ IEnumerable claims,
+ string token,
+ HttpContext httpContext,
+ AuthenticationScheme scheme,
OAuth2IntrospectionEvents events,
OAuth2IntrospectionOptions options)
{
diff --git a/test/Tests/Introspection.cs b/test/Tests/Introspection.cs
index 60cd78a..4653fd2 100644
--- a/test/Tests/Introspection.cs
+++ b/test/Tests/Introspection.cs
@@ -20,7 +20,6 @@ namespace Tests
{
public class Introspection
{
-
private static readonly string clientId = "client";
private static readonly string clientSecret = "secret";
diff --git a/test/Tests/Tests.csproj b/test/Tests/Tests.csproj
index 504cb48..1313eac 100644
--- a/test/Tests/Tests.csproj
+++ b/test/Tests/Tests.csproj
@@ -1,7 +1,7 @@
-
+
- net6.0;net7.0
+ net9.0
@@ -9,23 +9,15 @@
-
-
+
+
all
-
+
-
-
-
-
-
-
-
+
-
-
-
-
+
+