private async void AutenticatUserButton_Click(object sender, RoutedEventArgs e)
        {
            using (Logger.TraceMehtod())
            {
                try
                {
                    var user = UserName.Parse(AutenticateUserName.Text);
                    IEnumerable <LiveQuestion> liveQuestions = null;
                    try
                    {
                        liveQuestions = await authenticationService.GetEnrollmentDataLiveQuestion(user);
                    }
                    catch (Exception ex)
                    {
                    }

                    var cred = AuthenticateCredentialsWindow.ShowDialog(Application.Current.MainWindow, liveQuestions);

                    if (cred == null)
                    {
                        return;
                    }

                    userTicket = await authenticationService.Authenticate(user, cred);

                    AuthenticateUserResult.Text = "User token accepted.";
                }
                catch (Exception ex)
                {
                    AuthenticateUserResult.Text = ex.Message;
                }
            }
        }
Beispiel #2
0
        private static IAuthenticationCredential ShowDialog(Window owner, IEnumerable <LiveQuestion> liveQuestions, bool isAuthenticationMode)
        {
            ICredential credential = null;
            var         win        = new AuthenticateCredentialsWindow();

            if (liveQuestions != null)
            {
                win.LiveQuestion = liveQuestions.Select(p => new Tuple <LiveQuestion, LiveAnswer>(p, new LiveAnswer(p.Number))).ToArray();
            }
            else
            {
                win.LiveQuestionsTabItem.Visibility = Visibility.Collapsed;
            }

            if (isAuthenticationMode)
            {
                win.PassworTabItem.Visibility = Visibility.Collapsed;
                win.PinTabItem.Visibility     = Visibility.Collapsed;
                win.OtpTabItem.Visibility     = Visibility.Collapsed;
            }

            win.Owner = owner;

            using (win.fingerprintEngine = new FingerprintEngine())
                using (win.fingerprintImage)
                    using (win.cardEngine = new CardEngine())
                    {
                        if (win.ShowDialog() == true)
                        {
                            return(win.credential);
                        }
                        return(null);
                    }
        }
Beispiel #3
0
        private async void IdentifyUserButton_Click(object sender, RoutedEventArgs e)
        {
            using (Logger.TraceMehtod())
            {
                try
                {
                    var cred = AuthenticateCredentialsWindow.ShowDialog(App.Current.MainWindow, true);
                    if (cred == null)
                    {
                        return;
                    }

                    userTicket = await authenticationService.Identify(cred);

                    var token = new JwtSecurityToken(userTicket.Data);
                    IdentifyUserResult.Text = token.Subject;
                }
                catch (Exception ex)
                {
                    IdentifyUserResult.Text = ex.Message;
                }
            }
        }
        private async void AutenticatOfficerButton_Click(object sender, RoutedEventArgs e)
        {
            using (Logger.TraceMehtod())
            {
                try
                {
                    var cred = AuthenticateCredentialsWindow.ShowDialog(Application.Current.MainWindow);
                    var user = UserName.Parse(AutenticateOfficerUserName.Text);

                    if (cred == null)
                    {
                        return;
                    }

                    officerTicket = await authenticationService.Authenticate(user, cred);

                    AuthenticateOfficerUserResult.Text = "Token accepted.";
                }
                catch (Exception ex)
                {
                    AuthenticateOfficerUserResult.Text = ex.Message;
                }
            }
        }