From 4ec1d9efaf75df2cd472e191a6d548219e3faaab Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 30 Aug 2022 12:32:30 +0800 Subject: [PATCH] Update `OpenIddictDataSeedContributor`. --- .../Data/OpenIddictDataSeedContributor.cs | 7 +++++++ .../Data/OpenIddictDataSeedContributor.cs | 7 +++++++ .../OpenIddict/OpenIddictDataSeedContributor.cs | 7 +++++++ .../OpenIddict/OpenIddictDataSeedContributor.cs | 7 +++++++ 4 files changed, 28 insertions(+) diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/Data/OpenIddictDataSeedContributor.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/Data/OpenIddictDataSeedContributor.cs index 23317f8aaff..429a83d5624 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/Data/OpenIddictDataSeedContributor.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/Data/OpenIddictDataSeedContributor.cs @@ -198,6 +198,7 @@ private async Task CreateApplicationAsync( { application.Permissions.Add(OpenIddictConstants.Permissions.Endpoints.Token); application.Permissions.Add(OpenIddictConstants.Permissions.Endpoints.Revocation); + application.Permissions.Add(OpenIddictConstants.Permissions.Endpoints.Introspection); } if (grantType == OpenIddictConstants.GrantTypes.ClientCredentials) @@ -220,6 +221,12 @@ private async Task CreateApplicationAsync( application.Permissions.Add(OpenIddictConstants.Permissions.GrantTypes.RefreshToken); } + if (grantType == OpenIddictConstants.GrantTypes.DeviceCode) + { + application.Permissions.Add(OpenIddictConstants.Permissions.GrantTypes.DeviceCode); + application.Permissions.Add(OpenIddictConstants.Permissions.Endpoints.Device); + } + if (grantType == OpenIddictConstants.GrantTypes.Implicit) { application.Permissions.Add(OpenIddictConstants.Permissions.ResponseTypes.IdToken); diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Data/OpenIddictDataSeedContributor.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Data/OpenIddictDataSeedContributor.cs index 23317f8aaff..429a83d5624 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Data/OpenIddictDataSeedContributor.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/Data/OpenIddictDataSeedContributor.cs @@ -198,6 +198,7 @@ private async Task CreateApplicationAsync( { application.Permissions.Add(OpenIddictConstants.Permissions.Endpoints.Token); application.Permissions.Add(OpenIddictConstants.Permissions.Endpoints.Revocation); + application.Permissions.Add(OpenIddictConstants.Permissions.Endpoints.Introspection); } if (grantType == OpenIddictConstants.GrantTypes.ClientCredentials) @@ -220,6 +221,12 @@ private async Task CreateApplicationAsync( application.Permissions.Add(OpenIddictConstants.Permissions.GrantTypes.RefreshToken); } + if (grantType == OpenIddictConstants.GrantTypes.DeviceCode) + { + application.Permissions.Add(OpenIddictConstants.Permissions.GrantTypes.DeviceCode); + application.Permissions.Add(OpenIddictConstants.Permissions.Endpoints.Device); + } + if (grantType == OpenIddictConstants.GrantTypes.Implicit) { application.Permissions.Add(OpenIddictConstants.Permissions.ResponseTypes.IdToken); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/OpenIddict/OpenIddictDataSeedContributor.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/OpenIddict/OpenIddictDataSeedContributor.cs index 9026bfaeaa9..804e15d0f27 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/OpenIddict/OpenIddictDataSeedContributor.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/OpenIddict/OpenIddictDataSeedContributor.cs @@ -281,6 +281,7 @@ private async Task CreateApplicationAsync( { application.Permissions.Add(OpenIddictConstants.Permissions.Endpoints.Token); application.Permissions.Add(OpenIddictConstants.Permissions.Endpoints.Revocation); + application.Permissions.Add(OpenIddictConstants.Permissions.Endpoints.Introspection); } if (grantType == OpenIddictConstants.GrantTypes.ClientCredentials) @@ -303,6 +304,12 @@ private async Task CreateApplicationAsync( application.Permissions.Add(OpenIddictConstants.Permissions.GrantTypes.RefreshToken); } + if (grantType == OpenIddictConstants.GrantTypes.DeviceCode) + { + application.Permissions.Add(OpenIddictConstants.Permissions.GrantTypes.DeviceCode); + application.Permissions.Add(OpenIddictConstants.Permissions.Endpoints.Device); + } + if (grantType == OpenIddictConstants.GrantTypes.Implicit) { application.Permissions.Add(OpenIddictConstants.Permissions.ResponseTypes.IdToken); diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/OpenIddict/OpenIddictDataSeedContributor.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/OpenIddict/OpenIddictDataSeedContributor.cs index 872920cb82a..7ecafc5f6a2 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/OpenIddict/OpenIddictDataSeedContributor.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/OpenIddict/OpenIddictDataSeedContributor.cs @@ -250,6 +250,7 @@ private async Task CreateApplicationAsync( { application.Permissions.Add(OpenIddictConstants.Permissions.Endpoints.Token); application.Permissions.Add(OpenIddictConstants.Permissions.Endpoints.Revocation); + application.Permissions.Add(OpenIddictConstants.Permissions.Endpoints.Introspection); } if (grantType == OpenIddictConstants.GrantTypes.ClientCredentials) @@ -272,6 +273,12 @@ private async Task CreateApplicationAsync( application.Permissions.Add(OpenIddictConstants.Permissions.GrantTypes.RefreshToken); } + if (grantType == OpenIddictConstants.GrantTypes.DeviceCode) + { + application.Permissions.Add(OpenIddictConstants.Permissions.GrantTypes.DeviceCode); + application.Permissions.Add(OpenIddictConstants.Permissions.Endpoints.Device); + } + if (grantType == OpenIddictConstants.GrantTypes.Implicit) { application.Permissions.Add(OpenIddictConstants.Permissions.ResponseTypes.IdToken);