From ac773beffcdd348599f4b8cb4cac76473bee0ecf Mon Sep 17 00:00:00 2001 From: Adem Caglin Date: Thu, 29 Sep 2016 23:24:24 +0300 Subject: [PATCH] Changed BuildChallengeUrl in order to accept AuthorizationEndpoint which contains query parameters (#992) --- .../OAuthHandler.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.AspNetCore.Authentication.OAuth/OAuthHandler.cs b/src/Microsoft.AspNetCore.Authentication.OAuth/OAuthHandler.cs index dbfa1ef92b..1c5143842f 100644 --- a/src/Microsoft.AspNetCore.Authentication.OAuth/OAuthHandler.cs +++ b/src/Microsoft.AspNetCore.Authentication.OAuth/OAuthHandler.cs @@ -15,6 +15,7 @@ using Microsoft.AspNetCore.Http.Extensions; using Microsoft.AspNetCore.Http.Features.Authentication; using Microsoft.Extensions.Primitives; using Newtonsoft.Json.Linq; +using Microsoft.AspNetCore.WebUtilities; namespace Microsoft.AspNetCore.Authentication.OAuth { @@ -206,8 +207,7 @@ namespace Microsoft.AspNetCore.Authentication.OAuth var scope = FormatScope(); var state = Options.StateDataFormat.Protect(properties); - - var queryBuilder = new QueryBuilder() + var parameters = new Dictionary { { "client_id", Options.ClientId }, { "scope", scope }, @@ -215,7 +215,7 @@ namespace Microsoft.AspNetCore.Authentication.OAuth { "redirect_uri", redirectUri }, { "state", state }, }; - return Options.AuthorizationEndpoint + queryBuilder.ToString(); + return QueryHelpers.AddQueryString(Options.AuthorizationEndpoint, parameters); } protected virtual string FormatScope()