示例#1
0
        public static CRMProxyAuthenticator Create(IOptions <ProxyConfig> options)
        {
            var credBldr = new CredentialBuilder();

            var config = options.Value;
            var ucred  = new UserCredentails(config);

            for (; ;)
            {
                Log.Info(" ");
                Log.Info(" --- --- --- ");
                var rx = credBldr.GetCredentials();
                try
                {
                    Log.Info("Authenticating ...");
                    ucred.Authenticate(rx.Item1, rx.Item2);
                    return(new CRMProxyAuthenticator(config, ucred));
                }
                catch (Exception ex)
                {
                    Log.Error(ex.ToString());
                    Log.Info("Press any key to continue");
                    Console.ReadKey();
                }
            }
        }
示例#2
0
 private CRMProxyAuthenticator(ProxyConfig config, UserCredentails creds)
 {
     _creds  = creds;
     _config = config;
 }