Skip to content

Commit af43e73

Browse files
authored
Upgrade IdentityServer v4 to latest version of v4 (#157)
1 parent 48a69d3 commit af43e73

212 files changed

Lines changed: 50991 additions & 15049 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/openactive-test-suite.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ jobs:
3131
uses: actions/setup-dotnet@v1
3232
with:
3333
dotnet-version: 2.1.808
34-
- name: Setup .NET Core 3.0.103 for Authentication Authority Reference Implementation
34+
- name: Setup .NET Core SDK 3.1.411 for Authentication Authority Reference Implementation
3535
uses: actions/setup-dotnet@v1
3636
with:
37-
dotnet-version: 3.0.103
37+
dotnet-version: 3.1.411
3838
- name: Setup Node.js 14.x
3939
uses: actions/setup-node@v1
4040
with:
@@ -154,10 +154,10 @@ jobs:
154154
uses: actions/setup-dotnet@v1
155155
with:
156156
dotnet-version: 2.1.808
157-
- name: Setup .NET Core 3.0.103 for Authentication Authority Reference Implementation
157+
- name: Setup .NET Core SDK 3.1.411 for Authentication Authority Reference Implementation
158158
uses: actions/setup-dotnet@v1
159159
with:
160-
dotnet-version: 3.0.103
160+
dotnet-version: 3.1.411
161161
# Run dotnet build and publish
162162
- name: Install OpenActive.Server.NET dependencies
163163
run: dotnet restore

Examples/BookingSystem.AspNetCore.IdentityServer/BookingSystem.AspNetCore.IdentityServer.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.0</TargetFramework>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="IdentityServer4" Version="3.0.1" />
8+
<PackageReference Include="IdentityServer4" Version="4.1.2" />
99

1010
<PackageReference Include="Serilog" Version="2.9.0" />
1111
<PackageReference Include="Serilog.AspNetCore" Version="3.1.0" />

Examples/BookingSystem.AspNetCore.IdentityServer/Custom/Account/ExternalController.cs

Lines changed: 0 additions & 251 deletions
This file was deleted.

Examples/BookingSystem.AspNetCore.IdentityServer/Custom/Grants/BookingPartnerViewModel.cs renamed to Examples/BookingSystem.AspNetCore.IdentityServer/Custom/BookingPartners/BookingPartnerViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
using System.Linq;
88
using System.Threading.Tasks;
99

10-
namespace src
10+
namespace IdentityServer
1111
{
1212
public class BookingPartnerViewModel
1313
{

Examples/BookingSystem.AspNetCore.IdentityServer/Custom/Grants/BookingPartnersController.cs renamed to Examples/BookingSystem.AspNetCore.IdentityServer/Custom/BookingPartners/BookingPartnersController.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
using IdentityServer4.Extensions;
1111
using OpenActive.FakeDatabase.NET;
1212
using System;
13-
using IdentityServer;
13+
using IdentityServerHost.Quickstart.UI;
14+
using IdentityServer4.Models;
15+
using System.Collections.Generic;
1416

15-
namespace src
17+
namespace IdentityServer
1618
{
1719
/// <summary>
1820
/// This sample controller allows a user to revoke grants given to clients
@@ -144,16 +146,12 @@ public async Task<IActionResult> RegenerateKey([FromForm] string clientId)
144146
/// <summary>
145147
/// Handle postback to generate a registration key, and a new client secret
146148
/// </summary>
147-
[HttpPost("regenerate-all-keys")]
149+
[HttpPost("reset-client-credentials")]
148150
[ValidateAntiForgeryToken]
149-
public async Task<IActionResult> RegenerateAllKeys([FromForm] string clientId)
151+
public async Task<IActionResult> ResetClientCredentials([FromForm] string clientId)
150152
{
151153
var bookingPartner = await BookingPartnerTable.GetByClientId(clientId);
152-
await BookingPartnerTable.ResetKey(clientId, KeyGenerator.GenerateInitialAccessToken(bookingPartner.Name));
153-
154-
// TODO: Is this cached in memory, does it need updating??
155-
//var client = await _clients.FindClientByIdAsync(clientId);
156-
//client.ClientSecrets = new List<Secret>() { new Secret(clientSecret.Sha256()) };
154+
await BookingPartnerTable.ResetCredentials(clientId, KeyGenerator.GenerateInitialAccessToken(bookingPartner.Name));
157155

158156
return Redirect($"/booking-partners/edit/{clientId}");
159157
}

Examples/BookingSystem.AspNetCore.IdentityServer/Custom/Client/ClientStore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ private static Client ConvertToIs4Client(BookingPartnerTable bookingPartner)
2828
AllowedGrantTypes = bookingPartner.GrantTypes == null ? new List<string>() : bookingPartner.GrantTypes.ToList(),
2929
ClientSecrets = bookingPartner.ClientSecret == null ? new List<Secret>() : new List<Secret> { new Secret(bookingPartner.ClientSecret) },
3030
AllowedScopes = bookingPartner.Scope == null ? new List<string>() : bookingPartner.Scope.Split(' ').ToList(),
31-
Claims = bookingPartner.ClientId == null ? new List<System.Security.Claims.Claim>() : new List<System.Security.Claims.Claim>() { new System.Security.Claims.Claim("https://openactive.io/clientId", bookingPartner.ClientId) },
31+
Claims = bookingPartner.ClientId == null ? new List<ClientClaim>() : new List<ClientClaim>() { new ClientClaim("https://openactive.io/clientId", bookingPartner.ClientId) },
3232
ClientClaimsPrefix = "",
3333
AlwaysSendClientClaims = true,
3434
AlwaysIncludeUserClaimsInIdToken = true,

Examples/BookingSystem.AspNetCore.IdentityServer/Custom/Extensions.cs

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)