diff --git a/modules/OpenIddict/Volo.Abp.OpenIddict.sln b/modules/OpenIddict/Volo.Abp.OpenIddict.sln index 94dfd7732d..ebd841b9ea 100644 --- a/modules/OpenIddict/Volo.Abp.OpenIddict.sln +++ b/modules/OpenIddict/Volo.Abp.OpenIddict.sln @@ -33,7 +33,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.OpenIddict.AspNetC EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenIddict.Demo.Client.Console", "app\OpenIddict.Demo.Client.Console\OpenIddict.Demo.Client.Console.csproj", "{1EF0F35E-65BE-4994-9BC4-9D3992A9B05C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenIddict.Demo.Client.API", "app\OpenIddict.Demo.Client.API\OpenIddict.Demo.Client.API.csproj", "{70FD6E90-BBE8-4DA1-AE07-55064803225B}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenIddict.Demo.API", "app\OpenIddict.Demo.API\OpenIddict.Demo.API.csproj", "{70FD6E90-BBE8-4DA1-AE07-55064803225B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/modules/OpenIddict/app/OpenIddict.Demo.API/Controllers/ClaimsController.cs b/modules/OpenIddict/app/OpenIddict.Demo.API/Controllers/ClaimsController.cs new file mode 100644 index 0000000000..8a541f3b13 --- /dev/null +++ b/modules/OpenIddict/app/OpenIddict.Demo.API/Controllers/ClaimsController.cs @@ -0,0 +1,15 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; + +namespace OpenIddict.Demo.API.Controllers; + +[ApiController] +[Authorize] +[Route("api/claims")] +public class ClaimsController : Controller +{ + public JsonResult Get() + { + return Json(User.Claims.Select(x => new {Type = x.Type, Value = x.Value})); + } +} \ No newline at end of file diff --git a/modules/OpenIddict/app/OpenIddict.Demo.Client.API/OpenIddict.Demo.Client.API.csproj b/modules/OpenIddict/app/OpenIddict.Demo.API/OpenIddict.Demo.API.csproj similarity index 100% rename from modules/OpenIddict/app/OpenIddict.Demo.Client.API/OpenIddict.Demo.Client.API.csproj rename to modules/OpenIddict/app/OpenIddict.Demo.API/OpenIddict.Demo.API.csproj diff --git a/modules/OpenIddict/app/OpenIddict.Demo.Client.API/Program.cs b/modules/OpenIddict/app/OpenIddict.Demo.API/Program.cs similarity index 91% rename from modules/OpenIddict/app/OpenIddict.Demo.Client.API/Program.cs rename to modules/OpenIddict/app/OpenIddict.Demo.API/Program.cs index f00ae45233..0411958484 100644 --- a/modules/OpenIddict/app/OpenIddict.Demo.Client.API/Program.cs +++ b/modules/OpenIddict/app/OpenIddict.Demo.API/Program.cs @@ -15,8 +15,7 @@ builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(options => { options.Authority = "https://localhost:44301"; - - options.Audience = "OpenIddictDemoAPIResource"; + options.Audience = "AbpAPIResource"; }); var app = builder.Build(); diff --git a/modules/OpenIddict/app/OpenIddict.Demo.Client.API/Properties/launchSettings.json b/modules/OpenIddict/app/OpenIddict.Demo.API/Properties/launchSettings.json similarity index 89% rename from modules/OpenIddict/app/OpenIddict.Demo.Client.API/Properties/launchSettings.json rename to modules/OpenIddict/app/OpenIddict.Demo.API/Properties/launchSettings.json index f181bd0d00..80ae79b59e 100644 --- a/modules/OpenIddict/app/OpenIddict.Demo.Client.API/Properties/launchSettings.json +++ b/modules/OpenIddict/app/OpenIddict.Demo.API/Properties/launchSettings.json @@ -1,6 +1,6 @@ { "profiles": { - "OpenIddict.Demo.Client.API": { + "OpenIddict.Demo.API": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, diff --git a/modules/OpenIddict/app/OpenIddict.Demo.Client.API/appsettings.json b/modules/OpenIddict/app/OpenIddict.Demo.API/appsettings.json similarity index 100% rename from modules/OpenIddict/app/OpenIddict.Demo.Client.API/appsettings.json rename to modules/OpenIddict/app/OpenIddict.Demo.API/appsettings.json diff --git a/modules/OpenIddict/app/OpenIddict.Demo.Client.API/Controllers/WeatherForecastController.cs b/modules/OpenIddict/app/OpenIddict.Demo.Client.API/Controllers/WeatherForecastController.cs deleted file mode 100644 index 27e7060e6a..0000000000 --- a/modules/OpenIddict/app/OpenIddict.Demo.Client.API/Controllers/WeatherForecastController.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; - -namespace OpenIddict.Demo.Client.API.Controllers; - -[ApiController] -[Authorize] -[Route("[controller]")] -public class WeatherForecastController : ControllerBase -{ - private static readonly string[] Summaries = new[] { - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - }; - - private readonly ILogger _logger; - - public WeatherForecastController(ILogger logger) - { - _logger = logger; - } - - [HttpGet(Name = "GetWeatherForecast")] - public IEnumerable Get() - { - return Enumerable.Range(1, 5).Select(index => new WeatherForecast { - Date = DateTime.Now.AddDays(index), - TemperatureC = Random.Shared.Next(-20, 55), - Summary = Summaries[Random.Shared.Next(Summaries.Length)] - }) - .ToArray(); - } -} \ No newline at end of file diff --git a/modules/OpenIddict/app/OpenIddict.Demo.Client.API/WeatherForecast.cs b/modules/OpenIddict/app/OpenIddict.Demo.Client.API/WeatherForecast.cs deleted file mode 100644 index b29eaa6db5..0000000000 --- a/modules/OpenIddict/app/OpenIddict.Demo.Client.API/WeatherForecast.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace OpenIddict.Demo.Client.API; - -public class WeatherForecast -{ - public DateTime Date { get; set; } - - public int TemperatureC { get; set; } - - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - - public string? Summary { get; set; } -} \ No newline at end of file diff --git a/modules/OpenIddict/app/OpenIddict.Demo.Client.Console/Program.cs b/modules/OpenIddict/app/OpenIddict.Demo.Client.Console/Program.cs index a0463317ce..4fb4bbbff1 100644 --- a/modules/OpenIddict/app/OpenIddict.Demo.Client.Console/Program.cs +++ b/modules/OpenIddict/app/OpenIddict.Demo.Client.Console/Program.cs @@ -1,19 +1,20 @@ using System.Net.Http.Headers; +using System.Text.Json; using IdentityModel.Client; const string email = "admin@abp.io"; const string password = "1q2w3E*"; const string server = "https://localhost:44301/"; -const string api = "https://localhost:44303/WeatherForecast"; -const string clientId = "MyClient"; -const string clientSecret = "901564A5-E7FE-42CB-B10D-61EF6A8F3654"; +const string api = "https://localhost:44303/api/claims"; +const string clientId = "AbpApp"; +const string clientSecret = "1q2w3e*"; var client = new HttpClient(); var configuration = await client.GetDiscoveryDocumentAsync(server); if (configuration.IsError) { - throw new Exception($"An error occurred while retrieving the configuration document: {configuration.Error}"); + throw new Exception(configuration.Error); } var tokenResponse = await client.RequestPasswordTokenAsync(new PasswordTokenRequest @@ -22,7 +23,8 @@ var tokenResponse = await client.RequestPasswordTokenAsync(new PasswordTokenRequ ClientId = clientId, ClientSecret = clientSecret, UserName = email, - Password = password + Password = password, + Scope = "AbpAPI offline_access" }); if (tokenResponse.IsError) @@ -32,6 +34,26 @@ if (tokenResponse.IsError) Console.WriteLine("Access token: {0}", tokenResponse.AccessToken); Console.WriteLine(); +Console.WriteLine("Refresh token: {0}", tokenResponse.RefreshToken); +Console.WriteLine(); + +var refreshTokenResponse = await client.RequestRefreshTokenAsync(new RefreshTokenRequest() +{ + Address = configuration.TokenEndpoint, + ClientId = clientId, + ClientSecret = clientSecret, + RefreshToken = tokenResponse.RefreshToken +}); + +if (refreshTokenResponse.IsError) +{ + throw new Exception(refreshTokenResponse.Error); +} + +Console.WriteLine("New Access token: {0}", refreshTokenResponse.AccessToken); +Console.WriteLine(); +Console.WriteLine("New Refresh token: {0}", refreshTokenResponse.RefreshToken); +Console.WriteLine(); var userinfo = await client.GetUserInfoAsync(new UserInfoRequest() @@ -44,14 +66,22 @@ if (userinfo.IsError) throw new Exception(userinfo.Error); } -Console.WriteLine("UserInfo: {0}", userinfo.Raw); +Console.WriteLine("UserInfo: {0}", JsonSerializer.Serialize(JsonDocument.Parse(userinfo.Raw), new JsonSerializerOptions +{ + WriteIndented = true +})); Console.WriteLine(); + var request = new HttpRequestMessage(HttpMethod.Get, api); request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", tokenResponse.AccessToken); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); -Console.WriteLine("API response: {0}", await response.Content.ReadAsStringAsync()); +Console.WriteLine("API response: {0}", JsonSerializer.Serialize(JsonDocument.Parse(await response.Content.ReadAsStringAsync()), new JsonSerializerOptions +{ + WriteIndented = true +})); + Console.WriteLine(); \ No newline at end of file diff --git a/modules/OpenIddict/app/OpenIddict.Demo.Client.Mvc/Program.cs b/modules/OpenIddict/app/OpenIddict.Demo.Client.Mvc/Program.cs index a718de481b..0e7c092765 100644 --- a/modules/OpenIddict/app/OpenIddict.Demo.Client.Mvc/Program.cs +++ b/modules/OpenIddict/app/OpenIddict.Demo.Client.Mvc/Program.cs @@ -21,14 +21,14 @@ builder.Services.AddAuthentication(options => { options.Authority = "https://localhost:44301/"; - options.ClientId = "MyClient"; - options.ClientSecret = "901564A5-E7FE-42CB-B10D-61EF6A8F3654"; + options.ClientId = "AbpApp"; + options.ClientSecret = "1q2w3e*"; - options.RequireHttpsMetadata = false; + options.RequireHttpsMetadata = true; options.GetClaimsFromUserInfoEndpoint = true; options.SaveTokens = true; - options.ResponseType = OidcConstants.ResponseTypes.Code; + options.ResponseType = OidcConstants.ResponseTypes.CodeIdToken; options.SignOutScheme = "Cookies"; diff --git a/modules/OpenIddict/app/OpenIddict.Demo.Server/EntityFrameworkCore/ServerDataSeedContributor.cs b/modules/OpenIddict/app/OpenIddict.Demo.Server/EntityFrameworkCore/ServerDataSeedContributor.cs index c432c1b38e..637f4b8739 100644 --- a/modules/OpenIddict/app/OpenIddict.Demo.Server/EntityFrameworkCore/ServerDataSeedContributor.cs +++ b/modules/OpenIddict/app/OpenIddict.Demo.Server/EntityFrameworkCore/ServerDataSeedContributor.cs @@ -24,32 +24,32 @@ public class ServerDataSeedContributor: IDataSeedContributor, ITransientDependen public async Task SeedAsync(DataSeedContext context) { - if (await _scopeManager.FindByNameAsync("OpenIddictDemoAPI") == null) + if (await _scopeManager.FindByNameAsync("AbpAPI") == null) { await _scopeManager.CreateAsync(new OpenIddictScopeDescriptor() { - DisplayName = "OpenIddict Demo API access", + DisplayName = "Abp API access", DisplayNames = { - [CultureInfo.GetCultureInfo("zh-Hans")] = "演示 OpenIddict API 访问", - [CultureInfo.GetCultureInfo("tr")] = "OpenIddict Demo API erişimi" + [CultureInfo.GetCultureInfo("zh-Hans")] = "演示 API 访问", + [CultureInfo.GetCultureInfo("tr")] = "API erişimi" }, - Name = "OpenIddictDemoAPI", + Name = "AbpAPI", Resources = { - "OpenIddictDemoAPIResource" + "AbpAPIResource" } }); } - if (await _applicationManager.FindByClientIdAsync("MyClient") == null) + if (await _applicationManager.FindByClientIdAsync("AbpApp") == null) { await _applicationManager.CreateAsync(new OpenIddictApplicationDescriptor { - ClientId = "MyClient", - ClientSecret = "901564A5-E7FE-42CB-B10D-61EF6A8F3654", + ClientId = "AbpApp", + ClientSecret = "1q2w3e*", ConsentType = OpenIddictConstants.ConsentTypes.Explicit, - DisplayName = "My Client Application", + DisplayName = "Abp Application", PostLogoutRedirectUris = { new Uri("https://localhost:44302/signout-callback-oidc") @@ -89,7 +89,7 @@ public class ServerDataSeedContributor: IDataSeedContributor, ITransientDependen OpenIddictConstants.Permissions.Scopes.Roles, OpenIddictConstants.Permissions.Scopes.Address, OpenIddictConstants.Permissions.Scopes.Phone, - OpenIddictConstants.Permissions.Prefixes.Scope + "OpenIddictDemoAPI" + OpenIddictConstants.Permissions.Prefixes.Scope + "AbpAPI" } }); } diff --git a/modules/OpenIddict/app/OpenIddict.Demo.Server/Migrations/20220329055013_Initial.Designer.cs b/modules/OpenIddict/app/OpenIddict.Demo.Server/Migrations/20220330063446_Initial.Designer.cs similarity index 98% rename from modules/OpenIddict/app/OpenIddict.Demo.Server/Migrations/20220329055013_Initial.Designer.cs rename to modules/OpenIddict/app/OpenIddict.Demo.Server/Migrations/20220330063446_Initial.Designer.cs index 1eccd61d1e..0550e04e4b 100644 --- a/modules/OpenIddict/app/OpenIddict.Demo.Server/Migrations/20220329055013_Initial.Designer.cs +++ b/modules/OpenIddict/app/OpenIddict.Demo.Server/Migrations/20220330063446_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace OpenIddict.Demo.Server.Migrations { [DbContext(typeof(ServerDbContext))] - [Migration("20220329055013_Initial")] + [Migration("20220330063446_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -769,6 +769,12 @@ namespace OpenIddict.Demo.Server.Migrations b.Property("ApplicationId") .HasColumnType("uniqueidentifier"); + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + b.Property("CreationDate") .HasColumnType("datetime2"); @@ -916,6 +922,12 @@ namespace OpenIddict.Demo.Server.Migrations b.Property("AuthorizationId") .HasColumnType("uniqueidentifier"); + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + b.Property("CreationDate") .HasColumnType("datetime2"); diff --git a/modules/OpenIddict/app/OpenIddict.Demo.Server/Migrations/20220329055013_Initial.cs b/modules/OpenIddict/app/OpenIddict.Demo.Server/Migrations/20220330063446_Initial.cs similarity index 99% rename from modules/OpenIddict/app/OpenIddict.Demo.Server/Migrations/20220329055013_Initial.cs rename to modules/OpenIddict/app/OpenIddict.Demo.Server/Migrations/20220330063446_Initial.cs index b7c171fbe4..e6419bca5d 100644 --- a/modules/OpenIddict/app/OpenIddict.Demo.Server/Migrations/20220329055013_Initial.cs +++ b/modules/OpenIddict/app/OpenIddict.Demo.Server/Migrations/20220330063446_Initial.cs @@ -263,6 +263,7 @@ namespace OpenIddict.Demo.Server.Migrations columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), ApplicationId = table.Column(type: "uniqueidentifier", nullable: true), CreationDate = table.Column(type: "datetime2", nullable: true), Properties = table.Column(type: "nvarchar(max)", nullable: true), @@ -456,6 +457,7 @@ namespace OpenIddict.Demo.Server.Migrations columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), + ConcurrencyStamp = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: true), ApplicationId = table.Column(type: "uniqueidentifier", nullable: true), AuthorizationId = table.Column(type: "uniqueidentifier", nullable: true), CreationDate = table.Column(type: "datetime2", nullable: true), diff --git a/modules/OpenIddict/app/OpenIddict.Demo.Server/Migrations/ServerDbContextModelSnapshot.cs b/modules/OpenIddict/app/OpenIddict.Demo.Server/Migrations/ServerDbContextModelSnapshot.cs index c007e17f47..a072f0ca20 100644 --- a/modules/OpenIddict/app/OpenIddict.Demo.Server/Migrations/ServerDbContextModelSnapshot.cs +++ b/modules/OpenIddict/app/OpenIddict.Demo.Server/Migrations/ServerDbContextModelSnapshot.cs @@ -767,6 +767,12 @@ namespace OpenIddict.Demo.Server.Migrations b.Property("ApplicationId") .HasColumnType("uniqueidentifier"); + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + b.Property("CreationDate") .HasColumnType("datetime2"); @@ -914,6 +920,12 @@ namespace OpenIddict.Demo.Server.Migrations b.Property("AuthorizationId") .HasColumnType("uniqueidentifier"); + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)") + .HasColumnName("ConcurrencyStamp"); + b.Property("CreationDate") .HasColumnType("datetime2"); diff --git a/modules/OpenIddict/app/OpenIddict.Demo.Server/OpenIddictServerModule.cs b/modules/OpenIddict/app/OpenIddict.Demo.Server/OpenIddictServerModule.cs index b3a4b2c391..eaf110c591 100644 --- a/modules/OpenIddict/app/OpenIddict.Demo.Server/OpenIddictServerModule.cs +++ b/modules/OpenIddict/app/OpenIddict.Demo.Server/OpenIddictServerModule.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +using Microsoft.AspNetCore.Authentication; +using Microsoft.EntityFrameworkCore; using OpenIddict.Abstractions; using OpenIddict.Demo.Server.EntityFrameworkCore; using Volo.Abp; @@ -17,7 +18,6 @@ using Volo.Abp.Identity.EntityFrameworkCore; using Volo.Abp.Identity.Web; using Volo.Abp.Modularity; using Volo.Abp.OpenIddict; -using Volo.Abp.OpenIddict.Applications; using Volo.Abp.OpenIddict.EntityFrameworkCore; using Volo.Abp.PermissionManagement; using Volo.Abp.PermissionManagement.EntityFrameworkCore; @@ -32,11 +32,12 @@ namespace OpenIddict.Demo.Server; [DependsOn( typeof(AbpAspNetCoreMvcModule), typeof(AbpAutofacModule), - typeof(OpenIddictEntityFrameworkCoreModule), - typeof(OpenIddictAspNetCoreModule), typeof(AbpEntityFrameworkCoreSqlServerModule), typeof(AbpAspNetCoreMvcUiBasicThemeModule), - + + typeof(AbpOpenIddictAspNetCoreModule), + typeof(AbpOpenIddictEntityFrameworkCoreModule), + typeof(AbpAccountApplicationModule), typeof(AbpAccountHttpApiModule), typeof(AbpAccountWebModule), @@ -63,14 +64,6 @@ namespace OpenIddict.Demo.Server; )] public class OpenIddictServerModule : AbpModule { - public override void PreConfigureServices(ServiceConfigurationContext context) - { - PreConfigure(builder => - { - - }); - } - public override void ConfigureServices(ServiceConfigurationContext context) { context.Services.AddAbpDbContext(options => @@ -86,9 +79,6 @@ public class OpenIddictServerModule : AbpModule public async override Task OnApplicationInitializationAsync(ApplicationInitializationContext context) { - var qq = context.ServiceProvider.GetService>(); - - var dbContext = context.ServiceProvider .GetRequiredService(); diff --git a/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo.Abp.OpenIddict.AspNetCore.csproj b/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo.Abp.OpenIddict.AspNetCore.csproj index c3515589cc..bc02316c52 100644 --- a/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo.Abp.OpenIddict.AspNetCore.csproj +++ b/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo.Abp.OpenIddict.AspNetCore.csproj @@ -1,26 +1,26 @@ - - - - - net6.0 - - Library - - - - - - - - - - - - - ..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI\bin\Debug\net6.0\Volo.Abp.AspNetCore.Mvc.UI.dll - - + + + + + net6.0 + Library + + + + + + + + + + + + + + + + diff --git a/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/AbpOpenIddictAspNetCoreModule.cs b/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/AbpOpenIddictAspNetCoreModule.cs new file mode 100644 index 0000000000..cfa9007242 --- /dev/null +++ b/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/AbpOpenIddictAspNetCoreModule.cs @@ -0,0 +1,41 @@ +using Microsoft.AspNetCore.Mvc.Razor; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; +using Volo.Abp.Modularity; + +namespace Volo.Abp.OpenIddict; + +[DependsOn( + typeof(AbpAspNetCoreMvcModule), + typeof(AbpAspNetCoreMvcUiThemeSharedModule), + typeof(AbpOpenIddictDomainModule) +)] +public class AbpOpenIddictAspNetCoreModule : AbpModule +{ + public override void PreConfigureServices(ServiceConfigurationContext context) + { + PreConfigure(builder => + { + builder.UseAspNetCore() + .EnableAuthorizationEndpointPassthrough() + .EnableTokenEndpointPassthrough() + .EnableUserinfoEndpointPassthrough() + .EnableLogoutEndpointPassthrough() + .EnableVerificationEndpointPassthrough(); + }); + + PreConfigure(builder => + { + builder.UseAspNetCore(); + }); + } + + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.ViewLocationFormats.Add("/Volo/Abp/OpenIddict/Views/{1}/{0}.cshtml"); + }); + } +} diff --git a/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.Password.cs b/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.Password.cs index 18bbeb4dca..6fd56dd1ce 100644 --- a/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.Password.cs +++ b/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.Password.cs @@ -213,7 +213,8 @@ public partial class TokenController OpenIddictConstants.Scopes.OpenId, OpenIddictConstants.Scopes.Email, OpenIddictConstants.Scopes.Profile, - OpenIddictConstants.Scopes.Roles + OpenIddictConstants.Scopes.Roles, + OpenIddictConstants.Scopes.OfflineAccess }.Intersect(request.GetScopes())); foreach (var claim in principal.Claims) @@ -221,6 +222,15 @@ public partial class TokenController claim.SetDestinations(GetDestinations(claim, principal)); } + if (request.GetScopes().Any()) + { + var resources = await ScopeManager.ListResourcesAsync(request.GetScopes()).ToListAsync(); + if (resources.Any()) + { + principal.SetResources(resources); + } + } + await IdentitySecurityLogManager.SaveAsync( new IdentitySecurityLogContext { @@ -240,15 +250,4 @@ public partial class TokenController await UserManager.GetTwoFactorEnabledAsync(user) && (await UserManager.GetValidTwoFactorProvidersAsync(user)).Count > 0; } - - //TODO: Check the token claims - protected virtual Task AddCustomClaimsAsync(List customClaims, IdentityUser user) - { - if (user.TenantId.HasValue) - { - customClaims.Add(new Claim(AbpClaimTypes.TenantId, user.TenantId.Value.ToString())); - } - - return Task.CompletedTask; - } } \ No newline at end of file diff --git a/modules/OpenIddict/src/Volo.Abp.OpenIddict.EntityFrameworkCore/Volo/Abp/OpenIddict/Jwt/JwtTokenMiddleware.cs b/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Jwt/JwtTokenMiddleware.cs similarity index 100% rename from modules/OpenIddict/src/Volo.Abp.OpenIddict.EntityFrameworkCore/Volo/Abp/OpenIddict/Jwt/JwtTokenMiddleware.cs rename to modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Jwt/JwtTokenMiddleware.cs diff --git a/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/OpenIddictAspNetCoreModule.cs b/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/OpenIddictAspNetCoreModule.cs deleted file mode 100644 index 32503a75c9..0000000000 --- a/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/OpenIddictAspNetCoreModule.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Microsoft.AspNetCore.Mvc.Razor; -using Volo.Abp.AspNetCore.Mvc; -using Volo.Abp.Modularity; - -namespace Volo.Abp.OpenIddict; - -[DependsOn( - typeof(AbpAspNetCoreMvcModule), - typeof(OpenIddictDomainModule) -)] -public class OpenIddictAspNetCoreModule : AbpModule -{ - public override void ConfigureServices(ServiceConfigurationContext context) - { - Configure(options => - { - options.ViewLocationFormats.Add("/Volo/Abp/OpenIddict/Views/{1}/{0}.cshtml"); - options.ViewLocationFormats.Add("/Volo/Abp/OpenIddict/Views/Authorization/{0}.cshtml"); - }); - } -} diff --git a/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/ViewModels/Authorization/LogoutViewModel.cs b/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/ViewModels/Authorization/LogoutViewModel.cs deleted file mode 100644 index ee5dd812e9..0000000000 --- a/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/ViewModels/Authorization/LogoutViewModel.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Volo.Abp.OpenIddict.ViewModels.Authorization; - -public class LogoutViewModel -{ - public string RequestId { get; set; } -} diff --git a/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/ViewModels/Authorization/AuthorizeViewModel.cs b/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/ViewModels/Authorize/AuthorizeViewModel.cs similarity index 100% rename from modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/ViewModels/Authorization/AuthorizeViewModel.cs rename to modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/ViewModels/Authorize/AuthorizeViewModel.cs diff --git a/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Views/Authorization/Authorize.cshtml b/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Views/Authorize/Authorize.cshtml similarity index 81% rename from modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Views/Authorization/Authorize.cshtml rename to modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Views/Authorize/Authorize.cshtml index 443533cf71..43beefa333 100644 --- a/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Views/Authorization/Authorize.cshtml +++ b/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Views/Authorize/Authorize.cshtml @@ -2,14 +2,12 @@ @model AuthorizeViewModel

Authorization

-

Do you want to grant @Model.ApplicationName access to your data? (scopes requested: @Model.Scope)

-
+ @Html.AntiForgeryToken() @* Flow the request parameters so they can be received by the Accept/Reject actions: *@ - @foreach (var parameter in Context.Request.HasFormContentType ? - (IEnumerable>) Context.Request.Form : Context.Request.Query) + @foreach (var parameter in Context.Request.HasFormContentType ? (IEnumerable>) Context.Request.Form : Context.Request.Query) { } diff --git a/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Views/Authorization/Logout.cshtml b/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Views/Logout/Logout.cshtml similarity index 66% rename from modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Views/Authorization/Logout.cshtml rename to modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Views/Logout/Logout.cshtml index 2a3d75c569..f57626a8e7 100644 --- a/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Views/Authorization/Logout.cshtml +++ b/modules/OpenIddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Views/Logout/Logout.cshtml @@ -4,15 +4,14 @@

Log out

Are you sure you want to sign out?

- @* asp-controller="Authorization" asp-action="Logout" *@ - + + @Html.AntiForgeryToken() @* Flow the request parameters so they can be received by the LogoutPost action: *@ - @foreach (var parameter in Context.Request.HasFormContentType ? - (IEnumerable>) Context.Request.Form : Context.Request.Query) + @foreach (var parameter in Context.Request.HasFormContentType ? (IEnumerable>) Context.Request.Form : Context.Request.Query) { - + } - +
diff --git a/modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain.Shared/Volo/Abp/OpenIddict/OpenIddictDomainSharedModule.cs b/modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain.Shared/Volo/Abp/OpenIddict/AbpOpenIddictDomainSharedModule.cs similarity index 87% rename from modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain.Shared/Volo/Abp/OpenIddict/OpenIddictDomainSharedModule.cs rename to modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain.Shared/Volo/Abp/OpenIddict/AbpOpenIddictDomainSharedModule.cs index 7328333116..3d3219376c 100644 --- a/modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain.Shared/Volo/Abp/OpenIddict/OpenIddictDomainSharedModule.cs +++ b/modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain.Shared/Volo/Abp/OpenIddict/AbpOpenIddictDomainSharedModule.cs @@ -11,13 +11,13 @@ namespace Volo.Abp.OpenIddict; [DependsOn( typeof(AbpValidationModule) )] -public class OpenIddictDomainSharedModule : AbpModule +public class AbpOpenIddictDomainSharedModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { Configure(options => { - options.FileSets.AddEmbedded(); + options.FileSets.AddEmbedded(); }); Configure(options => diff --git a/modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain/Volo.Abp.OpenIddict.Domain.csproj b/modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain/Volo.Abp.OpenIddict.Domain.csproj index 106714fe64..91c6e44898 100644 --- a/modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain/Volo.Abp.OpenIddict.Domain.csproj +++ b/modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain/Volo.Abp.OpenIddict.Domain.csproj @@ -13,12 +13,11 @@ + + + - - - - diff --git a/modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/OpenIddictDomainModule.cs b/modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/AbpOpenIddictDomainModule.cs similarity index 84% rename from modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/OpenIddictDomainModule.cs rename to modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/AbpOpenIddictDomainModule.cs index d312dc4ea0..04c7d9d9d4 100644 --- a/modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/OpenIddictDomainModule.cs +++ b/modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/AbpOpenIddictDomainModule.cs @@ -16,9 +16,9 @@ namespace Volo.Abp.OpenIddict; [DependsOn( typeof(AbpDddDomainModule), typeof(AbpIdentityDomainModule), - typeof(OpenIddictDomainSharedModule) + typeof(AbpOpenIddictDomainSharedModule) )] -public class OpenIddictDomainModule : AbpModule +public class AbpOpenIddictDomainModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { @@ -32,17 +32,20 @@ public class OpenIddictDomainModule : AbpModule if (builderOptions.UpdateAbpClaimTypes) { AbpClaimTypes.UserId = JwtClaimTypes.Subject; - AbpClaimTypes.UserName = JwtClaimTypes.Name; AbpClaimTypes.Role = JwtClaimTypes.Role; + AbpClaimTypes.UserName = JwtClaimTypes.Name; + AbpClaimTypes.Name = JwtClaimTypes.GivenName; + AbpClaimTypes.PhoneNumber = JwtClaimTypes.PhoneNumber; + AbpClaimTypes.PhoneNumberVerified = JwtClaimTypes.PhoneNumberVerified; AbpClaimTypes.Email = JwtClaimTypes.Email; + AbpClaimTypes.EmailVerified = JwtClaimTypes.EmailVerified; } var openIddictBuilder = services.AddOpenIddict() .AddCore(builder => { - builder.Configure(options => options.DisableAdditionalFiltering = false); - - builder.SetDefaultApplicationEntity() + builder + .SetDefaultApplicationEntity() .SetDefaultAuthorizationEntity() .SetDefaultScopeEntity() .SetDefaultTokenEntity(); @@ -51,9 +54,7 @@ public class OpenIddictDomainModule : AbpModule }) .AddServer(builder => { - //builder.UseDataProtection(); - - // Can be enable by Configure OpenIddictServerOptions.DisableAccessTokenEncryption + // Can be enable by Configure OpenIddictServerOptions.DisableAccessTokenEncryption = false builder.DisableAccessTokenEncryption(); builder @@ -90,29 +91,19 @@ public class OpenIddictDomainModule : AbpModule OpenIddictConstants.Scopes.Address, OpenIddictConstants.Scopes.OfflineAccess }); - + if (builderOptions.AddDevelopmentEncryptionAndSigningCertificate) { builder.AddDevelopmentEncryptionCertificate() .AddDevelopmentSigningCertificate(); } - //TODO: - builder.UseAspNetCore() - .EnableAuthorizationEndpointPassthrough() - .EnableTokenEndpointPassthrough() - .EnableUserinfoEndpointPassthrough() - .EnableLogoutEndpointPassthrough() - .EnableVerificationEndpointPassthrough(); - services.ExecutePreConfiguredActions(builder); }) .AddValidation(builder => { builder.UseLocalServer(); - // builder.UseDataProtection(); - builder.UseAspNetCore(); services.ExecutePreConfiguredActions(builder); }); diff --git a/modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Authorizations/OpenIddictAuthorization.cs b/modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Authorizations/OpenIddictAuthorization.cs index 0ec3661bbc..fe53fb11a8 100644 --- a/modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Authorizations/OpenIddictAuthorization.cs +++ b/modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Authorizations/OpenIddictAuthorization.cs @@ -1,12 +1,17 @@ using System; using System.Collections.Generic; +using Volo.Abp.Auditing; +using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.OpenIddict.Tokens; namespace Volo.Abp.OpenIddict.Authorizations; -public class OpenIddictAuthorization : FullAuditedEntity +public class OpenIddictAuthorization : FullAuditedEntity, IHasConcurrencyStamp { + [DisableAuditing] + public virtual string ConcurrencyStamp { get; set; } + /// /// Gets or sets the application associated with the current authorization. /// diff --git a/modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/OpenIddictBuilderOptions.cs b/modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/OpenIddictBuilderOptions.cs index 4a4609e264..72122ddb04 100644 --- a/modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/OpenIddictBuilderOptions.cs +++ b/modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/OpenIddictBuilderOptions.cs @@ -5,13 +5,13 @@ namespace Volo.Abp.OpenIddict; public class OpenIddictBuilderOptions { /// - /// Updates to be compatible with identity server claims. + /// Updates to be compatible with OpenIddict claims. /// Default: true. /// public bool UpdateAbpClaimTypes { get; set; } = true; /// - /// Set false to suppress AddDeveloperSigningCredential() call on the IIdentityServerBuilder. + /// Set false to suppress AddDeveloperSigningCredential() call on the OpenIddictBuilder. /// public bool AddDevelopmentEncryptionAndSigningCertificate { get; set; } = true; } diff --git a/modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Tokens/OpenIddictToken.cs b/modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Tokens/OpenIddictToken.cs index f2a8cfd744..656ab724f5 100644 --- a/modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Tokens/OpenIddictToken.cs +++ b/modules/OpenIddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Tokens/OpenIddictToken.cs @@ -1,13 +1,18 @@ using System; using JetBrains.Annotations; +using Volo.Abp.Auditing; +using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.OpenIddict.Applications; using Volo.Abp.OpenIddict.Authorizations; namespace Volo.Abp.OpenIddict.Tokens; -public class OpenIddictToken : FullAuditedEntity +public class OpenIddictToken : FullAuditedEntity, IHasConcurrencyStamp { + [DisableAuditing] + public virtual string ConcurrencyStamp { get; set; } + /// /// Gets or sets the application associated with the current token. /// diff --git a/modules/OpenIddict/src/Volo.Abp.OpenIddict.EntityFrameworkCore/Volo/Abp/OpenIddict/EntityFrameworkCore/OpenIddictEntityFrameworkCoreModule.cs b/modules/OpenIddict/src/Volo.Abp.OpenIddict.EntityFrameworkCore/Volo/Abp/OpenIddict/EntityFrameworkCore/AbpOpenIddictEntityFrameworkCoreModule.cs similarity index 90% rename from modules/OpenIddict/src/Volo.Abp.OpenIddict.EntityFrameworkCore/Volo/Abp/OpenIddict/EntityFrameworkCore/OpenIddictEntityFrameworkCoreModule.cs rename to modules/OpenIddict/src/Volo.Abp.OpenIddict.EntityFrameworkCore/Volo/Abp/OpenIddict/EntityFrameworkCore/AbpOpenIddictEntityFrameworkCoreModule.cs index cf38805691..fcd5903efe 100644 --- a/modules/OpenIddict/src/Volo.Abp.OpenIddict.EntityFrameworkCore/Volo/Abp/OpenIddict/EntityFrameworkCore/OpenIddictEntityFrameworkCoreModule.cs +++ b/modules/OpenIddict/src/Volo.Abp.OpenIddict.EntityFrameworkCore/Volo/Abp/OpenIddict/EntityFrameworkCore/AbpOpenIddictEntityFrameworkCoreModule.cs @@ -9,10 +9,10 @@ using Volo.Abp.OpenIddict.Tokens; namespace Volo.Abp.OpenIddict.EntityFrameworkCore; [DependsOn( - typeof(OpenIddictDomainModule), + typeof(AbpOpenIddictDomainModule), typeof(AbpEntityFrameworkCoreModule) )] -public class OpenIddictEntityFrameworkCoreModule : AbpModule +public class AbpOpenIddictEntityFrameworkCoreModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { diff --git a/modules/OpenIddict/src/Volo.Abp.OpenIddict.MongoDB/Volo/Abp/OpenIddict/MongoDB/OpenIddictMongoDbModule.cs b/modules/OpenIddict/src/Volo.Abp.OpenIddict.MongoDB/Volo/Abp/OpenIddict/MongoDB/AbpOpenIddictMongoDbModule.cs similarity index 91% rename from modules/OpenIddict/src/Volo.Abp.OpenIddict.MongoDB/Volo/Abp/OpenIddict/MongoDB/OpenIddictMongoDbModule.cs rename to modules/OpenIddict/src/Volo.Abp.OpenIddict.MongoDB/Volo/Abp/OpenIddict/MongoDB/AbpOpenIddictMongoDbModule.cs index 5d31d1f843..d4119a228e 100644 --- a/modules/OpenIddict/src/Volo.Abp.OpenIddict.MongoDB/Volo/Abp/OpenIddict/MongoDB/OpenIddictMongoDbModule.cs +++ b/modules/OpenIddict/src/Volo.Abp.OpenIddict.MongoDB/Volo/Abp/OpenIddict/MongoDB/AbpOpenIddictMongoDbModule.cs @@ -9,10 +9,10 @@ using Volo.Abp.OpenIddict.Tokens; namespace Volo.Abp.OpenIddict.MongoDB; [DependsOn( - typeof(OpenIddictDomainModule), + typeof(AbpOpenIddictDomainModule), typeof(AbpMongoDbModule) )] -public class OpenIddictMongoDbModule : AbpModule +public class AbpOpenIddictMongoDbModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { diff --git a/modules/OpenIddict/test/Volo.Abp.OpenIddict.EntityFrameworkCore.Tests/EntityFrameworkCore/OpenIddictEntityFrameworkCoreTestModule.cs b/modules/OpenIddict/test/Volo.Abp.OpenIddict.EntityFrameworkCore.Tests/EntityFrameworkCore/OpenIddictEntityFrameworkCoreTestModule.cs index 203b34d7ab..7d7e630ab8 100644 --- a/modules/OpenIddict/test/Volo.Abp.OpenIddict.EntityFrameworkCore.Tests/EntityFrameworkCore/OpenIddictEntityFrameworkCoreTestModule.cs +++ b/modules/OpenIddict/test/Volo.Abp.OpenIddict.EntityFrameworkCore.Tests/EntityFrameworkCore/OpenIddictEntityFrameworkCoreTestModule.cs @@ -4,13 +4,15 @@ using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.Sqlite; +using Volo.Abp.Identity.EntityFrameworkCore; using Volo.Abp.Modularity; namespace Volo.Abp.OpenIddict.EntityFrameworkCore; [DependsOn( typeof(OpenIddictTestBaseModule), - typeof(OpenIddictEntityFrameworkCoreModule), + typeof(AbpOpenIddictEntityFrameworkCoreModule), + typeof(AbpIdentityEntityFrameworkCoreModule), typeof(AbpEntityFrameworkCoreSqliteModule) )] public class OpenIddictEntityFrameworkCoreTestModule : AbpModule @@ -33,6 +35,10 @@ public class OpenIddictEntityFrameworkCoreTestModule : AbpModule var connection = new SqliteConnection("Data Source=:memory:"); connection.Open(); + new IdentityDbContext( + new DbContextOptionsBuilder().UseSqlite(connection).Options + ).GetService().CreateTables(); + new OpenIddictDbContext( new DbContextOptionsBuilder().UseSqlite(connection).Options ).GetService().CreateTables(); diff --git a/modules/OpenIddict/test/Volo.Abp.OpenIddict.EntityFrameworkCore.Tests/Volo.Abp.OpenIddict.EntityFrameworkCore.Tests.csproj b/modules/OpenIddict/test/Volo.Abp.OpenIddict.EntityFrameworkCore.Tests/Volo.Abp.OpenIddict.EntityFrameworkCore.Tests.csproj index 5d2a3294e6..20ac42e254 100644 --- a/modules/OpenIddict/test/Volo.Abp.OpenIddict.EntityFrameworkCore.Tests/Volo.Abp.OpenIddict.EntityFrameworkCore.Tests.csproj +++ b/modules/OpenIddict/test/Volo.Abp.OpenIddict.EntityFrameworkCore.Tests/Volo.Abp.OpenIddict.EntityFrameworkCore.Tests.csproj @@ -14,6 +14,7 @@ + diff --git a/modules/OpenIddict/test/Volo.Abp.OpenIddict.MongoDB.Tests/MongoDB/OpenIddictMongoDbTestModule.cs b/modules/OpenIddict/test/Volo.Abp.OpenIddict.MongoDB.Tests/MongoDB/OpenIddictMongoDbTestModule.cs index 0393b42825..bdd4bdfa57 100644 --- a/modules/OpenIddict/test/Volo.Abp.OpenIddict.MongoDB.Tests/MongoDB/OpenIddictMongoDbTestModule.cs +++ b/modules/OpenIddict/test/Volo.Abp.OpenIddict.MongoDB.Tests/MongoDB/OpenIddictMongoDbTestModule.cs @@ -1,13 +1,14 @@ using System; using Volo.Abp.Data; using Volo.Abp.Modularity; -using Volo.Abp.Uow; +using Volo.Abp.Identity.MongoDB; namespace Volo.Abp.OpenIddict.MongoDB; [DependsOn( typeof(OpenIddictTestBaseModule), - typeof(OpenIddictMongoDbModule) + typeof(AbpIdentityMongoDbModule), + typeof(AbpOpenIddictMongoDbModule) )] public class OpenIddictMongoDbTestModule : AbpModule { diff --git a/modules/OpenIddict/test/Volo.Abp.OpenIddict.MongoDB.Tests/Volo.Abp.OpenIddict.MongoDB.Tests.csproj b/modules/OpenIddict/test/Volo.Abp.OpenIddict.MongoDB.Tests/Volo.Abp.OpenIddict.MongoDB.Tests.csproj index 2d97c9ef3f..f5e7595974 100644 --- a/modules/OpenIddict/test/Volo.Abp.OpenIddict.MongoDB.Tests/Volo.Abp.OpenIddict.MongoDB.Tests.csproj +++ b/modules/OpenIddict/test/Volo.Abp.OpenIddict.MongoDB.Tests/Volo.Abp.OpenIddict.MongoDB.Tests.csproj @@ -13,6 +13,7 @@ + diff --git a/modules/OpenIddict/test/Volo.Abp.OpenIddict.TestBase/OpenIddictTestBaseModule.cs b/modules/OpenIddict/test/Volo.Abp.OpenIddict.TestBase/OpenIddictTestBaseModule.cs index 23295d5cf7..95cddaf6d0 100644 --- a/modules/OpenIddict/test/Volo.Abp.OpenIddict.TestBase/OpenIddictTestBaseModule.cs +++ b/modules/OpenIddict/test/Volo.Abp.OpenIddict.TestBase/OpenIddictTestBaseModule.cs @@ -12,7 +12,7 @@ namespace Volo.Abp.OpenIddict; typeof(AbpAutofacModule), typeof(AbpTestBaseModule), typeof(AbpAuthorizationModule), - typeof(OpenIddictDomainModule) + typeof(AbpOpenIddictDomainModule) )] public class OpenIddictTestBaseModule : AbpModule {