コード例 #1
0
 public AuthController(
     IUserManager userManager,
     ICaptchaValidationService captchaValidationService,
     IUserToSService userToSService,
     IResetPasswordService resetPasswordService,
     ISignInResponseProvider signInResponseProvider,
     IUserActiveStatusProvider userActiveStatusProvider,
     ISetInvitationAcceptedService setInvitationAcceptedService,
     IOtpSignInValidationService otpSignInValidationService,
     IOtpAuthTokenProvider otpAuthTokenProvider,
     IJwtSecurityTokenValidator jwtSecurityTokenValidator,
     ITokenValidationParametersProvider tokenValidationParametersProvider,
     IUserIdFromOtpTokenProvider userIdFromOtpTokenProvider)
 {
     _userManager                       = userManager;
     _userToSService                    = userToSService;
     _captchaValidationService          = captchaValidationService;
     _resetPasswordService              = resetPasswordService;
     _signInResponseProvider            = signInResponseProvider;
     _userActiveStatusProvider          = userActiveStatusProvider;
     _setInvitationAcceptedService      = setInvitationAcceptedService;
     _otpSignInValidationService        = otpSignInValidationService;
     _otpAuthTokenProvider              = otpAuthTokenProvider;
     _jwtSecurityTokenValidator         = jwtSecurityTokenValidator;
     _tokenValidationParametersProvider = tokenValidationParametersProvider;
     _userIdFromOtpTokenProvider        = userIdFromOtpTokenProvider;
 }
コード例 #2
0
        public AccountController(
            IIdentityServerInteractionService interaction,
            IClientStore clientStore,
            SignInManager <ApplicationUser> signInManager,
            UserManager <ApplicationUser> userManager,
            IAuthenticationSchemeProvider schemeProvider,
            IEventService events,
            IRegistrationService registrationService,
            IForgotPasswordService forgotPasswordService,
            IResetPasswordService resetPasswordService,
            ILoginService loginService,
            IGeoService geoService,
            IOptions <AppSettings> settings)
        {
            // if the TestUserStore is not in DI, then we'll just use the global users collection
            // this is where you would plug in your own custom identity management library (e.g. ASP.NET Identity)

            _interaction           = interaction;
            _clientStore           = clientStore;
            _signInManager         = signInManager;
            _userManager           = userManager;
            _schemeProvider        = schemeProvider;
            _settings              = settings;
            _events                = events;
            _registrationService   = registrationService;
            _forgotPasswordService = forgotPasswordService;
            _resetPasswordService  = resetPasswordService;
            _loginService          = loginService;
            _geoService            = geoService;
        }
 public AccountController(ClaimsPrincipal caller, IAccountService accountService, IBusClient rawRabbitBus, IResetPasswordService resetpasswordService)
 {
     _caller = caller;
     _resetpasswordService = resetpasswordService;
     _rawRabbitBus         = rawRabbitBus;
     _accountService       = accountService;
 }
コード例 #4
0
 public AuthController(IAuthService authService, ITokenClaimsManager tokenClaimsManager,
                       IResetPasswordService resetPasswordService)
 {
     this.authService          = authService;
     this.tokenClaimsManager   = tokenClaimsManager;
     this.resetPasswordService = resetPasswordService;
 }
コード例 #5
0
 public ResetPasswordController(IResetPasswordService resetPasswordService, IHttpContextAccessor httpContextAccessor
                                , IOptions <AppSettings> appSettings)
 {
     _resetPasswordService = resetPasswordService;
     _httpContextAccessor  = httpContextAccessor;
     _appSettings          = appSettings;
 }
コード例 #6
0
 public ResetPasswordApiController(IResetPasswordService service
                                   , ILogger <ResetPasswordApiController> logger
                                   , IAuthenticationService <int> authService) : base(logger)
 {
     _service     = service;
     _authService = authService;
 }
コード例 #7
0
 public ForgotPasswordPageModel(UserManager <User> userManager,
                                IResetPasswordService resetPasswordService,
                                ILogger <ForgotPasswordPageModel> logger)
 {
     _userManager          = userManager;
     _resetPasswordService = resetPasswordService;
     _logger = logger;
 }
コード例 #8
0
 public LoginController(IResetPasswordService resetPasswordService, IUniquePageService uniquePageService,
                        ILoginService loginService, IStringResourceProvider stringResourceProvider, IUserLookup userLookup)
 {
     _resetPasswordService   = resetPasswordService;
     _uniquePageService      = uniquePageService;
     _loginService           = loginService;
     _stringResourceProvider = stringResourceProvider;
     _userLookup             = userLookup;
 }
コード例 #9
0
 public LoginController(IUserService userService, IResetPasswordService resetPasswordService, IAuthorisationService authorisationService, IUniquePageService uniquePageService,
                        ILoginService loginService, IStringResourceProvider stringResourceProvider)
 {
     _userService            = userService;
     _resetPasswordService   = resetPasswordService;
     _authorisationService   = authorisationService;
     _uniquePageService      = uniquePageService;
     _loginService           = loginService;
     _stringResourceProvider = stringResourceProvider;
 }
コード例 #10
0
 public AccountController(
     ApplicationUserManager userManager,
     ApplicationSignInManager signInManager,
     IResetPasswordService resetPasswordService,
     IEmailMessageService emailMessageService
     )
 {
     _resetPasswordService = resetPasswordService;
     _userManager          = userManager;
     _signInManager        = signInManager;
     _emailMessageService  = emailMessageService;
 }
コード例 #11
0
 public AccountController(ILogger <AccountController> logger, ILoginUserService loginUserService, ILogoutUserService logoutUserService, IRegisterUserService registerUserService, IConfirmAccountService confirmAccountService, ISendEmailConfirmationService sendEmailConfirmationService, IListUserService listUserService, IUpdateUserService updateUserService, IResetPasswordService resetPasswordService)
 {
     _logger                       = logger;
     _listUserService              = listUserService;
     _loginUserService             = loginUserService;
     _logoutUserService            = logoutUserService;
     _updateUserService            = updateUserService;
     _registerUserService          = registerUserService;
     _confirmAccountService        = confirmAccountService;
     _sendEmailConfirmationService = sendEmailConfirmationService;
     _resetPasswordService         = resetPasswordService;
 }
コード例 #12
0
        private RegisterForm ResetUserPassword(RegisterForm registerForm, IResetPasswordService passwordService)
        {
            MembershipUser user;

            registerForm.PasswordChanged = false;
            if (passwordService.IsResetUrlValid(registerForm.Token, out user))
            {
                passwordService.ChangePassword(user, registerForm.Password, registerForm.Token);
                registerForm.PasswordChanged = true;
            }
            return(registerForm);
        }
コード例 #13
0
 public LoginController(IResetPasswordService resetPasswordService, IUniquePageService uniquePageService,
                        ILoginService loginService, IStringResourceProvider stringResourceProvider, IUserLookup userLookup,
                        ILogUserIn logUserIn, ISetVerifiedUserData setVerifiedUserData)
 {
     _resetPasswordService   = resetPasswordService;
     _uniquePageService      = uniquePageService;
     _loginService           = loginService;
     _stringResourceProvider = stringResourceProvider;
     _userLookup             = userLookup;
     _logUserIn           = logUserIn;
     _setVerifiedUserData = setVerifiedUserData;
 }
コード例 #14
0
		public void SetUp()
		{
			_resetPasswordService = Substitute.For<IResetPasswordService>();
			_taskManager = Substitute.For<ITaskManager>();
			_authenticationProvider = Substitute.For<IAuthProvider>();

			_target = new ResetPasswordController(_resetPasswordService, _taskManager, _authenticationProvider);
			_viewContext = new ViewContext();
			_viewContext.HttpContext = MockHttpContext.FakeHttpContext();
			_target.SetFakeControllerContext(_viewContext.HttpContext);
			_target.CommitProviderInstance = Substitute.For<ICommitProvider>();

			_sessionId = Guid.NewGuid().ToString().Replace("-", "");
		}
コード例 #15
0
        public LoginControllerTests()
        {
            _userService          = A.Fake <IUserService>();
            _resetPasswordService = A.Fake <IResetPasswordService>();
            _authorisationService = A.Fake <IAuthorisationService>();
            _loginService         = A.Fake <ILoginService>();
            _uniquePageService    = A.Fake <IUniquePageService>();
            _loginController      = new LoginController(_userService, _resetPasswordService, _authorisationService, _uniquePageService, _loginService, A.Fake <IStringResourceProvider>());

            // initial setup as this is reused
            A.CallTo(() => _uniquePageService.RedirectTo <LoginPage>(null)).Returns(new RedirectResult("~/login-page"));
            A.CallTo(() => _uniquePageService.RedirectTo <ForgottenPasswordPage>(null))
            .Returns(new RedirectResult("~/forgotten-password"));
        }
コード例 #16
0
ファイル: LoginControllerTests.cs プロジェクト: neozhu/MrCMS
        public LoginControllerTests()
        {
            _userService = A.Fake<IUserService>();
            _resetPasswordService = A.Fake<IResetPasswordService>();
            _authorisationService = A.Fake<IAuthorisationService>();
            _loginService = A.Fake<ILoginService>();
            _uniquePageService = A.Fake<IUniquePageService>();
            _loginController = new LoginController(_userService, _resetPasswordService, _authorisationService, _uniquePageService, _loginService, A.Fake<IStringResourceProvider>());

            // initial setup as this is reused
            A.CallTo(() => _uniquePageService.RedirectTo<LoginPage>(null)).Returns(new RedirectResult("~/login-page"));
            A.CallTo(() => _uniquePageService.RedirectTo<ForgottenPasswordPage>(null))
             .Returns(new RedirectResult("~/forgotten-password"));
        }
コード例 #17
0
 public SecurityController(ISecurityService securityService,
                           IAuditService loginDeviceAuditService,
                           ITokenStoreService tokenStoreService,
                           IResetPasswordService resetPasswordService,
                           IDeviceProfileConnectionService deviceProfileConnectionService,
                           IDeviceService deviceService,
                           IManufacturerService manufacturerService)
 {
     _securityService                = securityService;
     _loginDeviceAuditService        = loginDeviceAuditService;
     _tokenStoreService              = tokenStoreService;
     _resetPasswordService           = resetPasswordService;
     _deviceProfileConnectionService = deviceProfileConnectionService;
     _deviceService       = deviceService;
     _manufacturerService = manufacturerService;
 }
コード例 #18
0
        public ActionResult ResetPassword(LoginPage currentPage, RegisterForm resetPasswordForm)
        {
            if (!ModelState.IsValid)
            {
                return(ResetPassword(currentPage, resetPasswordForm.Token));
            }

            var model = new ResetPasswordViewModel(currentPage);

            if (ModelState.IsValid)
            {
                // registerForm.SanitizeInput();
                IResetPasswordService passwordService = ServiceLocator.Current.GetInstance <IResetPasswordService>();

                if (!passwordService.IsValidPassword(resetPasswordForm.Password))
                {
                    // Logger.Info("Too weak password");
                    var errorMessage = _localizationService.GetString("/common/account/too_weak_password");
                    ModelState.AddModelError("ResetPasswordForm.ValidationMessage", errorMessage);
                }
                else
                {
                    model.ResetPasswordForm = ResetUserPassword(resetPasswordForm, passwordService);
                }
            }
            if (resetPasswordForm.PasswordConfirm != resetPasswordForm.Password)
            {
                var errorMessage = _localizationService.GetString("/common/validation/compare_passwords");
                ModelState.AddModelError("ResetPasswordForm.ValidationMessage", errorMessage);
                ModelState.Remove("ResetPasswordForm.Password");
                ModelState.Remove("ResetPasswordForm.VerifyPassword");
            }
            if (!ModelState.IsValid)
            {
                _metrics.Count("Users", "Password Reset Failed");

                return(View(model));
            }
            _metrics.Count("Users", "Password Reset");

            return(Index(currentPage));
        }
コード例 #19
0
        public ResetPasswordController(IUserProfileRepository userProfileRepository, IResetPasswordService resetPasswordService, EmailMessengerFactory emailMessengerFactory)
        {
            if (userProfileRepository == null)
            {
                throw new ArgumentNullException("userProfileRepository");
            }

            if (resetPasswordService == null)
            {
                throw new ArgumentNullException("resetPasswordService");
            }

            if (emailMessengerFactory == null)
            {
                throw new ArgumentNullException("emailMessengerFactory");
            }

            this.userProfileRepository = userProfileRepository;
            this.resetPasswordService = resetPasswordService;
            this.emailMessengerFactory = emailMessengerFactory;
        }
コード例 #20
0
        public async Task <IActionResult> ResetPassword([FromBody] ResetPasswordDto resetPasswordDto, [FromServices] IResetPasswordService service)
        {
            var resetPasswordValidator = new ResetPasswordValidator();
            var validatorResult        = await resetPasswordValidator.ValidateAsync(resetPasswordDto);

            if (validatorResult.IsValid)
            {
                await service.ResetPassword(resetPasswordDto);

                if (!service.Status.HasErrors)
                {
                    return(Ok());
                }
                return(BadRequest(service.Status.Errors));
            }

            var validationErrors = validatorResult.Errors.Select(error => new ValidationResult(error.ErrorMessage))
                                   .ToImmutableList();

            return(BadRequest(validationErrors));
        }
コード例 #21
0
ファイル: ResetPasswordController.cs プロジェクト: evkap/DVS
		public ResetPasswordController(IResetPasswordService resetPasswordService, ITaskManager taskManager, IAuthProvider authenticationProvider)
		{
			_resetPasswordService = resetPasswordService;
			_taskManager = taskManager;
			_authenticationProvider = authenticationProvider;
		}
コード例 #22
0
 public AccountController(IAccountService accountService, IBusClient rawRabbitBus, IResetPasswordService resetpasswordService)
 {
     _resetpasswordService = resetpasswordService;
     _rawRabbitBus         = rawRabbitBus;
     _accountService       = accountService;
 }
コード例 #23
0
ファイル: ResetPasswordServiceTest.cs プロジェクト: evkap/DVS
		public void SetUp()
		{
			_usersManagement = Substitute.For<IUsersManagement>();
			_resetPasswordService = new ResetPasswordService(_usersManagement);
			_sessionId = Guid.NewGuid().ToString().Replace("-", "");
		}
コード例 #24
0
 public ResetPasswordCommandHandler(IResetPasswordService service, IUnitOfWork unitOfWork)
 {
     _service    = service;
     _unitOfWork = unitOfWork;
 }
コード例 #25
0
 public AccountController(IUserService userService, IResetPasswordService resetPasswordService, IMapper mapper)
 {
     _userService          = userService;
     _resetPasswordService = resetPasswordService;
     _mapper = mapper;
 }
コード例 #26
0
 public AuthorizeController(IAuthService authorizationService, IResetPasswordService resetPasswordService, ILogger <AuthorizeController> logger)
 {
     _authorizationService = authorizationService ?? throw new ArgumentNullException(nameof(authorizationService));
     _resetPasswordService = resetPasswordService ?? throw new ArgumentNullException(nameof(resetPasswordService));
     _logger = logger ?? throw new ArgumentNullException(nameof(resetPasswordService));
 }