Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Partly fix google access deny #516

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/Microsoft.AspNet.Authentication.OAuth/OAuthHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ public override async Task<bool> InvokeAsync()
public async Task<bool> InvokeReturnPathAsync()
{
var ticket = await HandleAuthenticateOnceAsync();
if (ticket == null)
if (ticket?.Properties?.RedirectUri == null)
{
Logger.LogWarning("Invalid return state, unable to redirect.");
//Response.Redirect(Options.CallBackErrorPath); + some error
Response.StatusCode = 500;
return true;
}
Expand All @@ -63,7 +64,7 @@ public async Task<bool> InvokeReturnPathAsync()
await Context.Authentication.SignInAsync(context.SignInScheme, context.Principal, context.Properties);
}

if (!context.IsRequestCompleted && context.RedirectUri != null)
if (!context.IsRequestCompleted )
{
if (context.Principal == null)
{
Expand All @@ -74,7 +75,7 @@ public async Task<bool> InvokeReturnPathAsync()
context.RequestCompleted();
}

return context.IsRequestCompleted;
return true;
}

protected override async Task<AuthenticationTicket> HandleAuthenticateAsync()
Expand All @@ -89,8 +90,6 @@ protected override async Task<AuthenticationTicket> HandleAuthenticateAsync()
if (!StringValues.IsNullOrEmpty(value))
{
Logger.LogVerbose("Remote server returned an error: " + Request.QueryString);
// TODO: Fail request rather than passing through?
return null;
}

var code = query["code"];
Expand Down