diff --git a/aspnet-core/LINGYUN.MicroService.SingleProject.sln b/aspnet-core/LINGYUN.MicroService.SingleProject.sln index 81f89c443..756196acb 100644 --- a/aspnet-core/LINGYUN.MicroService.SingleProject.sln +++ b/aspnet-core/LINGYUN.MicroService.SingleProject.sln @@ -688,6 +688,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Quartz.SqlInsta EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.UI.Navigation.VueVbenAdmin5", "modules\platform\LINGYUN.Abp.UI.Navigation.VueVbenAdmin5\LINGYUN.Abp.UI.Navigation.VueVbenAdmin5.csproj", "{113167DA-602A-4EBE-9357-D83C090DBA3F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Account.Web.OAuth", "modules\account\LINGYUN.Abp.Account.Web.OAuth\LINGYUN.Abp.Account.Web.OAuth.csproj", "{2379F502-BBBD-4BF2-91F7-D0E5C61E91B7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Account.OAuth", "modules\account\LINGYUN.Abp.Account.OAuth\LINGYUN.Abp.Account.OAuth.csproj", "{2E4C437A-989D-68D9-C5FB-1AE085B2CBC8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1830,6 +1834,14 @@ Global {113167DA-602A-4EBE-9357-D83C090DBA3F}.Debug|Any CPU.Build.0 = Debug|Any CPU {113167DA-602A-4EBE-9357-D83C090DBA3F}.Release|Any CPU.ActiveCfg = Release|Any CPU {113167DA-602A-4EBE-9357-D83C090DBA3F}.Release|Any CPU.Build.0 = Release|Any CPU + {2379F502-BBBD-4BF2-91F7-D0E5C61E91B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2379F502-BBBD-4BF2-91F7-D0E5C61E91B7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2379F502-BBBD-4BF2-91F7-D0E5C61E91B7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2379F502-BBBD-4BF2-91F7-D0E5C61E91B7}.Release|Any CPU.Build.0 = Release|Any CPU + {2E4C437A-989D-68D9-C5FB-1AE085B2CBC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2E4C437A-989D-68D9-C5FB-1AE085B2CBC8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2E4C437A-989D-68D9-C5FB-1AE085B2CBC8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2E4C437A-989D-68D9-C5FB-1AE085B2CBC8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2165,6 +2177,8 @@ Global {B8D0DCBD-8D03-E450-0258-D0660A356BF0} = {22295ECE-A973-43F0-A6F2-982F7DB02F4E} {A8586A5A-A213-4C66-819C-E692187B1F39} = {91EE5D5B-B6DF-43F1-BC09-1A982719A34B} {113167DA-602A-4EBE-9357-D83C090DBA3F} = {F3449D35-8671-4BF6-8D1B-EFBB8AFD61DD} + {2379F502-BBBD-4BF2-91F7-D0E5C61E91B7} = {4F837B81-EA7D-472A-8482-3D5A730DF810} + {2E4C437A-989D-68D9-C5FB-1AE085B2CBC8} = {4F837B81-EA7D-472A-8482-3D5A730DF810} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {711A43C0-A2F8-4E5C-9B9F-F2551E4B3FF1} diff --git a/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/DataSeeder/ClientDataSeederContributor.cs b/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/DataSeeder/ClientDataSeederContributor.cs index 975ce7852..531152c02 100644 --- a/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/DataSeeder/ClientDataSeederContributor.cs +++ b/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/DataSeeder/ClientDataSeederContributor.cs @@ -204,6 +204,68 @@ public class ClientDataSeederContributor : IDataSeedContributor, ITransientDepen await _permissionDataSeeder.SeedAsync(ClientPermissionValueProvider.ProviderName, internalServiceClientId, internalServicePermissions); } } + + var oauthClientId = configurationSection["OAuthClient:ClientId"]; + if (!oauthClientId.IsNullOrWhiteSpace()) + { + var oauthClientRootUrl = configurationSection["OAuthClient:RootUrl"].EnsureEndsWith('/'); + + if (await _applicationRepository.FindByClientIdAsync(oauthClientId) == null) + { + await _applicationManager.CreateAsync(new OpenIddictApplicationDescriptor + { + ClientId = oauthClientId, + ClientSecret = null, + ApplicationType = OpenIddictConstants.ApplicationTypes.Web, + ConsentType = OpenIddictConstants.ConsentTypes.Implicit, + DisplayName = "OAuth Client", + PostLogoutRedirectUris = + { + new Uri(oauthClientRootUrl + "signout-callback"), + new Uri(oauthClientRootUrl) + }, + RedirectUris = + { + new Uri(oauthClientRootUrl + "/signin-callback"), + new Uri(oauthClientRootUrl) + }, + Permissions = + { + OpenIddictConstants.Permissions.Endpoints.Authorization, + OpenIddictConstants.Permissions.Endpoints.Token, + OpenIddictConstants.Permissions.Endpoints.DeviceAuthorization, + OpenIddictConstants.Permissions.Endpoints.Introspection, + OpenIddictConstants.Permissions.Endpoints.Revocation, + OpenIddictConstants.Permissions.Endpoints.EndSession, + + OpenIddictConstants.Permissions.GrantTypes.AuthorizationCode, + OpenIddictConstants.Permissions.GrantTypes.RefreshToken, + + OpenIddictConstants.Permissions.ResponseTypes.Code, + OpenIddictConstants.Permissions.ResponseTypes.CodeIdToken, + OpenIddictConstants.Permissions.ResponseTypes.CodeIdTokenToken, + OpenIddictConstants.Permissions.ResponseTypes.CodeToken, + OpenIddictConstants.Permissions.ResponseTypes.IdToken, + OpenIddictConstants.Permissions.ResponseTypes.IdTokenToken, + OpenIddictConstants.Permissions.ResponseTypes.None, + OpenIddictConstants.Permissions.ResponseTypes.Token, + + OpenIddictConstants.Permissions.Scopes.Roles, + OpenIddictConstants.Permissions.Scopes.Profile, + OpenIddictConstants.Permissions.Scopes.Email, + OpenIddictConstants.Permissions.Scopes.Address, + OpenIddictConstants.Permissions.Scopes.Phone, + OpenIddictConstants.Permissions.Prefixes.Scope + scope + } + }); + + var oauthClientPermissions = new string[1] + { + "AbpIdentity.UserLookup" + }; + await _permissionDataSeeder.SeedAsync(ClientPermissionValueProvider.ProviderName, oauthClientId, oauthClientPermissions); + } + } } #endregion