/////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// private void _InitParameters( ServerInfoWrap config, NetworkCredential licAccount) { var parameters = new AgsServerConnectionParameters(config); var useLicenseCredentials = parameters.AuthenticationType == AgsServerAuthenticationType.UseApplicationLicenseCredentials && licAccount != null; if (useLicenseCredentials) { parameters.Credentials = new NetworkCredential( licAccount.UserName, licAccount.Password); } _parameters = parameters; }
/////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// internal AgsServerConnectionParameters(ServerInfoWrap serverInfo) { this.SoapUrl = serverInfo.Url; if (serverInfo.Authentication != null) { this.AuthenticationType = _StrToAuthType(serverInfo.Authentication); } else { this.AuthenticationType = AgsServerAuthenticationType.No; } if (serverInfo.Credentials != null) { this.Credentials = new NetworkCredential( serverInfo.Credentials.UserName, serverInfo.Credentials.Password); } }
internal AgsServer(ServerInfoWrap config, NetworkCredential licenseAccount, IRoutingServiceUrlProvider serviceUrlProvider) { Debug.Assert(config != null); // set server parameters _name = config.Name; _title = config.Title; _description = config.Description; _helpPrompt = config.HelpPrompt; _config = config; // init connection _InitParameters(config, licenseAccount); _serviceUrlProvider = serviceUrlProvider; // create authenticator _authenticator = _CreateAuthenticator(_parameters, _serviceUrlProvider); try { // connect/authenticate _Connect(); _state = AgsServerState.Authorized; } catch (AuthenticationException) { _state = AgsServerState.Unauthorized; _initError = _CreateAuthException(); } catch (Exception e) { _state = AgsServerState.Unavailable; _initError = _ConvertException(e); Logger.Error(e); } }
/////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// public ServersInfoWrap(ServersInfo settings, UserServersInfo userSettings) { Debug.Assert(settings != null); Debug.Assert(userSettings != null); if (userSettings.Servers == null) { userSettings.Servers = new List <UserServerInfo>(); } List <UserServerInfo> userServers = userSettings.Servers; foreach (ServerInfo info in settings.Servers) { if (!String.IsNullOrEmpty(info.Name)) { UserServerInfo userInfo = _FindServerInfo(info.Name, userServers); if (userInfo == null) { userInfo = new UserServerInfo(); userInfo.Name = info.Name; userServers.Add(userInfo); } ServerInfoWrap wrap = new ServerInfoWrap(info, userInfo); _servers.Add(wrap); } else { Logger.Warning("Server configuration error: invalid name."); } } }
/////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// internal AgsServer(ServerInfoWrap config, NetworkCredential licenseAccount) : this(config, licenseAccount, null) { }