/// <summary> /// Sends an HTTP GET request to the given URL. /// </summary> /// <param name="url">The URL.</param> /// <param name="responseCallback">Response callback called in the UI thread when response is available.</param> private void SendRequest(Uri url, WebSsoRequestCallback<WpfLoginFormWebSsoRequest> responseCallback) { var httpWebRequest = (HttpWebRequest)WebRequest.Create(url); httpWebRequest.CookieContainer = _cookieContainer; var interactionRequiredPattern = BuildLoginPromptPattern(); var submitLoginUrl = new Uri(new Uri(textBoxProviderProtocolAndZone.Text), "/login/authenticate.vsl"); var ssoRequest = new WpfLoginFormWebSsoRequest( httpWebRequest, interactionRequiredPattern, this, submitLoginUrl); ssoRequest.BeginGetResponse((request, canceled) => { Dispatcher.Invoke(() => { responseCallback(request, canceled); }); }); }
/// <summary> /// Sends an <c>/authz</c> request for checking test license. /// </summary> /// <param name="responseCallback">Response callback called in the UI thread when response is available.</param> private void SendLicenseQuery(WebSsoRequestCallback<WpfLoginFormWebSsoRequest> responseCallback) { var checkTestLicenseUrl = new Uri(new Uri(textBoxProviderProtocolAndZone.Text), "/authz?__TestLicensedItem__&authenticate=always"); SendRequest(checkTestLicenseUrl, responseCallback); }
/// <summary> /// Sends a request that will trigger identity provider authentication challenge, if not already logged in. /// </summary> /// <param name="responseCallback"> /// Response callback called in the UI thread when response is available. If login is required, login is /// handled during request processing and the response callback is called after login. /// </param> private void Login(WebSsoRequestCallback<WpfLoginFormWebSsoRequest> responseCallback) { var loginUrl = new Uri(new Uri(textBoxProviderProtocolAndZone.Text), "/login"); SendRequest(loginUrl, responseCallback); }
/// <summary> /// Sends a <c>/graph/me</c> request to the provider for querying logged in user basic profile information. /// </summary> /// <param name="responseCallback">Response callback called in the UI thread when response is available.</param> private void SendMyInfoRequest(WebSsoRequestCallback<WpfLoginFormWebSsoRequest> responseCallback) { var myInfoUrl = new Uri(new Uri(textBoxProviderProtocolAndZone.Text), "/graph/me.json?wrap=false&authenticate=always"); SendRequest(myInfoUrl, responseCallback); }