예제 #1
0
        public ApplicationUserManager(
            IUserStore <TUser> store,
            IOptions <IdentityOptions> optionsAccessor,
            IPasswordHasher <TUser> passwordHasher,
            IEnumerable <IUserValidator <TUser> > userValidators,
            IEnumerable <IPasswordValidator <TUser> > passwordValidators,
            ILookupNormalizer keyNormalizer,
            IdentityErrorDescriber errors,
            IServiceProvider services,
            ILogger <UserManager <TUser> > logger,
            IDataProtectionProvider dataProtectionProvider,
            IAuthenticatorService authenticatorService,
            IPasswordVerifier <TUser> passwordVerifier)

            : base(store, optionsAccessor, passwordHasher, userValidators,
                   passwordValidators, keyNormalizer, errors, services, logger)
        {
            _authenticatorUserManager = new AuthenticatorUserManager <TUser>(
                store, optionsAccessor, passwordHasher, userValidators,
                passwordValidators, keyNormalizer, errors, services,
                logger, dataProtectionProvider, authenticatorService
                );

            _passwordVerifier = passwordVerifier;
        }
예제 #2
0
        public AuthenticatorListAdapter(Context context, IAuthenticatorService authenticatorService,
                                        IAuthenticatorView authenticatorView, ICustomIconRepository customIconRepository, bool isDark)
        {
            _authenticatorService = authenticatorService;
            _authenticatorView    = authenticatorView;
            _customIconRepository = customIconRepository;

            var preferences = new PreferenceWrapper(context);

            _viewMode      = ViewModeSpecification.FromName(preferences.ViewMode);
            _tapToReveal   = preferences.TapToReveal;
            _codeGroupSize = preferences.CodeGroupSize;
            _isDark        = isDark;

            _customIconDecodeLock = new SemaphoreSlim(1, 1);
            _decodedCustomIcons   = new Dictionary <string, Bitmap>();

            _generationOffsets      = new Dictionary <int, long>();
            _counterCooldownOffsets = new Dictionary <int, long>();
            _positionsToUpdate      = new Queue <int>();
            _offsetsToUpdate        = new Queue <int>();

            _animationScale =
                Settings.Global.GetFloat(context.ContentResolver, Settings.Global.AnimatorDurationScale, 1.0f);
        }
예제 #3
0
 public RestoreService(IAuthenticatorService authenticatorService, ICategoryService categoryService,
                       IAuthenticatorCategoryService authenticatorCategoryService,
                       ICustomIconService customIconService)
 {
     _authenticatorService         = authenticatorService;
     _categoryService              = categoryService;
     _authenticatorCategoryService = authenticatorCategoryService;
     _customIconService            = customIconService;
 }
예제 #4
0
        /// <summary>
        /// Create instance of Neosyntez client.
        /// </summary>
        public NeosyntezClient(
            ILogger <NeosyntezClient> logger,
            ITokenStorage tokenStorage,
            Func <HttpClient, IAuthenticatorService> authenticatorFactory)
        {
            this.logger       = logger ?? throw new ArgumentNullException(nameof(logger));
            this.tokenStorage = tokenStorage ?? throw new ArgumentNullException(nameof(tokenStorage));

            httpClient    = new HttpClient();
            authenticator = authenticatorFactory?.Invoke(httpClient) ??
                            throw new ArgumentNullException(nameof(authenticatorFactory));
        }
 public AuthenticatorModel(
     ICurrentUserService currentUserService,
     IAuthenticatorService authenticatorService,
     IIdentityService identityService,
     UrlEncoder urlEncoder,
     ILogger <AuthenticatorModel> logger)
 {
     _identityService      = identityService;
     _urlEncoder           = urlEncoder;
     _logger               = logger;
     _authenticatorService = authenticatorService;
     _currentUserService   = currentUserService;
 }
예제 #6
0
        public AuthenticatorVM(IAuthenticatorService authenticatorService)
        {
            _authenticatorService = authenticatorService;

            _auth = new OAuth2Authenticator(
                clientId: Device.RuntimePlatform == "Android " ? AkHelper.AndroidClientId : AkHelper.iOSClientId,
                clientSecret: string.Empty,
                scope: AkHelper.Scope,
                authorizeUrl: new Uri(AkHelper.AuthorizeUrl),
                redirectUrl: new Uri(AkHelper.RedirectUrl),
                accessTokenUrl: new Uri(AkHelper.AccessTokenUrl),
                getUsernameAsync: null,
                isUsingNativeUI: true
                );
        }
예제 #7
0
        public LoginViewModel(
            IAuthenticatorService firebaseAuthenticator,
            NavigationService navigationService)
        {
            this.firebaseAuthenticator = firebaseAuthenticator;
            this.navigationService     = navigationService;
            UserExists = true;

            LoginCmd = new Command(async() => await Login(), () => Email.IsValid && Password.IsValid && !IsBusy);

            Email = new ValidatableModel <string>(PropChangedCallBack, new EmailValidator())
            {
                Value = "*****@*****.**"
            };
            Password = new ValidatableModel <string>(PropChangedCallBack, new PasswordValidator())
            {
                Value = "Qwerty123"
            };
        }
        public AuthenticatorUserManager(IUserStore <TUser> store,
                                        IOptions <IdentityOptions> optionsAccessor,
                                        IPasswordHasher <TUser> passwordHasher,
                                        IEnumerable <IUserValidator <TUser> > userValidators,
                                        IEnumerable <IPasswordValidator <TUser> > passwordValidators,
                                        ILookupNormalizer keyNormalizer,
                                        IdentityErrorDescriber errors,
                                        IServiceProvider services,
                                        ILogger <UserManager <TUser> > logger,
                                        IDataProtectionProvider dataProtectionProvider,
                                        IAuthenticatorService authenticatorService)
            : base(store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger)
        {
            dataProtectionProvider.CheckArgumentNull(nameof(dataProtectionProvider));
            authenticatorService.CheckArgumentNull(nameof(authenticatorService));

            _authenticatorService = authenticatorService;
            _dataProtector        = dataProtectionProvider.CreateProtector("AuthenticatorUserManager");
        }
 public AuthActionFilter(IAuthenticatorService authService, ServiceAuthOptions options)
 {
     _authService = authService;
     _options     = options;
 }
예제 #10
0
        static void Main(string[] args)
        {
            var newUserFirstName    = "Geordi";
            var newUserLastName     = "LaForge";
            var newUserEmailAddress = "*****@*****.**";
            var newUserPassword1    = "W@rpC0reBr33ch";
            var newUserPassword2    = "Red@1ert!";

            using (ChannelFactory <IAuthenticatorService> channelFactory = new ChannelFactory <IAuthenticatorService>(new WebHttpBinding(), "http://localhost:8080/authenticator"))
            {
                channelFactory.Endpoint.Behaviors.Add(new WebHttpBehavior());
                IAuthenticatorService channel = channelFactory.CreateChannel();

                Console.Write($"Testing {nameof(channel.GetUserAccountInformation)} with unregistered user...");
                var userInfo = channel.GetUserAccountInformation(newUserEmailAddress);
                if (userInfo == null)
                {
                    Console.WriteLine("SUCCESS");
                }
                else
                {
                    FailTest($"The retrieved {nameof(UserAccount)} is not null.");
                    return;
                }

                Console.Write($"Testing {nameof(channel.AuthenticateUser)} with unregistered user...");
                var status = channel.AuthenticateUser(newUserEmailAddress, newUserPassword1);
                if (status == AuthenticationStatus.AuthenticationFailed)
                {
                    Console.WriteLine("SUCCESS");
                }
                else
                {
                    FailTest($"The unregistered user authenticated with return status {status} instead of expected value {AuthenticationStatus.AuthenticationFailed}.");
                    return;
                }

                Console.Write($"Testing {nameof(channel.CreateUser)} with new user...");
                status = channel.CreateUser(newUserEmailAddress, newUserFirstName, newUserLastName, newUserPassword1);
                if (status == AuthenticationStatus.Success)
                {
                    Console.WriteLine("SUCCESS");
                }
                else
                {
                    FailTest($"Failed to register the new user. Return status = {status}");
                    return;
                }

                Console.Write($"Testing {nameof(channel.AuthenticateUser)} with newly registered user...");
                status = channel.AuthenticateUser(newUserEmailAddress, newUserPassword1);
                if (status == AuthenticationStatus.Success)
                {
                    Console.WriteLine("SUCCESS");
                }
                else
                {
                    FailTest($"Authentication failed with expected good password. Return status = {status}.");
                    return;
                }

                Console.Write($"Testing {nameof(channel.AuthenticateUser)} with newly registered user and wrong password...");
                status = channel.AuthenticateUser(newUserEmailAddress, newUserPassword2);
                if (status == AuthenticationStatus.AuthenticationFailed)
                {
                    Console.WriteLine("SUCCESS");
                }
                else
                {
                    FailTest($"Authentication did not return expected status {AuthenticationStatus.AuthenticationFailed} with bad password. Return status = {status}.");
                    return;
                }

                Console.Write($"Testing {nameof(channel.GetUserAccountInformation)} with newly registered user...");
                userInfo = channel.GetUserAccountInformation(newUserEmailAddress);
                if (userInfo != null)
                {
                    Console.WriteLine("SUCCESS");
                    Console.WriteLine(userInfo.ToString());
                }
                else
                {
                    FailTest($"Failed to retrieve user account information.");
                    return;
                }

                Console.Write($"Testing {nameof(channel.RequestPasswordReset)} with newly registered user...");
                status = channel.RequestPasswordReset(newUserEmailAddress);
                if (status == AuthenticationStatus.Success)
                {
                    Console.WriteLine("SUCCESS");
                }
                else
                {
                    FailTest($"Failed to request password reset. Return status = {status}.");
                    return;
                }

                Console.Write($"Testing {nameof(channel.ResetPassword)} with newly registered user...");

                if (!File.Exists(IntuitAuthenticatorServiceInterface.SharedConstants.PasswordResetFilePath))
                {
                    Console.Write("Reset file path check...");
                    FailTest("File does not exist.");
                    return;
                }

                var passwordResetText = File.ReadAllText(IntuitAuthenticatorServiceInterface.SharedConstants.PasswordResetFilePath);
                if (!int.TryParse(passwordResetText, out int resetId))
                {
                    Console.Write("Retrieving reset ID...");
                    FailTest("Contents of reset file are not the expected integer format.");
                    return;
                }

                status = channel.ResetPassword(newUserEmailAddress, resetId, newUserPassword2);
                if (status == AuthenticationStatus.Success)
                {
                    Console.WriteLine("SUCCESS");
                }
                else
                {
                    FailTest($"Failed to reset password. Return status = {status}.");
                    return;
                }

                Console.Write($"Testing {nameof(channel.AuthenticateUser)} with new password...");
                status = channel.AuthenticateUser(newUserEmailAddress, newUserPassword2);
                if (status == AuthenticationStatus.Success)
                {
                    Console.WriteLine("SUCCESS");
                }
                else
                {
                    FailTest($"Authentication failed with expected good password. Return status = {status}.");
                    return;
                }

                Console.WriteLine("\n*** ALL TESTS COMPLETED SUCCESSFULLY! ***");
            }
        }
예제 #11
0
 public IdentityController(IAuthenticatorService authenticatorService)
 {
     _authenticatorService = authenticatorService;
 }
예제 #12
0
 public CreateAuthenticatorHandler(IAuthenticatorService authenService)
 {
     _authenService = authenService;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="LoginViewModel"/> class.
 /// </summary>
 /// <param name="authService">The authentication service.</param>
 public LoginViewModel(IAuthenticatorService authService)
 {
     _authSvc = authService;
 }
예제 #14
0
 public QrCodeService(IAuthenticatorService authenticatorService, IIconResolver iconResolver)
 {
     _authenticatorService = authenticatorService;
     _iconResolver         = iconResolver;
 }
 public AuthenticatorsController(IAuthenticatorService authenService, ICommandDispatcher commandDispatcher) : base(commandDispatcher)
 {
     _authenService = authenService;
 }
 public LoginWith2faModel(IAuthenticatorService authenticatorService, ILogger <LoginWith2faModel> logger)
 {
     _authenticatorService = authenticatorService;
     _logger = logger;
 }
예제 #17
0
 public HomeController(IAuthenticatorService service)
 {
     _service = service;
 }
예제 #18
0
        public AuthenticatorTokenProvider(IAuthenticatorService authenticationService)
        {
            authenticationService.CheckArgumentNull(nameof(authenticationService));

            _authenticationService = authenticationService;
        }
 public CoreController(IAuthenticatorService authenticatorService)
 {
     _authenticatorService = authenticatorService;
 }