Exemplo n.º 1
0
        private void Complete1(AsyncTask task)
        {
            ProxyAuthenticator proxyAuthenticator = ProxyAuthenticator.Create(OAuthCredentialsFactory.Create(base.ClientContext as InternalClientContext, base.RequestLogger), base.ClientContext.MessageId, false);

            this.dispatcher = new DispatcherWithAutoDiscoverResults(base.Application, base.QueryList, this.queryItems, proxyAuthenticator, RequestType.FederatedCrossForest, new DispatcherWithAutoDiscoverResults.CreateRequestWithQueryListDelegate(this.CreateRequest));
            this.dispatcher.BeginInvoke(new TaskCompleteCallback(this.Complete2));
        }
Exemplo n.º 2
0
        public override void BeginInvoke(TaskCompleteCallback callback)
        {
            base.BeginInvoke(callback);
            ProxyAuthenticator proxyAuthenticator = ProxyAuthenticator.Create(OAuthCredentialsFactory.Create(base.ClientContext as InternalClientContext, base.RequestLogger), base.ClientContext.MessageId, false);

            this.proxyWebRequest = new ProxyWebRequest(base.Application, base.ClientContext, RequestType.FederatedCrossForest, base.RequestLogger, base.QueryList, TargetServerVersion.Unknown, proxyAuthenticator, this.webServiceUri, this.webServiceUri.Source);
            this.proxyWebRequest.BeginInvoke(new TaskCompleteCallback(this.CompleteWebRequest));
        }
Exemplo n.º 3
0
        public override void BeginInvoke(TaskCompleteCallback callback)
        {
            base.BeginInvoke(callback);
            ProxyAuthenticator proxyAuthenticator = ProxyAuthenticator.Create(OAuthCredentialsFactory.CreateAsApp(base.ClientContext as InternalClientContext, base.RequestLogger), base.ClientContext.MessageId, true);

            this.queryItems        = AutoDiscoverQueryItem.CreateAutoDiscoverQueryItems(base.Application, base.QueryList, this.autoDiscoverUrl);
            this.autoDiscoverQuery = new AutoDiscoverQueryExternalByOAuth(base.Application, base.ClientContext, base.RequestLogger, this.autoDiscoverUrl, proxyAuthenticator, this.queryItems, this.createAutoDiscoverRequest, base.QueryList);
            this.autoDiscoverQuery.BeginInvoke(new TaskCompleteCallback(this.Complete1));
        }
        public static OAuthCredentials CreateAsApp(InternalClientContext clientContext, RequestLogger requestLogger)
        {
            ArgumentValidator.ThrowIfNull("clientContext", clientContext);
            OrganizationId organizationId = clientContext.OrganizationId;
            string         domain         = clientContext.ADUser.PrimarySmtpAddress.Domain;
            string         text           = FaultInjection.TraceTest <string>((FaultInjection.LIDs) 2743479613U);

            if (!string.IsNullOrEmpty(text))
            {
                domain         = SmtpAddress.Parse(text).Domain;
                organizationId = OrganizationId.FromAcceptedDomain(domain);
            }
            OAuthCredentials oauthCredentialsForAppToken = OAuthCredentials.GetOAuthCredentialsForAppToken(organizationId, domain);

            OAuthCredentialsFactory.SetCredentialsProperties(oauthCredentialsForAppToken, clientContext, requestLogger);
            return(oauthCredentialsForAppToken);
        }
        public static OAuthCredentials Create(InternalClientContext clientContext, RequestLogger requestLogger)
        {
            ArgumentValidator.ThrowIfNull("clientContext", clientContext);
            OrganizationId organizationId = clientContext.OrganizationId;
            ADUser         aduser         = clientContext.ADUser;
            string         text           = FaultInjection.TraceTest <string>((FaultInjection.LIDs) 2743479613U);

            if (!string.IsNullOrEmpty(text))
            {
                SmtpAddress       smtpAddress      = SmtpAddress.Parse(text);
                IRecipientSession recipientSession = DirectorySessionFactory.Default.CreateTenantRecipientSession(true, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromTenantAcceptedDomain(smtpAddress.Domain), 68, "Create", "f:\\15.00.1497\\sources\\dev\\infoworker\\src\\common\\RequestDispatch\\OAuthCredentialsFactory.cs");
                aduser         = (recipientSession.FindByProxyAddress(ProxyAddress.Parse(text)) as ADUser);
                organizationId = aduser.OrganizationId;
            }
            OAuthCredentials oauthCredentialsForAppActAsToken = OAuthCredentials.GetOAuthCredentialsForAppActAsToken(organizationId, aduser, null);

            OAuthCredentialsFactory.SetCredentialsProperties(oauthCredentialsForAppActAsToken, clientContext, requestLogger);
            return(oauthCredentialsForAppActAsToken);
        }