From 2323dfbcba1872ef219404ef5ae8b94383f9056e Mon Sep 17 00:00:00 2001 From: rserj Date: Mon, 24 Jul 2017 18:47:42 -0700 Subject: [PATCH] #808 Fixes after Nicholas and Wojciech reviews --- .../Orchard.OpenId/ModelBinders/UrlsAttribute.cs | 5 ----- .../Orchard.OpenId/Services/OpenIdCorsConfiguration.cs | 9 ++++++--- src/OrchardCore/OrchardCore.Cms/OrchardCore.Cms.csproj | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/OrchardCore.Modules/Orchard.OpenId/ModelBinders/UrlsAttribute.cs b/src/OrchardCore.Modules/Orchard.OpenId/ModelBinders/UrlsAttribute.cs index 5fa31b66942..0262c49340b 100644 --- a/src/OrchardCore.Modules/Orchard.OpenId/ModelBinders/UrlsAttribute.cs +++ b/src/OrchardCore.Modules/Orchard.OpenId/ModelBinders/UrlsAttribute.cs @@ -16,11 +16,6 @@ public Task BindModelAsync(ModelBindingContext bindingContext) { var valueAsString = valueProviderResult.FirstValue; - if (string.IsNullOrEmpty(valueAsString)) - { - return TaskCache.CompletedTask; - } - if (!string.IsNullOrEmpty(valueAsString)) { var origins = valueAsString diff --git a/src/OrchardCore.Modules/Orchard.OpenId/Services/OpenIdCorsConfiguration.cs b/src/OrchardCore.Modules/Orchard.OpenId/Services/OpenIdCorsConfiguration.cs index ffdee0ab097..db6306f66ab 100644 --- a/src/OrchardCore.Modules/Orchard.OpenId/Services/OpenIdCorsConfiguration.cs +++ b/src/OrchardCore.Modules/Orchard.OpenId/Services/OpenIdCorsConfiguration.cs @@ -20,14 +20,17 @@ public OpenIdCorsConfiguration(OpenIdApplicationStore openIdService) public void Configure(CorsOptions options) { - var openIdApplications = _openIdApplicationStore.GetAllApps().GetAwaiter().GetResult(); - if (openIdApplications == null || !openIdApplications.Any()) return; + var openIdApplications = _openIdApplicationStore.GetAllApps().GetAwaiter().GetResult().ToList(); + if (openIdApplications == null || openIdApplications.Count==0) return; var appOrigins = openIdApplications .Where(app => (app.AllowPasswordFlow || app.AllowClientCredentialsFlow || app.AllowRefreshTokenFlow) && app.AllowedOrigins != null && app.AllowedOrigins.Any()) .SelectMany(app => app.AllowedOrigins) .ToArray(); - if (!appOrigins.Any()) return; + if (appOrigins.Length == 0) + { + return; + } //Auth end-points policy options.AddPolicy(Constants.OpenIdConnectAuthPolicy, builder => builder diff --git a/src/OrchardCore/OrchardCore.Cms/OrchardCore.Cms.csproj b/src/OrchardCore/OrchardCore.Cms/OrchardCore.Cms.csproj index cf9c0b980d0..4cb0536131c 100644 --- a/src/OrchardCore/OrchardCore.Cms/OrchardCore.Cms.csproj +++ b/src/OrchardCore/OrchardCore.Cms/OrchardCore.Cms.csproj @@ -22,7 +22,7 @@ --> - +