diff --git a/Api.Client/Api.Client.csproj b/Api.Client/Api.Client.csproj index 56b787a..436ebf1 100644 --- a/Api.Client/Api.Client.csproj +++ b/Api.Client/Api.Client.csproj @@ -2,7 +2,8 @@ Exe - net5.0 + net6.0 + latest diff --git a/IdentityServer.LdapExtension.Unit/IdentityServer.LdapExtension.Unit.csproj b/IdentityServer.LdapExtension.Unit/IdentityServer.LdapExtension.Unit.csproj index b02eb9f..f51a17c 100644 --- a/IdentityServer.LdapExtension.Unit/IdentityServer.LdapExtension.Unit.csproj +++ b/IdentityServer.LdapExtension.Unit/IdentityServer.LdapExtension.Unit.csproj @@ -1,16 +1,16 @@  - net5.0 - + net6.0 false + latest - - - - + + + + all runtime; build; native; contentfiles; analyzers diff --git a/IdentityServer.LdapExtension/Extensions/LdapUserProfileService.cs b/IdentityServer.LdapExtension/Extensions/LdapUserProfileService.cs index 8d65f32..4bad43a 100644 --- a/IdentityServer.LdapExtension/Extensions/LdapUserProfileService.cs +++ b/IdentityServer.LdapExtension/Extensions/LdapUserProfileService.cs @@ -1,8 +1,8 @@ using System.Linq; using System.Threading.Tasks; -using IdentityServer4.Extensions; -using IdentityServer4.Models; -using IdentityServer4.Services; +using Duende.IdentityServer.Extensions; +using Duende.IdentityServer.Models; +using Duende.IdentityServer.Services; using IdentityServer.LdapExtension.UserModel; using IdentityServer.LdapExtension.UserStore; using Microsoft.Extensions.Logging; diff --git a/IdentityServer.LdapExtension/Extensions/LdapUserResourceOwnerPasswordValidator.cs b/IdentityServer.LdapExtension/Extensions/LdapUserResourceOwnerPasswordValidator.cs index 75ed60c..5686fb2 100644 --- a/IdentityServer.LdapExtension/Extensions/LdapUserResourceOwnerPasswordValidator.cs +++ b/IdentityServer.LdapExtension/Extensions/LdapUserResourceOwnerPasswordValidator.cs @@ -1,7 +1,7 @@ using System; using System.Threading.Tasks; +using Duende.IdentityServer.Validation; using IdentityModel; -using IdentityServer4.Validation; using IdentityServer.LdapExtension.UserModel; using IdentityServer.LdapExtension.UserStore; using Microsoft.AspNetCore.Authentication; diff --git a/IdentityServer.LdapExtension/IdentityServer.LdapExtension.csproj b/IdentityServer.LdapExtension/IdentityServer.LdapExtension.csproj index 579cb76..c123b44 100644 --- a/IdentityServer.LdapExtension/IdentityServer.LdapExtension.csproj +++ b/IdentityServer.LdapExtension/IdentityServer.LdapExtension.csproj @@ -1,11 +1,11 @@  - net5.0;netcoreapp3.1 + net6.0 Nordès Ménard-Lamarre 2.1.14 HoNoSoFt - Extension for IdentityServer 4 in order to use LDAP as a plugin. It is also extensible enough in order to use custom LDAP schema such as OpenLdap or Active Directory. + Extension for Duende IdentityServer in order to use LDAP as a plugin. It is also extensible enough in order to use custom LDAP schema such as OpenLdap or Active Directory. 1.0.0.0 1.0.0.0 true @@ -16,17 +16,19 @@ https://www.honosoft.com/img/logo.png Nordès Ménard-Lamarre https://github.com/Nordes/IdentityServer4.LdapExtension/ - IdentityServer4, Ldap, OpenLdap, ActiveDirectory + IdentityServer4, Ldap, OpenLdap, ActiveDirectory, Duende, IdentityServer true true + latest + 4.1.0 - - + + - + diff --git a/IdentityServer.LdapExtension/LdapUserProfileService.cs b/IdentityServer.LdapExtension/LdapUserProfileService.cs index 721226b..bfcf6ff 100644 --- a/IdentityServer.LdapExtension/LdapUserProfileService.cs +++ b/IdentityServer.LdapExtension/LdapUserProfileService.cs @@ -1,10 +1,10 @@ -using IdentityServer.LdapExtension.UserStore; -using IdentityServer4.Extensions; -using IdentityServer4.Models; -using IdentityServer4.Services; -using Microsoft.Extensions.Logging; -using System.Linq; +using System.Linq; using System.Threading.Tasks; +using IdentityServer.LdapExtension.UserStore; +using Microsoft.Extensions.Logging; +using Duende.IdentityServer.Extensions; +using Duende.IdentityServer.Models; +using Duende.IdentityServer.Services; namespace IdentityServer.LdapExtension { diff --git a/IdentityServer.LdapExtension/Sinks/CustomUserLogoutSuccessEventSink.cs b/IdentityServer.LdapExtension/Sinks/CustomUserLogoutSuccessEventSink.cs index 54007d9..7603ec7 100644 --- a/IdentityServer.LdapExtension/Sinks/CustomUserLogoutSuccessEventSink.cs +++ b/IdentityServer.LdapExtension/Sinks/CustomUserLogoutSuccessEventSink.cs @@ -1,9 +1,8 @@ -using System.Threading.Tasks; -using IdentityServer4.Events; -using IdentityServer4.Services; +using System; +using System.Threading.Tasks; using Microsoft.Extensions.Logging; -using Newtonsoft.Json; -using System; +using Duende.IdentityServer.Events; +using Duende.IdentityServer.Services; namespace IdentityServer.LdapExtension { @@ -24,15 +23,7 @@ public Task PersistAsync(Event evt) { if (evt == null) throw new ArgumentNullException(nameof(evt)); - var json = JsonConvert.SerializeObject(evt); - _log.LogInformation(json); - - return Task.CompletedTask; - // Not working at the moment. In the doc it says to register the DI, but it still not work. - _log.LogDebug(evt.EventType.ToString()); - _log.LogDebug(evt.Id.ToString()); - _log.LogDebug(evt.Name); - _log.LogDebug(evt.Message); + _log.LogInformation("Event details: {@Event}", evt); return Task.CompletedTask; } diff --git a/IdentityServer.LdapExtension/UserStore/InMemoryUserStore.cs b/IdentityServer.LdapExtension/UserStore/InMemoryUserStore.cs index 2c93a2f..903b996 100644 --- a/IdentityServer.LdapExtension/UserStore/InMemoryUserStore.cs +++ b/IdentityServer.LdapExtension/UserStore/InMemoryUserStore.cs @@ -1,8 +1,7 @@ -using IdentityModel; +using System.Collections.Generic; +using IdentityModel; using IdentityServer.LdapExtension.Exceptions; using IdentityServer.LdapExtension.UserModel; -using System; -using System.Collections.Generic; using System.IdentityModel.Tokens.Jwt; using System.Linq; using System.Security.Claims; diff --git a/IdentityServer.LdapExtension/UserStore/RedisUserStore.cs b/IdentityServer.LdapExtension/UserStore/RedisUserStore.cs index cf2158c..cf23098 100644 --- a/IdentityServer.LdapExtension/UserStore/RedisUserStore.cs +++ b/IdentityServer.LdapExtension/UserStore/RedisUserStore.cs @@ -1,14 +1,13 @@ -using IdentityModel; +using System; +using System.Collections.Generic; +using IdentityModel; using IdentityServer.LdapExtension.UserModel; -using IdentityServer4.Stores.Serialization; using Microsoft.Extensions.Logging; -using Newtonsoft.Json; using StackExchange.Redis; -using System; -using System.Collections.Generic; using System.IdentityModel.Tokens.Jwt; using System.Linq; using System.Security.Claims; +using System.Text.Json; namespace IdentityServer.LdapExtension.UserStore { @@ -27,11 +26,6 @@ public class RedisUserStore : ILdapUserStore private readonly ILdapService _authenticationService; private readonly ILogger> _logger; private IConnectionMultiplexer _redis; - private readonly JsonSerializerSettings _jsonSerializerSettings = new JsonSerializerSettings - { - Converters = new List { new ClaimConverter() }, - Formatting = Formatting.Indented - }; private TimeSpan _dataExpireIn; @@ -143,7 +137,7 @@ public IAppUser FindBySubjectId(string subjectId) if (result.HasValue) { // IMPORTANT! This line might throw an exception if we change the format/version - IAppUser foundSubjectId = JsonConvert.DeserializeObject(result.ToString(), _jsonSerializerSettings); + IAppUser foundSubjectId = JsonSerializer.Deserialize(result.ToString()); return foundSubjectId; } @@ -178,7 +172,7 @@ public IAppUser FindByUsername(string username) if (subject.HasValue) { // IMPORTANT! This line might throw an exception if we change the format/version - IAppUser foundSubjectId = JsonConvert.DeserializeObject(subject.ToString(), _jsonSerializerSettings); + IAppUser foundSubjectId = JsonSerializer.Deserialize(subject.ToString()); return foundSubjectId; } @@ -217,7 +211,7 @@ public IAppUser FindByExternalProvider(string provider, string userId) if (subject.HasValue) { // IMPORTANT! This line might throw an exception if we change the format/version - IAppUser foundSubjectId = JsonConvert.DeserializeObject(subject.ToString(), _jsonSerializerSettings); + IAppUser foundSubjectId = JsonSerializer.Deserialize(subject.ToString()); return foundSubjectId; } @@ -306,7 +300,7 @@ private void SetRedisData(IAppUser user) const string keyByUsername = "IdentityServer/OpenId/username/{0}"; // <== contains a link to the SubjectId const string keyByProviderAndUserid = "IdentityServer/OpenId/provider/{0}/userId/{1}"; // <== contains a link to the SubjectId - var userStr = JsonConvert.SerializeObject(user, _jsonSerializerSettings); + var userStr = JsonSerializer.Serialize(user); var subjectIdStorageKey = string.Format(keyBySubjectId, user.SubjectId); // add user to Redis store diff --git a/MvcVueClient/MvcVueClient.csproj b/MvcVueClient/MvcVueClient.csproj index b21efab..e7f68bc 100644 --- a/MvcVueClient/MvcVueClient.csproj +++ b/MvcVueClient/MvcVueClient.csproj @@ -1,7 +1,8 @@ - net5.0 + net6.0 true + latest diff --git a/README.md b/README.md index cb3e3f6..11d430b 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ [![Build status](https://ci.appveyor.com/api/projects/status/k26pepb32vka29w2/branch/master?svg=true)](https://ci.appveyor.com/project/Nordes/identityserver4-ldapextension/branch/master) [![NuGet](https://img.shields.io/nuget/v/IdentityServer.LdapExtension.svg)](https://www.nuget.org/packages/IdentityServer.LdapExtension/) -- [IdentityServer4.LdapExtension](#identityserver4ldapextension) +- [IdentityServer.LdapExtension](#identityserverldapextension) - [Installation](#installation) - - [Configuration for IdentityServer4 Server](#configuration-for-identityserver4-server) + - [Configuration for IdentityServer Server](#configuration-for-identityserver-server) - [AppSettings Configuration](#appsettings-configuration) - [Multiple concurent Ldap (For different DN, or totally different Ldap)](#multiple-concurent-ldap-for-different-dn-or-totally-different-ldap) - [Quick and Simple Example of a Configuration](#quick-and-simple-example-of-a-configuration) @@ -14,11 +14,11 @@ - [Special thanks to](#special-thanks-to) - [License](#license) -# IdentityServer4.LdapExtension -IdentityServer4 Ldap Extension ([OpenLdap](https://www.openldap.org/) or [ActiveDirectory](https://en.wikipedia.org/wiki/Active_Directory)). +# IdentityServer.LdapExtension +IdentityServer Ldap Extension ([OpenLdap](https://www.openldap.org/) or [ActiveDirectory](https://en.wikipedia.org/wiki/Active_Directory)). ## Installation -The plugin is easy to install to your solution. Built using **.Net Core 3.1** and **.Net 5.0**. The Nuget package can be installed by either searching the package `IdentityServer.LdapExtension` or by typing the following command in your package console: +The plugin is easy to install to your solution. Built using **.Net 6.0**. The Nuget package can be installed by either searching the package `IdentityServer.LdapExtension` or by typing the following command in your package console: ```csharp Install-Package IdentityServer.LdapExtension @@ -29,8 +29,9 @@ Install-Package IdentityServer.LdapExtension > - Ldap Extension 2.1.7 goes with IdentityServer 2.3.x > - Ldap Extension 2.1.8 goes with IdentityServer 2.4.x > - Ldap Extension 3.1.0 goes with IdentityServer 4.1.2 +> - Ldap Extension 4.1.0 goes with Duende IdentityServer 6.1.7 -## Configuration for IdentityServer4 Server +## Configuration for IdentityServer Server An easy extension method have been created in order to add the LDAP as a provider to your IdentityServer. For this you simply have to use the `AddLdapUsers(LdapConfigSection, StoreTypeOrCustomStore)`. The configuration has to be provided or it won't work. The configuration is described [here](#appsettings-configuration). In the `Startup.cs` under `ConfigureServices` method, you will have something similar to the following by default (Starter pack for IdentityServer). The last line is what you will need to add in order to get started. diff --git a/Sample/Api/Api.csproj b/Sample/Api/Api.csproj index d99959e..2e66d1c 100644 --- a/Sample/Api/Api.csproj +++ b/Sample/Api/Api.csproj @@ -1,11 +1,12 @@  - net5.0 + net6.0 + latest - + diff --git a/Sample/Client/MvcClient.csproj b/Sample/Client/MvcClient.csproj index e172a80..50aa7be 100644 --- a/Sample/Client/MvcClient.csproj +++ b/Sample/Client/MvcClient.csproj @@ -1,8 +1,9 @@  - net5.0 + net6.0 true + latest diff --git a/Sample/IdentityServer/Config.cs b/Sample/IdentityServer/Config.cs index cbdcadd..b227156 100644 --- a/Sample/IdentityServer/Config.cs +++ b/Sample/IdentityServer/Config.cs @@ -1,6 +1,6 @@ -using IdentityServer4; -using IdentityServer4.Models; -using System.Collections.Generic; +using System.Collections.Generic; +using Duende.IdentityServer; +using Duende.IdentityServer.Models; namespace QuickstartIdentityServer412 { diff --git a/Sample/IdentityServer/Configuration/Clients.cs b/Sample/IdentityServer/Configuration/Clients.cs index 44eb0b4..053e40f 100644 --- a/Sample/IdentityServer/Configuration/Clients.cs +++ b/Sample/IdentityServer/Configuration/Clients.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. -using IdentityServer4.Models; using System.Collections.Generic; +using Duende.IdentityServer.Models; namespace IdentityServerHost.Configuration { diff --git a/Sample/IdentityServer/Configuration/ClientsConsole.cs b/Sample/IdentityServer/Configuration/ClientsConsole.cs index 0b3dc18..d239108 100644 --- a/Sample/IdentityServer/Configuration/ClientsConsole.cs +++ b/Sample/IdentityServer/Configuration/ClientsConsole.cs @@ -3,8 +3,8 @@ using System.Collections.Generic; -using IdentityServer4; -using IdentityServer4.Models; +using Duende.IdentityServer; +using Duende.IdentityServer.Models; namespace IdentityServerHost.Configuration { diff --git a/Sample/IdentityServer/Configuration/ClientsWeb.cs b/Sample/IdentityServer/Configuration/ClientsWeb.cs index 444b887..75c299d 100644 --- a/Sample/IdentityServer/Configuration/ClientsWeb.cs +++ b/Sample/IdentityServer/Configuration/ClientsWeb.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.using System.Collections.Generic; using System.Collections.Generic; -using IdentityServer4; -using IdentityServer4.Models; +using Duende.IdentityServer; +using Duende.IdentityServer.Models; namespace IdentityServerHost.Configuration { diff --git a/Sample/IdentityServer/Configuration/Resources.cs b/Sample/IdentityServer/Configuration/Resources.cs index 4e0e2df..3f4ad14 100644 --- a/Sample/IdentityServer/Configuration/Resources.cs +++ b/Sample/IdentityServer/Configuration/Resources.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. -using IdentityModel; -using IdentityServer4.Models; using System.Collections.Generic; -using static IdentityServer4.IdentityServerConstants; +using IdentityModel; +using Duende.IdentityServer; +using Duende.IdentityServer.Models; namespace IdentityServerHost.Configuration { @@ -29,7 +29,7 @@ public class Resources new[] { // local API scope - new ApiScope(LocalApi.ScopeName), + new ApiScope(IdentityServerConstants.LocalApi.ScopeName), // resource specific scopes new ApiScope("resource1.scope1"), diff --git a/Sample/IdentityServer/Extensions/ExtensionGrantValidator.cs b/Sample/IdentityServer/Extensions/ExtensionGrantValidator.cs index 04d19a8..f9fcbd8 100644 --- a/Sample/IdentityServer/Extensions/ExtensionGrantValidator.cs +++ b/Sample/IdentityServer/Extensions/ExtensionGrantValidator.cs @@ -2,9 +2,9 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. -using IdentityServer4.Models; -using IdentityServer4.Validation; using System.Threading.Tasks; +using Duende.IdentityServer.Models; +using Duende.IdentityServer.Validation; namespace IdentityServerHost.Extensions { diff --git a/Sample/IdentityServer/Extensions/HostProfileService.cs b/Sample/IdentityServer/Extensions/HostProfileService.cs index 1ffde33..4d4b5b6 100644 --- a/Sample/IdentityServer/Extensions/HostProfileService.cs +++ b/Sample/IdentityServer/Extensions/HostProfileService.cs @@ -1,9 +1,9 @@ using System.Linq; using System.Security.Claims; using System.Threading.Tasks; -using IdentityServer.LdapExtension; -using IdentityServer.LdapExtension.UserStore; -using IdentityServer4.Models; +using Duende.IdentityServer.Models; +using IdentityServer.LdapExtension; +using IdentityServer.LdapExtension.UserStore; using Microsoft.Extensions.Logging; namespace IdentityServerHost.Extensions diff --git a/Sample/IdentityServer/Extensions/NoSubjectExtensionGrantValidator.cs b/Sample/IdentityServer/Extensions/NoSubjectExtensionGrantValidator.cs index a33cd4f..f50e329 100644 --- a/Sample/IdentityServer/Extensions/NoSubjectExtensionGrantValidator.cs +++ b/Sample/IdentityServer/Extensions/NoSubjectExtensionGrantValidator.cs @@ -2,9 +2,9 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. -using IdentityServer4.Models; -using IdentityServer4.Validation; using System.Threading.Tasks; +using Duende.IdentityServer.Models; +using Duende.IdentityServer.Validation; namespace IdentityServerHost.Extensions { diff --git a/Sample/IdentityServer/Extensions/ParameterizedScopeParser.cs b/Sample/IdentityServer/Extensions/ParameterizedScopeParser.cs index 2c81e39..99fe0f5 100644 --- a/Sample/IdentityServer/Extensions/ParameterizedScopeParser.cs +++ b/Sample/IdentityServer/Extensions/ParameterizedScopeParser.cs @@ -1,6 +1,6 @@ -using IdentityServer4.Validation; +using System; +using Duende.IdentityServer.Validation; using Microsoft.Extensions.Logging; -using System; namespace IdentityServerHost.Extensions { diff --git a/Sample/IdentityServer/Extensions/ParameterizedScopeTokenRequestValidator.cs b/Sample/IdentityServer/Extensions/ParameterizedScopeTokenRequestValidator.cs index e4a336f..3b6876f 100644 --- a/Sample/IdentityServer/Extensions/ParameterizedScopeTokenRequestValidator.cs +++ b/Sample/IdentityServer/Extensions/ParameterizedScopeTokenRequestValidator.cs @@ -1,7 +1,7 @@ using System.Linq; using System.Security.Claims; using System.Threading.Tasks; -using IdentityServer4.Validation; +using Duende.IdentityServer.Validation; namespace IdentityServerHost.Extensions { diff --git a/Sample/IdentityServer/LocalApiController.cs b/Sample/IdentityServer/LocalApiController.cs index c4cef13..2f24fad 100644 --- a/Sample/IdentityServer/LocalApiController.cs +++ b/Sample/IdentityServer/LocalApiController.cs @@ -2,15 +2,15 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. +using System.Linq; +using Duende.IdentityServer; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using System.Linq; -using static IdentityServer4.IdentityServerConstants; namespace IdentityServerHost { [Route("localApi")] - [Authorize(LocalApi.PolicyName)] + [Authorize(IdentityServerConstants.LocalApi.PolicyName)] public class LocalApiController : ControllerBase { public IActionResult Get() diff --git a/Sample/IdentityServer/Quickstart/Account/AccountController.cs b/Sample/IdentityServer/Quickstart/Account/AccountController.cs index eb7904e..f5d4c27 100644 --- a/Sample/IdentityServer/Quickstart/Account/AccountController.cs +++ b/Sample/IdentityServer/Quickstart/Account/AccountController.cs @@ -2,22 +2,22 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. +using System; +using System.Linq; +using System.Threading.Tasks; +using Duende.IdentityServer; +using Duende.IdentityServer.Events; +using Duende.IdentityServer.Extensions; +using Duende.IdentityServer.Models; +using Duende.IdentityServer.Services; +using Duende.IdentityServer.Stores; using IdentityModel; -using IdentityServer.LdapExtension.UserModel; -using IdentityServer.LdapExtension.UserStore; -using IdentityServer4; -using IdentityServer4.Events; -using IdentityServer4.Extensions; -using IdentityServer4.Models; -using IdentityServer4.Services; -using IdentityServer4.Stores; +using IdentityServer.LdapExtension.UserModel; +using IdentityServer.LdapExtension.UserStore; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using System; -using System.Linq; -using System.Threading.Tasks; namespace IdentityServerHost.Quickstart.UI { @@ -242,7 +242,7 @@ private async Task BuildLoginViewModelAsync(string returnUrl) var context = await _interaction.GetAuthorizationContextAsync(returnUrl); if (context?.IdP != null && await _schemeProvider.GetSchemeAsync(context.IdP) != null) { - var local = context.IdP == IdentityServer4.IdentityServerConstants.LocalIdentityProvider; + var local = context.IdP == IdentityServerConstants.LocalIdentityProvider; // this is meant to short circuit the UI and only trigger the one external IdP var vm = new LoginViewModel @@ -344,7 +344,7 @@ private async Task BuildLoggedOutViewModelAsync(string logou if (User?.Identity.IsAuthenticated == true) { var idp = User.FindFirst(JwtClaimTypes.IdentityProvider)?.Value; - if (idp != null && idp != IdentityServer4.IdentityServerConstants.LocalIdentityProvider) + if (idp != null && idp != IdentityServerConstants.LocalIdentityProvider) { var providerSupportsSignout = await HttpContext.GetSchemeSupportsSignOutAsync(idp); if (providerSupportsSignout) diff --git a/Sample/IdentityServer/Quickstart/Account/ExternalController.cs b/Sample/IdentityServer/Quickstart/Account/ExternalController.cs index 931c40b..9f4309a 100644 --- a/Sample/IdentityServer/Quickstart/Account/ExternalController.cs +++ b/Sample/IdentityServer/Quickstart/Account/ExternalController.cs @@ -1,20 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; using IdentityModel; -using IdentityServer.LdapExtension.UserModel; -using IdentityServer.LdapExtension.UserStore; -using IdentityServer4; -using IdentityServer4.Events; -using IdentityServer4.Services; -using IdentityServer4.Stores; +using IdentityServer.LdapExtension.UserModel; +using IdentityServer.LdapExtension.UserStore; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; using System.Security.Claims; using System.Threading.Tasks; +using Duende.IdentityServer; +using Duende.IdentityServer.Events; +using Duende.IdentityServer.Services; +using Duende.IdentityServer.Stores; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Logging; namespace IdentityServerHost.Quickstart.UI { diff --git a/Sample/IdentityServer/Quickstart/Consent/ConsentController.cs b/Sample/IdentityServer/Quickstart/Consent/ConsentController.cs index 6c3aa44..96bdbd9 100644 --- a/Sample/IdentityServer/Quickstart/Consent/ConsentController.cs +++ b/Sample/IdentityServer/Quickstart/Consent/ConsentController.cs @@ -2,18 +2,19 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. -using IdentityServer4.Events; -using IdentityServer4.Models; -using IdentityServer4.Services; -using IdentityServer4.Extensions; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Duende.IdentityServer; +using Duende.IdentityServer.Events; +using Duende.IdentityServer.Extensions; +using Duende.IdentityServer.Models; +using Duende.IdentityServer.Services; +using Duende.IdentityServer.Validation; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; -using System.Linq; -using System.Threading.Tasks; -using IdentityServer4.Validation; -using System.Collections.Generic; -using System; namespace IdentityServerHost.Quickstart.UI { @@ -120,7 +121,7 @@ private async Task ProcessConsent(ConsentInputModel model) var scopes = model.ScopesConsented; if (ConsentOptions.EnableOfflineAccess == false) { - scopes = scopes.Where(x => x != IdentityServer4.IdentityServerConstants.StandardScopes.OfflineAccess); + scopes = scopes.Where(x => x != IdentityServerConstants.StandardScopes.OfflineAccess); } grantedConsent = new ConsentResponse @@ -208,7 +209,7 @@ private ConsentViewModel CreateConsentViewModel( } if (ConsentOptions.EnableOfflineAccess && request.ValidatedResources.Resources.OfflineAccess) { - apiScopes.Add(GetOfflineAccessScope(vm.ScopesConsented.Contains(IdentityServer4.IdentityServerConstants.StandardScopes.OfflineAccess) || model == null)); + apiScopes.Add(GetOfflineAccessScope(vm.ScopesConsented.Contains(IdentityServerConstants.StandardScopes.OfflineAccess) || model == null)); } vm.ApiScopes = apiScopes; @@ -251,7 +252,7 @@ private ScopeViewModel GetOfflineAccessScope(bool check) { return new ScopeViewModel { - Value = IdentityServer4.IdentityServerConstants.StandardScopes.OfflineAccess, + Value = IdentityServerConstants.StandardScopes.OfflineAccess, DisplayName = ConsentOptions.OfflineAccessDisplayName, Description = ConsentOptions.OfflineAccessDescription, Emphasize = true, diff --git a/Sample/IdentityServer/Quickstart/Consent/ProcessConsentResult.cs b/Sample/IdentityServer/Quickstart/Consent/ProcessConsentResult.cs index 1d331df..e18d8f5 100644 --- a/Sample/IdentityServer/Quickstart/Consent/ProcessConsentResult.cs +++ b/Sample/IdentityServer/Quickstart/Consent/ProcessConsentResult.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. -using IdentityServer4.Models; +using Duende.IdentityServer.Models; namespace IdentityServerHost.Quickstart.UI { diff --git a/Sample/IdentityServer/Quickstart/Device/DeviceController.cs b/Sample/IdentityServer/Quickstart/Device/DeviceController.cs index d7d07ae..c9726fb 100644 --- a/Sample/IdentityServer/Quickstart/Device/DeviceController.cs +++ b/Sample/IdentityServer/Quickstart/Device/DeviceController.cs @@ -6,12 +6,13 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using IdentityServer4.Configuration; -using IdentityServer4.Events; -using IdentityServer4.Extensions; -using IdentityServer4.Models; -using IdentityServer4.Services; -using IdentityServer4.Validation; +using Duende.IdentityServer; +using Duende.IdentityServer.Configuration; +using Duende.IdentityServer.Events; +using Duende.IdentityServer.Extensions; +using Duende.IdentityServer.Models; +using Duende.IdentityServer.Services; +using Duende.IdentityServer.Validation; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; @@ -102,7 +103,7 @@ private async Task ProcessConsent(DeviceAuthorizationInput var scopes = model.ScopesConsented; if (ConsentOptions.EnableOfflineAccess == false) { - scopes = scopes.Where(x => x != IdentityServer4.IdentityServerConstants.StandardScopes.OfflineAccess); + scopes = scopes.Where(x => x != IdentityServerConstants.StandardScopes.OfflineAccess); } grantedConsent = new ConsentResponse @@ -184,7 +185,7 @@ private DeviceAuthorizationViewModel CreateConsentViewModel(string userCode, Dev } if (ConsentOptions.EnableOfflineAccess && request.ValidatedResources.Resources.OfflineAccess) { - apiScopes.Add(GetOfflineAccessScope(vm.ScopesConsented.Contains(IdentityServer4.IdentityServerConstants.StandardScopes.OfflineAccess) || model == null)); + apiScopes.Add(GetOfflineAccessScope(vm.ScopesConsented.Contains(IdentityServerConstants.StandardScopes.OfflineAccess) || model == null)); } vm.ApiScopes = apiScopes; @@ -221,7 +222,7 @@ private ScopeViewModel GetOfflineAccessScope(bool check) { return new ScopeViewModel { - Value = IdentityServer4.IdentityServerConstants.StandardScopes.OfflineAccess, + Value = IdentityServerConstants.StandardScopes.OfflineAccess, DisplayName = ConsentOptions.OfflineAccessDisplayName, Description = ConsentOptions.OfflineAccessDescription, Emphasize = true, diff --git a/Sample/IdentityServer/Quickstart/Diagnostics/DiagnosticsViewModel.cs b/Sample/IdentityServer/Quickstart/Diagnostics/DiagnosticsViewModel.cs index f43c768..0e51863 100644 --- a/Sample/IdentityServer/Quickstart/Diagnostics/DiagnosticsViewModel.cs +++ b/Sample/IdentityServer/Quickstart/Diagnostics/DiagnosticsViewModel.cs @@ -2,11 +2,11 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. +using System.Collections.Generic; using IdentityModel; using Microsoft.AspNetCore.Authentication; -using Newtonsoft.Json; -using System.Collections.Generic; using System.Text; +using System.Text.Json; namespace IdentityServerHost.Quickstart.UI { @@ -22,7 +22,7 @@ public DiagnosticsViewModel(AuthenticateResult result) var bytes = Base64Url.Decode(encoded); var value = Encoding.UTF8.GetString(bytes); - Clients = JsonConvert.DeserializeObject(value); + Clients = JsonSerializer.Deserialize(value); } } diff --git a/Sample/IdentityServer/Quickstart/Extensions.cs b/Sample/IdentityServer/Quickstart/Extensions.cs index 6c720b7..d441f52 100644 --- a/Sample/IdentityServer/Quickstart/Extensions.cs +++ b/Sample/IdentityServer/Quickstart/Extensions.cs @@ -1,5 +1,5 @@ using System; -using IdentityServer4.Models; +using Duende.IdentityServer.Models; using Microsoft.AspNetCore.Mvc; namespace IdentityServerHost.Quickstart.UI diff --git a/Sample/IdentityServer/Quickstart/Grants/GrantsController.cs b/Sample/IdentityServer/Quickstart/Grants/GrantsController.cs index 128ce59..0a26714 100644 --- a/Sample/IdentityServer/Quickstart/Grants/GrantsController.cs +++ b/Sample/IdentityServer/Quickstart/Grants/GrantsController.cs @@ -2,15 +2,15 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. -using IdentityServer4.Services; -using IdentityServer4.Stores; -using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Duende.IdentityServer.Events; +using Duende.IdentityServer.Extensions; +using Duende.IdentityServer.Services; +using Duende.IdentityServer.Stores; +using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Authorization; -using IdentityServer4.Events; -using IdentityServer4.Extensions; namespace IdentityServerHost.Quickstart.UI { diff --git a/Sample/IdentityServer/Quickstart/Home/ErrorViewModel.cs b/Sample/IdentityServer/Quickstart/Home/ErrorViewModel.cs index a29a21a..ed2896d 100644 --- a/Sample/IdentityServer/Quickstart/Home/ErrorViewModel.cs +++ b/Sample/IdentityServer/Quickstart/Home/ErrorViewModel.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. -using IdentityServer4.Models; +using Duende.IdentityServer.Models; namespace IdentityServerHost.Quickstart.UI { diff --git a/Sample/IdentityServer/Quickstart/Home/HomeController.cs b/Sample/IdentityServer/Quickstart/Home/HomeController.cs index 9cf0678..0aa3387 100644 --- a/Sample/IdentityServer/Quickstart/Home/HomeController.cs +++ b/Sample/IdentityServer/Quickstart/Home/HomeController.cs @@ -2,13 +2,13 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. -using IdentityServer4.Services; +using System.Threading.Tasks; +using Duende.IdentityServer.Services; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; -using System.Threading.Tasks; namespace IdentityServerHost.Quickstart.UI { diff --git a/Sample/IdentityServer/QuickstartIdentityServer412.csproj b/Sample/IdentityServer/QuickstartIdentityServer412.csproj index 7295825..6638b35 100644 --- a/Sample/IdentityServer/QuickstartIdentityServer412.csproj +++ b/Sample/IdentityServer/QuickstartIdentityServer412.csproj @@ -1,8 +1,9 @@ - net5.0 + net6.0 InProcess + latest @@ -14,19 +15,18 @@ - + + - + - + - + - - - - + + \ No newline at end of file diff --git a/Sample/IdentityServer/Startup.cs b/Sample/IdentityServer/Startup.cs index e7b1863..aa0fafa 100644 --- a/Sample/IdentityServer/Startup.cs +++ b/Sample/IdentityServer/Startup.cs @@ -5,7 +5,6 @@ using System; using IdentityServerHost.Configuration; using IdentityModel; -using IdentityServer4; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -17,13 +16,14 @@ using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; +using Duende.IdentityServer; using IdentityServerHost.Extensions; using Microsoft.AspNetCore.Authentication.Certificate; using Microsoft.AspNetCore.HttpOverrides; -using IdentityServer.LdapExtension.Extensions; -using IdentityServer.LdapExtension.UserModel; -using QuickstartIdentityServer412; - +using IdentityServer.LdapExtension.Extensions; +using IdentityServer.LdapExtension.UserModel; +using QuickstartIdentityServer412; + namespace IdentityServerHost { public class Startup @@ -59,9 +59,9 @@ public void ConfigureServices(IServiceCollection services) }) //.AddInMemoryClients(Clients.Get()) // [Original code] //.AddInMemoryIdentityResources(Resources.IdentityResources) [Original code] - //.AddInMemoryApiScopes(Resources.ApiScopes) // [Original code] + //.AddInMemoryApiScopes(Resources.ApiScopes) // [Original code] .AddInMemoryClients(Config.GetClients()) // [LDAP API Example] - .AddInMemoryIdentityResources(Config.IdentityResources()) // [LDAP API Example] + .AddInMemoryIdentityResources(Config.IdentityResources()) // [LDAP API Example] .AddInMemoryApiScopes(Config.GetApiScope()) // [LDAP API Example] .AddInMemoryApiResources(Resources.ApiResources) .AddSigningCredential() diff --git a/Sample/IdentityServer/Views/Home/Index.cshtml b/Sample/IdentityServer/Views/Home/Index.cshtml index e0fb30c..c02b230 100644 --- a/Sample/IdentityServer/Views/Home/Index.cshtml +++ b/Sample/IdentityServer/Views/Home/Index.cshtml @@ -1,8 +1,7 @@ -@using System.Diagnostics @using System.Reflection @{ - var version = typeof(IdentityServer4.Hosting.IdentityServerMiddleware).Assembly.GetCustomAttribute()?.InformationalVersion.Split('+').First(); + var version = typeof(Duende.IdentityServer.Hosting.IdentityServerMiddleware).Assembly.GetCustomAttribute()?.InformationalVersion.Split('+').First(); }
diff --git a/Sample/IdentityServer/Views/Shared/_Nav.cshtml b/Sample/IdentityServer/Views/Shared/_Nav.cshtml index 6ab6b70..6e68a5b 100644 --- a/Sample/IdentityServer/Views/Shared/_Nav.cshtml +++ b/Sample/IdentityServer/Views/Shared/_Nav.cshtml @@ -1,5 +1,5 @@ -@using IdentityServer4.Extensions - +@using Duende.IdentityServer.Extensions +@using Microsoft.AspNetCore.Mvc.TagHelpers @{ string name = null; if (!true.Equals(ViewData["signed-out"]))