Request.Scheme is not reliable and should not be used here for setting the Callback Url #929
Description
I have an application that requires https. When the authorization request goes to Microsoft for authentication, the redirect_url attribute shows up as &redirect_uri=http%3A%2F%2F. Note the http instead of https.
We believe we have tracked this to: https://github.com/aspnet/Security/blob/dev/src/Microsoft.AspNetCore.Authentication/AuthenticationHandler.cs#L118
Request.Scheme will incorrectly report 'http' even if originating URL is 'https'. I have confirmed this by placing @(Context.Request.Scheme)
in the view of a page and loading that page under HTTPS.
Please either fix the Request.Scheme or provide a method of setting the callback path's request scheme.
I found two additional users who are having the same problem: https://social.msdn.microsoft.com/Forums/expression/en-US/833373e1-52ed-4d98-857a-ced4927a2dbb/azure-ad-authentication-for-core-web-app-uses-http-for-reply-url?forum=windowsazurewebsitespreview