SetAuthorizationResult() public static method

public static SetAuthorizationResult ( AuthorizationResult authorizationResultInput ) : void
authorizationResultInput Microsoft.Identity.Client.Internal.AuthorizationResult
return void
Esempio n. 1
0
        /// <summary>
        /// Sets authentication response from the webview 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 SetAuthenticationContinuationEventArgs(int requestCode, Result resultCode, Intent data)
        {
            RequestContext requestContext = new RequestContext(Guid.Empty, null);

            var msg = string.Format(CultureInfo.InvariantCulture, "Received Activity Result({0})", (int)resultCode);

            requestContext.Logger.Info(msg);
            requestContext.Logger.InfoPii(msg);
            AuthorizationResult authorizationResult = null;

            switch ((int)resultCode)
            {
            case AndroidConstants.AuthCodeReceived:
                authorizationResult = CreateResultForOkResponse(data.GetStringExtra("com.microsoft.identity.client.finalUrl"));
                break;

            case AndroidConstants.Cancel:
                authorizationResult = new AuthorizationResult(AuthorizationStatus.UserCancel, null);
                break;

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

            WebUI.SetAuthorizationResult(authorizationResult, requestContext);
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        public static void SetAuthenticationAgentContinuationEventArgs(int requestCode, Result resultCode, Intent data)
        {
            AuthorizationResult authorizationResult = null;

            switch ((int)resultCode)
            {
            case (int)Result.Ok:
                authorizationResult = CreateResultForOkResponse(data.GetStringExtra("ReturnedUrl"));
                break;

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

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

            WebUI.SetAuthorizationResult(authorizationResult);
        }
Esempio n. 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="url"></param>
 /// <param name="sourceApplication"></param>
 public static void SetAuthenticationContinuationEventArgs(NSUrl url, string sourceApplication)
 {
     WebUI.SetAuthorizationResult(new AuthorizationResult(AuthorizationStatus.Success, url.AbsoluteString));
 }