From f9134583e5001697d9f97043c90b842b768a00b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20G=C3=A9lineau?= Date: Wed, 17 Nov 2021 13:09:43 -0500 Subject: [PATCH 01/11] migrate to packageReference; upgrade xUnit --- .../AccessTokenValidation.Tests.csproj | 97 ++++--------------- .../packages.config | 22 ----- .../AccessTokenValidation.csproj | 58 +++-------- source/AccessTokenValidation/packages.config | 14 --- 4 files changed, 33 insertions(+), 158 deletions(-) delete mode 100644 source/AccessTokenValidation.Tests/packages.config delete mode 100644 source/AccessTokenValidation/packages.config diff --git a/source/AccessTokenValidation.Tests/AccessTokenValidation.Tests.csproj b/source/AccessTokenValidation.Tests/AccessTokenValidation.Tests.csproj index c6bac5a..ee742c7 100644 --- a/source/AccessTokenValidation.Tests/AccessTokenValidation.Tests.csproj +++ b/source/AccessTokenValidation.Tests/AccessTokenValidation.Tests.csproj @@ -1,6 +1,5 @@  - Debug @@ -34,84 +33,16 @@ 4 - - ..\packages\FluentAssertions.4.3.0\lib\net45\FluentAssertions.dll - True - - - ..\packages\FluentAssertions.4.3.0\lib\net45\FluentAssertions.Core.dll - True - - - ..\packages\IdentityModel.1.9.2\lib\net45\IdentityModel.dll - True - - - ..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll - True - - - ..\packages\Microsoft.Owin.Security.3.0.1\lib\net45\Microsoft.Owin.Security.dll - True - - - ..\packages\Microsoft.Owin.Security.Jwt.3.0.1\lib\net45\Microsoft.Owin.Security.Jwt.dll - True - - - ..\packages\Microsoft.Owin.Security.OAuth.3.0.1\lib\net45\Microsoft.Owin.Security.OAuth.dll - True - - - ..\packages\Moq.4.2.1510.2205\lib\net40\Moq.dll - True - - - ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll - True - - - False - ..\packages\Owin.1.0\lib\net40\Owin.dll - - - ..\packages\OwinHttpMessageHandler.1.3.4\lib\net45\OwinHttpMessageHandler.dll - True - - - ..\packages\System.IdentityModel.Tokens.Jwt.4.0.2.206221351\lib\net45\System.IdentityModel.Tokens.Jwt.dll - True - - - ..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll - True - - - ..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll - True - - - ..\packages\xunit.assert.2.1.0\lib\dotnet\xunit.assert.dll - True - - - ..\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll - True - - - ..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll - True - @@ -134,7 +65,6 @@ - @@ -146,14 +76,27 @@ - + + + + + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - \ No newline at end of file diff --git a/source/AccessTokenValidation.Tests/Properties/AssemblyInfo.cs b/source/AccessTokenValidation.Tests/Properties/AssemblyInfo.cs index 0150618..f1d10b9 100644 --- a/source/AccessTokenValidation.Tests/Properties/AssemblyInfo.cs +++ b/source/AccessTokenValidation.Tests/Properties/AssemblyInfo.cs @@ -1,18 +1,6 @@ using System.Reflection; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("AccessTokenValidation.Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Xero")] -[assembly: AssemblyProduct("AccessTokenValidation.Tests")] -[assembly: AssemblyCopyright("Copyright © Xero 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. @@ -20,16 +8,3 @@ // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("647079bd-094e-4e11-abf2-0d66720c1ceb")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/source/AccessTokenValidation/AccessTokenValidation.csproj b/source/AccessTokenValidation/AccessTokenValidation.csproj index f52422e..a20d377 100644 --- a/source/AccessTokenValidation/AccessTokenValidation.csproj +++ b/source/AccessTokenValidation/AccessTokenValidation.csproj @@ -1,76 +1,22 @@ - - - + - Debug - AnyCPU - {DF867B5D-3A9E-443A-B95E-D8F11E2A88A3} - Library - Properties IdentityServer3.AccessTokenValidation BIMOne.IdentityServer3.AccessTokenValidation - v4.8 - 512 - - - true - full - false - ..\..\build\ - DEBUG;TRACE - prompt - 4 + net48 + Access Token Validation Middleware for IdentityServer3 + AccessTokenValidationMiddleware + Copyright © 2015 Dominick Baier, Brock Allen & Contributors ..\..\build\IdentityServer3.AccessTokenValidation.xml - - - pdbonly - true ..\..\build\ - TRACE - prompt - 4 - ..\..\build\IdentityServer3.AccessTokenValidation.xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - default.licenseheader - @@ -79,12 +25,4 @@ - - \ No newline at end of file diff --git a/source/AccessTokenValidation/Properties/AssemblyInfo.cs b/source/AccessTokenValidation/Properties/AssemblyInfo.cs index d96670b..35c6981 100644 --- a/source/AccessTokenValidation/Properties/AssemblyInfo.cs +++ b/source/AccessTokenValidation/Properties/AssemblyInfo.cs @@ -17,18 +17,6 @@ using System.Reflection; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Access Token Validation Middleware for IdentityServer3")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("AccessTokenValidationMiddleware")] -[assembly: AssemblyCopyright("Copyright © 2015 Dominick Baier, Brock Allen & Contributors")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. @@ -36,16 +24,3 @@ // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("703d6b8a-e38d-4aac-a59a-1800a3686243")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] From 575fd21dc92043aa6d872d8947c3491f7f902ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20G=C3=A9lineau?= Date: Wed, 17 Nov 2021 18:31:16 -0500 Subject: [PATCH 08/11] cleanup test csproj --- .../AccessTokenValidation.Tests.csproj | 8 -------- 1 file changed, 8 deletions(-) diff --git a/source/AccessTokenValidation.Tests/AccessTokenValidation.Tests.csproj b/source/AccessTokenValidation.Tests/AccessTokenValidation.Tests.csproj index b24ed37..103d6e6 100644 --- a/source/AccessTokenValidation.Tests/AccessTokenValidation.Tests.csproj +++ b/source/AccessTokenValidation.Tests/AccessTokenValidation.Tests.csproj @@ -7,18 +7,10 @@ Copyright © Xero 2014 ..\..\build\ - - full - - - pdbonly - - - From 04e9a196733aab0197482925508fff297f71f340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20G=C3=A9lineau?= Date: Wed, 17 Nov 2021 18:52:39 -0500 Subject: [PATCH 09/11] a few fixes to make the build work with the new net48 framework and the new BIMOne prefix on the assembly identity. --- default.ps1 | 16 +++++++------- .../AccessTokenValidation.csproj | 8 +++---- .../Properties/AssemblyInfo.cs | 22 ++++++++++++++++++- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/default.ps1 b/default.ps1 index 6c4e727..1a9d79f 100644 --- a/default.ps1 +++ b/default.ps1 @@ -1,7 +1,7 @@ properties { $base_directory = Resolve-Path . $src_directory = "$base_directory\source" - $output_directory = "$base_directory\build" + $output_directory = "$base_directory\build\net48" $dist_directory = "$base_directory\distribution" $sln_file = "$src_directory\IdentityServer3.AccessTokenValidation.sln" $target_config = "Release" @@ -52,19 +52,19 @@ task UpdateVersion { } task ILMerge -depends Compile { - $input_dlls = "$output_directory\IdentityServer.v3.AccessTokenValidation.dll" + $input_dlls = "$output_directory\BIMOne.IdentityServer.v3.AccessTokenValidation.dll" Get-ChildItem -Path $output_directory -Filter *.dll | foreach-object { - # Exclude IdentityServer3.AccessTokenValidation.dll as that will be the primary assembly - if ("$_" -ne "IdentityServer3.AccessTokenValidation.dll" -and + # Exclude BIMOne.IdentityServer3.AccessTokenValidation.dll as that will be the primary assembly + if ("$_" -ne "BIMOne.IdentityServer3.AccessTokenValidation.dll" -and "$_" -ne "Owin.dll") { $input_dlls = "$input_dlls $output_directory\$_" } } - New-Item $dist_directory\lib\net45 -Type Directory - Invoke-Expression "$ilmerge_path /targetplatform:v4 /internalize:ilmerge.exclude /allowDup /target:library /out:$dist_directory\lib\net45\IdentityServer.v3.AccessTokenValidation.dll $input_dlls" + New-Item $dist_directory\lib\net48 -Type Directory + Invoke-Expression "$ilmerge_path /targetplatform:v4 /internalize:ilmerge.exclude /allowDup /target:library /out:$dist_directory\lib\net48\IdentityServer.v3.AccessTokenValidation.dll $input_dlls" } task CreateNuGetPackage -depends Compile { @@ -85,8 +85,8 @@ task CreateNuGetPackage -depends Compile { $packageVersion = $packageVersion + "-build" + $buildNumber.ToString().PadLeft(5,'0') } - New-Item $dist_directory\lib\net45 -Type Directory - copy-item $output_directory\IdentityServer3.AccessTokenValidation.* $dist_directory\lib\net45 + New-Item $dist_directory\lib\net48 -Type Directory + copy-item $output_directory\BIMOne.IdentityServer3.AccessTokenValidation.* $dist_directory\lib\net48 copy-item $src_directory\IdentityServer3.AccessTokenValidation.nuspec $dist_directory exec { . $nuget_path pack $dist_directory\IdentityServer3.AccessTokenValidation.nuspec -BasePath $dist_directory -o $dist_directory -version $packageVersion } diff --git a/source/AccessTokenValidation/AccessTokenValidation.csproj b/source/AccessTokenValidation/AccessTokenValidation.csproj index a20d377..e4bde43 100644 --- a/source/AccessTokenValidation/AccessTokenValidation.csproj +++ b/source/AccessTokenValidation/AccessTokenValidation.csproj @@ -3,11 +3,9 @@ IdentityServer3.AccessTokenValidation BIMOne.IdentityServer3.AccessTokenValidation net48 - Access Token Validation Middleware for IdentityServer3 - AccessTokenValidationMiddleware - Copyright © 2015 Dominick Baier, Brock Allen & Contributors - ..\..\build\IdentityServer3.AccessTokenValidation.xml + ..\..\build\BIMOne.IdentityServer3.AccessTokenValidation.xml ..\..\build\ + false @@ -17,6 +15,8 @@ default.licenseheader + + diff --git a/source/AccessTokenValidation/Properties/AssemblyInfo.cs b/source/AccessTokenValidation/Properties/AssemblyInfo.cs index 35c6981..866f4a7 100644 --- a/source/AccessTokenValidation/Properties/AssemblyInfo.cs +++ b/source/AccessTokenValidation/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright 2015 Dominick Baier, Brock Allen * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,6 +17,18 @@ using System.Reflection; using System.Runtime.InteropServices; +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Access Token Validation Middleware for IdentityServer3")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("AccessTokenValidationMiddleware")] +[assembly: AssemblyCopyright("Copyright © 2015 Dominick Baier, Brock Allen & Contributors")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. @@ -24,3 +36,11 @@ // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("703d6b8a-e38d-4aac-a59a-1800a3686243")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// \ No newline at end of file From 0f31a505a8844062a904898940176bcd9080fb06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20G=C3=A9lineau?= Date: Wed, 17 Nov 2021 21:06:08 -0500 Subject: [PATCH 10/11] increase version; set Newtonsoft.Json dependency version to 11.0.2. --- default.ps1 | 2 +- source/AccessTokenValidation/AccessTokenValidation.csproj | 2 +- source/IdentityServer3.AccessTokenValidation.nuspec | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/default.ps1 b/default.ps1 index 1a9d79f..de164ce 100644 --- a/default.ps1 +++ b/default.ps1 @@ -10,7 +10,7 @@ properties { $nuget_path = "$src_directory\.nuget\nuget.exe" $buildNumber = 0; - $version = "2.15.0.0" + $version = "2.15.1.0" $preRelease = $null } diff --git a/source/AccessTokenValidation/AccessTokenValidation.csproj b/source/AccessTokenValidation/AccessTokenValidation.csproj index e4bde43..e2b75a0 100644 --- a/source/AccessTokenValidation/AccessTokenValidation.csproj +++ b/source/AccessTokenValidation/AccessTokenValidation.csproj @@ -23,6 +23,6 @@ - + \ No newline at end of file diff --git a/source/IdentityServer3.AccessTokenValidation.nuspec b/source/IdentityServer3.AccessTokenValidation.nuspec index 7e9c705..9d679f0 100644 --- a/source/IdentityServer3.AccessTokenValidation.nuspec +++ b/source/IdentityServer3.AccessTokenValidation.nuspec @@ -4,7 +4,7 @@ BIMOne.IdentityServer3.AccessTokenValidation 0.0.0 IdentityServer3 - Access Token Validation (Upgraded for BIM Track) - Brock Allen, Dominick Baier + BIM One Brock Allen, Dominick Baier https://github.com/bimone/IdentityServer3.AccessTokenValidation https://identityserver.github.io/Documentation/assets/images/icons/IDserver_icon128.jpg @@ -24,7 +24,7 @@ - + From 53bf1861556ef85fbc9d6857bdba48b6802d3e1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20G=C3=A9lineau?= Date: Thu, 18 Nov 2021 11:25:48 -0500 Subject: [PATCH 11/11] cleanup --- .../Util/TokenFactory.cs | 7 ++-- ...arerTokenValidationAppBuilderExtensions.cs | 32 ------------------- 2 files changed, 2 insertions(+), 37 deletions(-) diff --git a/source/AccessTokenValidation.Tests/Util/TokenFactory.cs b/source/AccessTokenValidation.Tests/Util/TokenFactory.cs index 2ebdc6b..7133f1a 100644 --- a/source/AccessTokenValidation.Tests/Util/TokenFactory.cs +++ b/source/AccessTokenValidation.Tests/Util/TokenFactory.cs @@ -1,5 +1,4 @@ -using IdentityModel; -using System; +using System; using System.Collections.Generic; using System.IdentityModel.Tokens.Jwt; using System.Linq; @@ -47,10 +46,8 @@ public static JwtSecurityToken CreateToken( } scope?.ToList().ForEach(s => additionalClaims.Add(new Claim("scope", s))); - - var credential = new System.IdentityModel.Tokens.X509SigningCredentials(signingCertificate ?? DefaultSigningCertificate); + var signingKey = new SigningCredentials(new X509SecurityKey(DefaultSigningCertificate), SecurityAlgorithms.RsaSha256Signature); - var token = new JwtSecurityToken( issuer ?? DefaultIssuer, audience ?? DefaultAudience, diff --git a/source/AccessTokenValidation/IdentityServerBearerTokenValidationAppBuilderExtensions.cs b/source/AccessTokenValidation/IdentityServerBearerTokenValidationAppBuilderExtensions.cs index 358003a..f5eeaa9 100644 --- a/source/AccessTokenValidation/IdentityServerBearerTokenValidationAppBuilderExtensions.cs +++ b/source/AccessTokenValidation/IdentityServerBearerTokenValidationAppBuilderExtensions.cs @@ -212,37 +212,5 @@ internal static Lazy ConfigureLocalValidation( }, LazyThreadSafetyMode.PublicationOnly); } - - // public delegate IEnumerable IssuerSigningKeyResolver( - // string token, - // SecurityToken securityToken, - // string kid, - // TokenValidationParameters validationParameters); - // - // private static IEnumerable ResolveRsaKeys( - // string token, - // Microsoft.IdentityModel.Tokens.SecurityToken securityToken, - // SecurityKeyIdentifier keyIdentifier, - // TokenValidationParameters validationParameters) - // { - // string id = null; - // foreach (System.IdentityModel.Tokens.SecurityKeyIdentifierClause keyId in keyIdentifier) - // { - // id = keyId.Id; - // /*var nk = keyId as NamedKeySecurityKeyIdentifierClause; - // if (nk != null) - // { - // id = nk.Id; - // break; - // }*/ - // } - // - // if (id == null) return null; - // - // var issuerToken = validationParameters.key.IssuerSigningTokens.FirstOrDefault(it => it.Id == id); - // if (issuerToken == null) return null; - // - // return issuerToken.SecurityKeys.FirstOrDefault(); - // } } } \ No newline at end of file