private bool CheckForClosingUrl(Uri url, byte[] postData = null) { bool readyToClose = false; if (url.Authority.Equals(_desiredCallbackUri.Authority, StringComparison.OrdinalIgnoreCase) && url.AbsolutePath.Equals(_desiredCallbackUri.AbsolutePath)) { RequestContext.Logger.Info("[Legacy WebView] Redirect URI was reached. Stopping WebView navigation..."); Result = AuthorizationResult.FromPostData(postData); readyToClose = true; } if (!readyToClose && !url.Scheme.Equals("https", StringComparison.OrdinalIgnoreCase) && !url.AbsoluteUri.Equals("about:blank", StringComparison.OrdinalIgnoreCase) && !url.Scheme.Equals("javascript", StringComparison.OrdinalIgnoreCase)) { RequestContext.Logger.Error(string.Format(CultureInfo.InvariantCulture, "[Legacy WebView] Redirection to non-HTTPS scheme ({0}) found! WebView will fail...", url.Scheme)); Result = AuthorizationResult.FromStatus( AuthorizationStatus.ErrorHttp, MsalError.NonHttpsRedirectNotSupported, MsalErrorMessage.NonHttpsRedirectNotSupported); readyToClose = true; } if (readyToClose) { StopWebBrowser(); // in this handler object could be already disposed, so it should be the last method OnClosingUrl(); } return(readyToClose); }
public void FromPostData() { var authResult = AuthorizationResult.FromPostData(_queryParams.ToQueryParameter().ToByteArray()); AssertAuthorizationResult(authResult); }