From dc1981f91dfbb30c3e9414c09f4e226282ce5dfe Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 26 Feb 2020 11:18:07 +0800 Subject: [PATCH 1/2] Fix scopes may be null bug. --- .../Pages/Consent.cshtml.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs index 3fb68feaca..c583005188 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs @@ -187,7 +187,9 @@ namespace Volo.Abp.Account.Web.Pages public List GetAllowedScopeNames() { - return IdentityScopes.Union(ApiScopes).Where(s => s.Checked).Select(s => s.Name).ToList(); + var identityScopes = IdentityScopes ?? new List(); + var apiScopes = IdentityScopes ?? new List(); + return identityScopes.Union(apiScopes).Where(s => s.Checked).Select(s => s.Name).ToList(); } } From 78d6831efa7b0b8e0bbedc20ada83cf3879081ec Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 2 Mar 2020 16:21:23 +0800 Subject: [PATCH 2/2] Check scope is null or empty. --- .../Pages/Consent.cshtml | 6 +++--- .../Pages/Consent.cshtml.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml index fa3efda621..b61ad00152 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml @@ -1,4 +1,4 @@ -@page +@page @using Volo.Abp.Account.Web.Pages @using Volo.Abp.Account.Web.Pages.Account @model ConsentModel @@ -25,7 +25,7 @@
Uncheck the permissions you do not wish to grant.
- @if (Model.ConsentInput.IdentityScopes.Any()) + @if (!Model.ConsentInput.IdentityScopes.IsNullOrEmpty()) {

Personal Information

@@ -55,7 +55,7 @@ } - @if (Model.ConsentInput.ApiScopes.Any()) + @if (!Model.ConsentInput.ApiScopes.IsNullOrEmpty()) {

Application Access

diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs index c583005188..2df177b620 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs @@ -106,7 +106,7 @@ namespace Volo.Abp.Account.Web.Pages } else { - if (ConsentInput.IdentityScopes.Any() || ConsentInput.ApiScopes.Any()) + if (!ConsentInput.IdentityScopes.IsNullOrEmpty() || !ConsentInput.ApiScopes.IsNullOrEmpty()) { grantedConsent = new ConsentResponse {