public static void SetAuthenticationContinuationEventArgs(int requestCode, Result resultCode, Intent data)
        {
            // TODO(migration): how can a public static method get access to the proper ClientRequestBase to wire into the logger and appropriate requestcontext?
            // Can we move this call to be somewhere on the ClientApplicationBase or something else that's wired into that?
            var logger = MsalLogger.Create(Guid.Empty, null);

            logger.Info(string.Format(CultureInfo.InvariantCulture, "Received Activity Result({0})", (int)resultCode));

            AuthorizationResult authorizationResult;

            if (data.Action != null && data.Action.Equals("ReturnFromEmbeddedWebview", StringComparison.OrdinalIgnoreCase))
            {
                authorizationResult = ProcessFromEmbeddedWebview(requestCode, resultCode, data);
            }
            else if (!String.IsNullOrEmpty(data.GetStringExtra(BrokerConstants.BrokerResultV2)))
            {
                AndroidBroker.SetBrokerResult(data, (int)resultCode);
                return;
            }
            else
            {
                authorizationResult = ProcessFromSystemWebview(requestCode, resultCode, data);
            }

            WebviewBase.SetAuthorizationResult(authorizationResult, logger);
        }
        public static RequestContext CreateForTest(IServiceBundle serviceBundle = null)
        {
            var telemetryCorrelationId = Guid.NewGuid();

            var logger = serviceBundle?.DefaultLogger ?? MsalLogger.Create(
                telemetryCorrelationId,
                null,
                isDefaultPlatformLoggingEnabled: true);

            return(new RequestContext(null, logger, telemetryCorrelationId));
        }
        protected RequestContext CreateRequestContextAndLogVersionInfo(Guid telemetryCorrelationId)
        {
            var requestContext = new RequestContext(
                _clientApplicationBase.AppConfig.ClientId,
                MsalLogger.Create(telemetryCorrelationId, ServiceBundle.Config),
                telemetryCorrelationId);

            requestContext.Logger.Info(
                string.Format(
                    CultureInfo.InvariantCulture,
                    "MSAL {0} with assembly version '{1}', file version '{2}' and informational version '{3}'. TelemetryCorrelationId({4})",
                    ServiceBundle.PlatformProxy.GetProductName(),
                    MsalIdHelper.GetMsalVersion(),
                    AssemblyUtils.GetAssemblyFileVersionAttribute(),
                    AssemblyUtils.GetAssemblyInformationalVersion(),
                    requestContext.TelemetryCorrelationId));

            return(requestContext);
        }
 public RequestContext(IServiceBundle serviceBundle, Guid correlationId)
 {
     ServiceBundle = serviceBundle ?? throw new ArgumentNullException(nameof(serviceBundle));
     Logger        = MsalLogger.Create(correlationId, ServiceBundle.Config);
     CorrelationId = correlationId;
 }
 // This implementation should ONLY be called for cases where we aren't participating in
 // MATS telemetry but still need a requestcontext/logger, such as "GetAccounts()".
 // For service calls, the request context should be created in the **Executor classes as part of request execution.
 private RequestContext CreateRequestContext(Guid telemetryCorrelationId)
 {
     return(new RequestContext(AppConfig.ClientId, MsalLogger.Create(telemetryCorrelationId, ServiceBundle.Config), telemetryCorrelationId));
 }
예제 #6
0
 public RequestContext(IServiceBundle serviceBundle, Guid telemetryCorrelationId)
 {
     ServiceBundle          = serviceBundle ?? throw new ArgumentNullException(nameof(serviceBundle));
     Logger                 = MsalLogger.Create(telemetryCorrelationId, ServiceBundle.Config);
     TelemetryCorrelationId = telemetryCorrelationId.AsMatsCorrelationId();
 }