/// <summary>
        /// Sets authentication response from the webview or broker for token acquisition continuation.
        /// </summary>
        /// <param name="requestCode">Request response code</param>
        /// <param name="resultCode">Result code from authentication</param>
        /// <param name="data">Response data from authentication</param>
        public static void SetAuthenticationAgentContinuationEventArgs(int requestCode, Result resultCode, Intent data)
        {
            AuthorizationResult authorizationResult = null;

            switch ((int)resultCode)
            {
            case (int)Result.Ok:
                authorizationResult = new AuthorizationResult(AuthorizationStatus.Success, data.GetStringExtra("ReturnedUrl"));
                break;

            case (int)Result.Canceled:
                authorizationResult = new AuthorizationResult(AuthorizationStatus.UserCancel, null);
                break;

            case BrokerResponseCode.ResponseReceived:
            case BrokerResponseCode.BrowserCodeError:
            case BrokerResponseCode.UserCancelled:
                BrokerHelper.SetBrokerResult(data, (int)resultCode);
                break;

            default:
                authorizationResult = new AuthorizationResult(AuthorizationStatus.UnknownError, null);
                break;
            }

            if (authorizationResult != null)
            {
                WebUI.SetAuthorizationResult(authorizationResult);
            }
        }
示例#2
0
 /// <summary>
 /// Sets broker response for continuing authentication flow.
 /// </summary>
 /// <param name="url"></param>
 public static void SetBrokerContinuationEventArgs(Uri url)
 {
     BrokerHelper.SetBrokerResponse(url);
 }