///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        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);
            }
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
 ///////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////
 internal AgsServer(ServerInfoWrap config,
     NetworkCredential licenseAccount)
     : this(config, licenseAccount, null)
 {
 }
Exemplo n.º 4
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        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;
        }