protected override Task <bool> HandleUnauthorizedAsync(ChallengeContext context) { log.LogDebug("HandleUnauthorizedAsync called"); var properties = new AuthenticationProperties(context.Properties); if (string.IsNullOrEmpty(properties.RedirectUri)) { properties.RedirectUri = CurrentUri; } // OAuth2 10.12 CSRF GenerateCorrelationId(properties); var authorizationEndpoint = BuildChallengeUrl(properties, BuildRedirectUri(Options.CallbackPath)); var redirectContext = new OAuthApplyRedirectContext( Context, Options, properties, authorizationEndpoint); Options.Notifications.ApplyRedirect(redirectContext); return(Task.FromResult(true)); }
/// <summary> /// Called when a Challenge causes a redirect to authorize endpoint in the OAuth middleware. /// </summary> /// <param name="context">Contains redirect URI and <see cref="AuthenticationProperties"/> of the challenge.</param> public virtual void ApplyRedirect(OAuthApplyRedirectContext context) { OnApplyRedirect(context); }
internal static void OnApplyRedirect(OAuthApplyRedirectContext context) { context.Response.Redirect(context.RedirectUri + "&custom_redirect_uri=custom"); }