コード例 #1
0
        private static void generatePassword(ICredentialHandler credential)
        {
            Console.Clear();
            Console.Write("User Id: ");
            var user = Console.ReadLine();

            try
            {
                var pass = credential.GetPassword(user);
                Console.WriteLine("Password: {0}", pass);
                Console.WriteLine("--------------------------------------------------");
                Console.WriteLine("Note: Password will expire after {0} seconds",
                                  TimeBasedOTP.TimeBasedPassword.DEFAULT_VALIDITY_PERIODE_SECONDS);
            }
            catch (TimeBasedOTP.TimeBasedOneTimePasswordException ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Error: {0}", ex.Message);
                Console.ForegroundColor = ConsoleColor.White;
            }
            catch
            {
                //TODO
            }
            Console.ReadLine();
        }
コード例 #2
0
 private static void generatePassword(ICredentialHandler credential)
 {
     Console.Clear();
     Console.Write("User Id: ");
     var user = Console.ReadLine();
     try
     {
         var pass = credential.GetPassword(user);
         Console.WriteLine("Password: {0}", pass);
         Console.WriteLine("--------------------------------------------------");
         Console.WriteLine("Note: Password will expire after {0} seconds",
             TimeBasedOTP.TimeBasedPassword.DEFAULT_VALIDITY_PERIODE_SECONDS);
     }
     catch (TimeBasedOTP.TimeBasedOneTimePasswordException ex)
     {
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine("Error: {0}", ex.Message);
         Console.ForegroundColor = ConsoleColor.White;
     }
     catch
     {
         //TODO
     }
     Console.ReadLine();
 }
コード例 #3
0
        private static void validatePassword(ICredentialHandler credential)
        {
            Console.Clear();
            Console.Write("User Id: ");
            var user = Console.ReadLine();
            Console.Write("Password: "******"--------------------------------------------------");
            try
            {
                if (credential.IsValid(user, pass, 30))
                {
                    Console.WriteLine("User Authenticated.");
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.Magenta;
                    Console.WriteLine("Invalid user id or password.");
                }
            }
            catch (TimeBasedOTP.TimeBasedOneTimePasswordException ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(ex.Message);
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Error: {0}", ex.Message);
            }
            Console.ForegroundColor = ConsoleColor.White;
            Console.ReadLine();
            consoleMessage();
        }
コード例 #4
0
 public void EnsureAuthentication(ICredentialHandler credentialHandler, Uri configurationServiceEndpoint = null)
 {
     if (credentialHandler != null)
     {
         this.sourceDataProviderManager.AutoDiscoverSourceServiceEndpoints(this.StatusManager.AllSourceInformation, configurationServiceEndpoint, credentialHandler);
         this.sourceDataProviderManager.CreateSourceServiceClients(this.StatusManager.AllSourceInformation);
     }
 }
コード例 #5
0
 public UserServiceCallingContext(ICredentialHandler credentialHandler, IDictionary <string, ICredentials> cachedCredentials)
 {
     if (credentialHandler == null)
     {
         throw new ArgumentNullException("credentialHandler");
     }
     this.credentialHandler = credentialHandler;
     this.cachedCredentials = (cachedCredentials ?? new Dictionary <string, ICredentials>());
 }
コード例 #6
0
        private static void validatePassword(ICredentialHandler credential)
        {
            Console.Clear();
            Console.Write("User Id: ");
            var user = Console.ReadLine();

            Console.Write("Password: "******"--------------------------------------------------");
            try
            {
                if (credential.IsValid(user, pass, 30))
                {
                    Console.WriteLine("User Authenticated.");
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.Magenta;
                    Console.WriteLine("Invalid user id or password.");
                }
            }
            catch (TimeBasedOTP.TimeBasedOneTimePasswordException ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(ex.Message);
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Error: {0}", ex.Message);
            }
            Console.ForegroundColor = ConsoleColor.White;
            Console.ReadLine();
            consoleMessage();
        }
コード例 #7
0
        public void AutoDiscoverSourceServiceEndpoints(SourceInformationCollection allSourceInformation, Uri configurationServiceEndpoint, ICredentialHandler credentialHandler)
        {
            this.serviceClientFactory.CredentialHandler = credentialHandler;
            if (configurationServiceEndpoint != null && configurationServiceEndpoint.IsAbsoluteUri && configurationServiceEndpoint.Scheme == Uri.UriSchemeHttps)
            {
                if (this.IsStopRequested)
                {
                    Tracer.TraceInformation("SourceDataProviderManager.CreateServiceClients: Stop requested when trying to auto discover with configuration service server", new object[0]);
                    return;
                }
                Uri autoDiscoverUrl = new Uri(configurationServiceEndpoint.GetLeftPart(UriPartial.Authority) + "/autodiscover/autodiscover.svc");
                this.AutoDiscoverServiceEndpoints((from sourceInformation in allSourceInformation.Values
                                                   where this.IsServiceEndpointNeededForSource(sourceInformation)
                                                   select sourceInformation).ToList <SourceInformation>(), autoDiscoverUrl, 0);
                if (this.IsStopRequested)
                {
                    Tracer.TraceInformation("SourceDataProviderManager.CreateServiceClients: Stop requested when trying to auto discover with configuration service endpoint", new object[0]);
                    return;
                }
                using (IServiceClient <ISourceDataProvider> serviceClient = this.serviceClientFactory.CreateSourceDataProvider(configurationServiceEndpoint, this.abortTokenForTasks))
                {
                    if (serviceClient.Connect())
                    {
                        SourceDataProviderManager.VerifyAndSetServiceEndpoint((from sourceInformation in allSourceInformation.Values
                                                                               where this.IsServiceEndpointNeededForSource(sourceInformation)
                                                                               select sourceInformation).ToList <SourceInformation>(), serviceClient);
                    }
                }
            }
            IEnumerable <IGrouping <string, SourceInformation> > enumerable = from sourceInformation in allSourceInformation.Values
                                                                              where this.IsServiceEndpointNeededForSource(sourceInformation)
                                                                              group sourceInformation by SourceDataProviderManager.GetDomainFromSmtpEmailAddress(sourceInformation.Configuration.Id.StartsWith("\\")?sourceInformation.Configuration.Name : sourceInformation.Configuration.Id);

            foreach (IGrouping <string, SourceInformation> grouping in enumerable)
            {
                if (this.IsStopRequested)
                {
                    Tracer.TraceInformation("SourceDataProviderManager.CreateServiceClients: Stop requested when trying to auto discover with email domains of source mailboxes.", new object[0]);
                    return;
                }
                this.AutoDiscoverServiceEndpointsWithEmailDomain(grouping.ToList <SourceInformation>(), grouping.Key.ToLowerInvariant());
            }
            SourceInformation sourceInformation2 = allSourceInformation.Values.FirstOrDefault((SourceInformation sourceInformation) => this.IsServiceEndpointNeededForSource(sourceInformation));

            if (sourceInformation2 != null && !this.IsStopRequested)
            {
                throw new ExportException(ExportErrorType.FailedToAutoDiscoverExchangeWebServiceUrl, sourceInformation2.Configuration.Id);
            }
        }
コード例 #8
0
 public UserServiceCallingContextFactory(ICredentialHandler credentialHandler = null)
 {
     this.CredentialHandler = credentialHandler;
     this.cachedCredentials = new Dictionary <string, ICredentials>();
 }
コード例 #9
0
 public UserAutoDiscoverCallingContext(ICredentialHandler credentialHandler, IDictionary <string, ICredentials> cachedCredentials = null) : base(credentialHandler, cachedCredentials)
 {
 }
コード例 #10
0
 public UserEwsCallingContext(ICredentialHandler credentialHandler, string userRole, IDictionary <string, ICredentials> cachedCredentials = null) : base(credentialHandler, cachedCredentials)
 {
     this.userRole = userRole;
 }
コード例 #11
0
ファイル: TokenHelper.cs プロジェクト: yodeskir/wms-proxy
 public TokenHelper(ICredentialHandler credentialHandler, IJwtTokenHandler jwtTokenHandler)
 {
     _credentialHandler = credentialHandler ?? throw new ArgumentNullException(nameof(credentialHandler));
     _jwtTokenHandler   = jwtTokenHandler ?? throw new ArgumentNullException(nameof(jwtTokenHandler));
 }