private static Uri ExtractValidUri(MonadConnectionInfo connectionInfo) { if (connectionInfo.ServerUri.ToString().StartsWith(PSConnectionInfoSingleton.GetExchangeOnlineUri().ToString())) { return(PSConnectionInfoSingleton.GetExchangeOnlineUri()); } return(new Uri(connectionInfo.ServerUri.GetLeftPart(UriPartial.Path))); }
public MonadConnectionInfo GetMonadConnectionInfo(ExchangeRunspaceConfigurationSettings.SerializationLevel serializationLevel) { MonadConnectionInfo monadConnectionInfo = this.GenerateMonadConnectionInfo(); if (serializationLevel != ExchangeRunspaceConfigurationSettings.SerializationLevel.Full && monadConnectionInfo != null) { monadConnectionInfo = new MonadConnectionInfo(PSConnectionInfoSingleton.ExtractValidUri(monadConnectionInfo), monadConnectionInfo.Credentials, monadConnectionInfo.ShellUri, monadConnectionInfo.FileTypesXml, monadConnectionInfo.AuthenticationMechanism, serializationLevel, monadConnectionInfo.ClientApplication, monadConnectionInfo.ClientVersion, monadConnectionInfo.MaximumConnectionRedirectionCount, monadConnectionInfo.SkipServerCertificateCheck); } return(monadConnectionInfo); }
public MonadConnectionInfo DiscoverConnectionInfo(ref bool rememberCredentialChecked, out SupportedVersionList supportedVersionList, string slotVersion) { this.rememberCredentialChecked = rememberCredentialChecked; this.slotVersion = slotVersion; MonadConnectionInfo result = this.DiscoverConnectionInfoInternal(); rememberCredentialChecked = this.rememberCredentialChecked; supportedVersionList = this.supportedVersionList; return(result); }
private MonadConnectionInfo DiscoverConnectionInfoInternal() { if (!this.logonWithDefaultCredential) { return(this.RetryCredentialsFromLoadOrInput((PSCredential cred) => this.TryConnectWithExplicitCredential(cred))); } MonadConnectionInfo monadConnectionInfo = this.TryConnectWithDefaultCredential(); if (monadConnectionInfo != null) { return(monadConnectionInfo); } throw new OperationCanceledException(this.GetErrorMessage()); }
public MonadConnectionInfo DiscoverConnectionInfo(out SupportedVersionList supportedVersionList, string slotVersion) { if (string.IsNullOrEmpty(this.credentialKey) && !this.logonWithDefaultCredential) { throw new NotSupportedException(); } bool flag = false; MonadConnectionInfo monadConnectionInfo = this.DiscoverConnectionInfo(ref flag, out supportedVersionList, slotVersion); if (flag && monadConnectionInfo.Credentials != null) { CredentialHelper.SaveCredential(this.credentialKey, monadConnectionInfo.Credentials); } return(monadConnectionInfo); }
public MonadConnectionInfo GetMonadConnectionInfo(IUIService uiService, OrganizationSetting forestInfo) { lock (this.forestConnectionInfos) { if (this.forestConnectionInfos.ContainsKey(forestInfo.Key)) { return(this.forestConnectionInfos[forestInfo.Key]); } } MonadConnectionInfo monadConnectionInfo = this.DiscoverForestConnectionInfo(uiService, forestInfo); MonadConnectionInfo result; lock (this.forestConnectionInfos) { this.forestConnectionInfos[forestInfo.Key] = monadConnectionInfo; result = monadConnectionInfo; } return(result); }
private MonadConnectionInfo RetryCredentialsFromLoadOrInput(Func <PSCredential, MonadConnectionInfo> tryConnectWithCredential) { PSCredential cred = this.proposedCredential; if (cred == null && !string.IsNullOrEmpty(this.credentialKey)) { cred = CredentialHelper.ReadCredential(this.credentialKey); } MonadConnectionInfo monadConnectionInfo = null; while (monadConnectionInfo == null) { if (cred == null && this.uiInteractionHandler != null) { if (WinformsHelper.IsWin7OrLater() && this.orgType == OrganizationType.Cloud) { CredentialHelper.ForceConnection(this.uri); } this.uiInteractionHandler.DoActionSynchronizely(delegate(IWin32Window window) { cred = CredentialHelper.PromptForCredentials((window == null) ? IntPtr.Zero : window.Handle, this.displayName, this.uri, this.GetErrorMessage(), ref this.rememberCredentialChecked); }); if (cred != null && !string.IsNullOrEmpty(this.credentialKey)) { CredentialHelper.RemoveCredential(this.credentialKey); } } if (cred == null) { throw new OperationCanceledException(Strings.UnableToConnectExchangeForest(this.displayName)); } monadConnectionInfo = tryConnectWithCredential(cred); cred = null; } return(monadConnectionInfo); }
// Token: 0x0600139A RID: 5018 RVA: 0x0004521C File Offset: 0x0004341C public static CmdletBasedRunspaceConfiguration Create(MonadConnectionInfo connectionInfo, string identityName, IReportProgress reportProgress) { CmdletBasedRunspaceConfiguration.reportProgress = reportProgress; CmdletBasedRunspaceConfiguration.connectionInfo = connectionInfo; return(new CmdletBasedRunspaceConfiguration(identityName)); }
protected override MonadConnection CreateMonadConnection(IUIService uiService, CommandInteractionHandler commandInteractionHandler) { MonadConnectionInfo monadConnectionInfo = PSConnectionInfoSingleton.GetInstance().GetMonadConnectionInfo(); return(new MonadConnection("timeout=30", commandInteractionHandler, null, new MonadConnectionInfo(PSConnectionInfoSingleton.GetRemotePowerShellUri(new Fqdn(this.ServerName)), monadConnectionInfo.Credentials, monadConnectionInfo.ShellUri, monadConnectionInfo.FileTypesXml, monadConnectionInfo.AuthenticationMechanism, monadConnectionInfo.SerializationLevel, monadConnectionInfo.ClientApplication, string.Empty, monadConnectionInfo.MaximumConnectionRedirectionCount, monadConnectionInfo.SkipServerCertificateCheck))); }
private static void LoadBaseUrlViaCmdlet(HelpProvider.HelpAppName appName, RunspaceServerSettingsPresentationObject runspaceServerSettings, MonadConnectionInfo monadConnectionInfo) { if (appName != HelpProvider.HelpAppName.Toolbox) { if (appName != HelpProvider.HelpAppName.Eap) { throw new InvalidOperationException("appName is not a valid HelpAppName enum. Check caller of Initialize how we get this value."); } } try { ExchangeAssistance exchangeAssistance = null; MonadConnection connection = new MonadConnection("timeout=30", new CommandInteractionHandler(), runspaceServerSettings, monadConnectionInfo); using (new OpenConnection(connection)) { using (MonadCommand monadCommand = new MonadCommand("Get-ExchangeAssistanceConfig", connection)) { object[] array = monadCommand.Execute(); if (array != null && array.Length != 0) { exchangeAssistance = (array[0] as ExchangeAssistance); } } } if (exchangeAssistance != null) { if (exchangeAssistance.ManagementConsoleHelpURL != null) { HelpProvider.baseUrl = Utilities.NormalizeUrl(exchangeAssistance.ManagementConsoleHelpURL); } if (exchangeAssistance.ManagementConsoleFeedbackEnabled) { HelpProvider.managementConsoleFeedbackUrl = exchangeAssistance.ManagementConsoleFeedbackURL; } else { HelpProvider.managementConsoleFeedbackUrl = null; } if (exchangeAssistance.PrivacyLinkDisplayEnabled) { HelpProvider.privacyStatementUrl = exchangeAssistance.PrivacyStatementURL; } else { HelpProvider.privacyStatementUrl = null; } if (exchangeAssistance.WindowsLiveAccountURLEnabled) { HelpProvider.windowsLiveAccountUrl = exchangeAssistance.WindowsLiveAccountPageURL; } else { HelpProvider.windowsLiveAccountUrl = null; } if (exchangeAssistance.CommunityLinkDisplayEnabled) { HelpProvider.communityUrl = exchangeAssistance.CommunityURL; } else { HelpProvider.communityUrl = null; } } } catch (CommandExecutionException ex) { ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "CommandExecution Exception in LoadBaseURL: {0}", ex.Message); } catch (CmdletInvocationException ex2) { ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "CmdletInvocationException Exception in LoadBaseURL: {0}", ex2.Message); } catch (PipelineStoppedException ex3) { ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "PipelineStopped Exception in LoadBaseURL: {0}", ex3.Message); } HelpProvider.callingAppName = appName; }
public static void InitializeViaCmdlet(HelpProvider.HelpAppName appName, RunspaceServerSettingsPresentationObject runspaceServerSettings, MonadConnectionInfo monadConnectionInfo) { HelpProvider.LoadBaseUrlViaCmdlet(appName, runspaceServerSettings, monadConnectionInfo); HelpProvider.initializedViaCmdlet = true; }