public static UserManager<ApplicationUser> Create( IUserStore<ApplicationUser> store_iUserStore, IIdentityMessageService value_iIdentityMessageService, IIdentityMessageService value_iIdentityMessageService1, IUserTokenProvider<ApplicationUser, string> value_iUserTokenProvider, bool value_b, int value_i ) { UserManager<ApplicationUser> userManager = new UserManager<ApplicationUser>(store_iUserStore); ((UserManager<ApplicationUser, string>)userManager).EmailService = value_iIdentityMessageService; ((UserManager<ApplicationUser, string>)userManager).SmsService = value_iIdentityMessageService1; ((UserManager<ApplicationUser, string>)userManager).UserTokenProvider = value_iUserTokenProvider; ((UserManager<ApplicationUser, string>)userManager).UserLockoutEnabledByDefault = value_b; ((UserManager<ApplicationUser, string>)userManager) .MaxFailedAccessAttemptsBeforeLockout = value_i; return userManager; // TODO: Edit factory method of UserManager`1<ApplicationUser> // This method should be able to configure the object in all possible ways. // Add as many parameters as needed, // and assign their values to each field by using the API. }
// // GET: /Account/Login public AccountController(IServices services, ISettings settings, IComponents components, IUserStore<ApplicationUser, Guid> userStore) : base(services, settings) { _userManager = new ApplicationUserManager(userStore, services, components); Mapper.CreateMap<ApplicationUser, UserDto>(); }
public ChatHub(string botName, IMessageStore messageStore, IUserStore userStore, IEnumerable<ICommandProcessor> commandProcessors, IEnumerable<IContentProvider> contentProviders) { if (string.IsNullOrWhiteSpace(botName)) { throw new ArgumentNullException("botName"); } if (messageStore == null) { throw new ArgumentNullException("messageStore"); } if (userStore == null) { throw new ArgumentNullException("userStore"); } if (commandProcessors == null) { throw new ArgumentNullException("commandProcessors"); } if (contentProviders == null) { throw new ArgumentNullException("contentProviders"); } ChatHubConfiguration.BotName = botName; MessageStore = messageStore; UserStore = userStore; CommandProcessors = commandProcessors; CommandProcessorDescriptions = CommandProcessors.Select(p => new CommandDescription() { Description = p.Description, Name = p.Name, Usage = p.Usage }).OrderBy(d => d.Name) as IEnumerable<CommandDescription>; ContentProviders = contentProviders; ContentProviderDescriptions = ContentProviders.Select(p => new ContentProviderDescription() { Description = p.Description, Name = p.Name, }).OrderBy(d => d.Name) as IEnumerable<ContentProviderDescription>; }
public AccountController(IUserStore<IdentityUser, Guid> userStore, IUnitOfWork unitOfWork) { _userManager = new UserManager<IdentityUser, Guid>(userStore); _pictureService = new PictureService(unitOfWork); _userService = new UserService(unitOfWork, _pictureService); }
public void SetUp() { store = new UserStore(new LuceneDataProvider(new RAMDirectory(), Version.LUCENE_30)); mappings = new NameValueCollection(); middleware = new RoleMappingAuthenticationMiddleware(next) {Store = store, Settings = new NuGetWebApiSettings(NuGetWebApiSettings.DefaultAppSettingPrefix, new NameValueCollection(), mappings)}; domainAdminUser = new ApiUserPrincipal(new GenericIdentity("T-Rex"), new [] {"Domain Administrators"}); }
public UserRepository(IDataProtectionProvider dataProtectionProvider, IUnitOfWork unitOfWork) { _userStore = new UserStore<ApplicationUser>(unitOfWork._dbContext); _unitOfWork = unitOfWork; _securityQuestionRepository = new RepositoryBase<SecurityQuestion>(unitOfWork); _userStore.UserManager.UserTokenProvider = new DataProtectorTokenProvider<ApplicationUser>(dataProtectionProvider.Create("ASP.NET Identity")); }
public DragonContext( ISessionStore sessionStore, IUserStore userStore) { m_sessionStore = sessionStore; m_userStore = userStore; }
public AccountController(IUserSecretStore secrets, IUserLoginStore logins, IUserStore users, IRoleStore roles) { Secrets = secrets; Logins = logins; Users = users; Roles = roles; }
public ExampleAuthorizationServer(ICryptoKeyStore cryptoKeyStore, ICryptoKeyPair authServerKeys, ICryptoKeyPair dataServerKeys, IOAuth2ClientStore clientStore, IUserStore userStore) { this.cryptoKeyStore = cryptoKeyStore; this.authServerKeys = authServerKeys; this.dataServerKeys = dataServerKeys; this.clientStore = clientStore; this.userStore = userStore; }
void Initialize() { if (azure == null || azure == null || userStore == null) { azure = ServiceLocator.Instance.Resolve<IAzureClient>(); userStore = ServiceLocator.Instance.Resolve<IUserStore>(); } }
public UserController() { dbContext = new DB(); dbContext.Configuration.ProxyCreationEnabled = false; UserStore = new CUserStore<User>(dbContext); UserManager = new UserManager<User>(UserStore); RoleManager = new RoleManager<Role>(new CRoleStore<Role>(dbContext)); }
public CheckInViewModel() { checkInStore = ServiceLocator.Instance.Resolve<ICheckInStore>(); userStore = ServiceLocator.Instance.Resolve<IUserStore>(); azure = ServiceLocator.Instance.Resolve<IAzureClient>(); log = ServiceLocator.Instance.Resolve<IAppInsights>(); }
public void SetUp() { this._authenticationService = Substitute.For<IAuthenticationService>(); this._userProfileRepository = Substitute.For<IUserProfileRepository>(); this._userStore = Substitute.For<IUserStore<IdentityUser>>(); this._userManager = Substitute.For<UserManager<IdentityUser>>(_userStore); _sut = new AccountController(_authenticationService, _userProfileRepository, _userManager); _sut.ControllerContext = GenerateControllerContext(_sut); }
public IntegrationController(IUserStore<ApplicationUser,Guid> userStore, IAdminServices adminServices, IServices services, ISettings settings, IComponents components) : base(services, settings) { //if(!(settings.Environment == Environment.Integration || settings.Environment == Environment.Debug)) // throw new SecurityException(); _adminServices = adminServices; _userManager = new ApplicationUserManager(userStore, services, components); }
public void createNotificationForTask(int TaskId, string cfgSQLConnectionString) { this.cfgSQLConnectionString = cfgSQLConnectionString; configStore = StoreHandler.getConfigStore(cfgSQLConnectionString); baseURL = configStore.getString(BaseURL); templatepath = configStore.getString(Email_NotificationTemplate); taskStore = StoreHandler.getTaskStore(cfgSQLConnectionString); T_Task task = taskStore.getTaskById(TaskId); helper = new MailBodyHelper(); processStore = StoreHandler.getProcessStore(cfgSQLConnectionString); instance = processStore.getWorkflowInstance(task.WFId); mail = new SmtpUtils(configStore); if (task.Type.Equals("F") || task.Type.Equals("S")) { if (configStore.getBool(Email_Notifications_Tasks)) { string content = helper.getStateBody(task, baseURL, templatepath); List<string> recipients = new List<string>(); if (String.IsNullOrEmpty(instance.Owner)) { var subject = processStore.getProcessSubjectForWFId(task.WFId); userStore = StoreHandler.getUserStore(cfgSQLConnectionString); recipients.AddRange(userStore.getUsernamesForRole(subject.U_Role_Id)); } else { recipients.Add(instance.Owner); } foreach (string user in recipients) { mail.sendMail(user, "InFlow: " + task.Name + " #" + task.Id, content); } } } if (task.Type.Equals("R")) { if (configStore.getBool(Email_Notifications_Messages)) { messageStore = StoreHandler.getMessageStore(cfgSQLConnectionString); var messages = messageStore.getMessagesForReceiveStateTask(task.WFId, task.getTaskPropertiesAsListOfString()); foreach (var i in messages) { createReceiveNotification(i, task); } } } }
public FSCAuth(IServerContext server, FSCAuthConfig config, IUserStore store, bool defaultbasic=false) { Server=server; Config=config; if(Config.HasherInvoker==null) { Config.HasherInvoker=DefaultHasher; } BasicByDefault=defaultbasic; UserStore=store; }
public void SetUp() { this.actionExecutingContext = new ActionExecutingContext { ActionParameters = new Dictionary<string, object>() }; this.userStoreMock = MockRepository.GenerateMock<IUserStore<ApplicationUser>>(); this.dataProtectionProviderMock = MockRepository.GenerateMock<IDataProtectionProvider>(); var dataProtector = MockRepository.GenerateMock<IDataProtector>(); this.dataProtectionProviderMock.Expect(mock => mock.Create(Arg<string>.Is.Anything)).Return(dataProtector); this.userManager = new ApplicationUserManager(this.userStoreMock, this.dataProtectionProviderMock); clientIdCalculatorMock = MockRepository.GenerateMock<ClientIdCalculator>(); //need to simulate like the parameter exists on the method this.actionExecutingContext.ActionParameters[UserContextAttribute.USER_CONTEXT_KEY] = null; HttpContextBase httpContextBase = MockRepository.GenerateMock<HttpContextBase>(); this.actionExecutingContext.HttpContext = httpContextBase; IPrincipal principal = MockRepository.GenerateMock<IPrincipal>(); httpContextBase.Expect(contextBase => contextBase.User) .Repeat.Any() .Return(principal); this.identity = MockRepository.GenerateMock<IIdentity>(); principal.Expect(mock => mock.Identity) .Repeat.Any() .Return(this.identity); this.identity.Expect(mock => mock.IsAuthenticated) .Repeat.Once() .Return(true); HttpRequestBase requestBaseMock = MockRepository.GenerateMock<HttpRequestBase>(); httpContextBase.Expect(mock => mock.Request) .Return(requestBaseMock); this.requestParameters = new NameValueCollection(); requestBaseMock.Expect(mock => mock.Params) .Return(this.requestParameters); this.userContextActionFilter = new UserContextAttribute(); this.applicationUser = new ApplicationUser() { Id = "user id", CurrentGamingGroupId = 315 }; Task<ApplicationUser> task = Task.FromResult(this.applicationUser); //TODO can't figure out how to mock the GetUserId() extension method, so have to be less strict here this.userStoreMock.Expect(mock => mock.FindByIdAsync(Arg<string>.Is.Anything)) .Repeat.Once() .Return(task); }
public ClaimService(IUserStore<IUserDto, int> userStore, IUserClaimStore<IUserDto, int> userClaimStore) { if (userStore == null) { throw new ArgumentNullException("userStore"); } if (userClaimStore == null) { throw new ArgumentNullException("userClaimStore"); } _userClaimStore = userClaimStore; _userStore = userStore; }
public AuthLessonServiceWrapper( ILessonService lessonService, ClaimsPrincipal principal, EntityValidator entityValidator, IUserStore<IUserDto, int> userStore, ClaimsAuthorizationManager authorizationManager) { if (lessonService == null) { throw new ArgumentNullException("lessonService"); } if (principal == null) { throw new ArgumentNullException("principal"); } if (principal.Identity == null) { throw new ArgumentException("Principal doesn't contian identity"); } if (!principal.Identity.IsAuthenticated) { throw new ArgumentException("Identity is not authenticated"); } if (entityValidator == null) { throw new ArgumentNullException("entityValidator"); } if (userStore == null) { throw new ArgumentNullException("userStore"); } if (authorizationManager == null) { throw new ArgumentNullException("authorizationManager"); } _lessonService = lessonService; _principal = principal; _entityValidator = entityValidator; _userStore = userStore; _authorizationManager = authorizationManager; }
public UserController( IRepository<User, int> userRepository, IRepository<Role, int> roleRepository, IRepository<UserRoleMap, int> userRoleRepository, IRepository<UserModuleMap, int> userModuleRepository, IUserStore<User, int> userStore, IUnitOfWork unitOfWork) { this._userRepository = userRepository; this._roleRepository = roleRepository; this._userRoleRepository = userRoleRepository; this._userModuleRepository = userModuleRepository; this._unitOfWork = unitOfWork; this._userStore = userStore; this._userManager = new UserManager(_userStore); this._log = new Log(); }
public AuthLessonServiceWrapperTest() { _lessonService = A.Fake<ILessonService>(); _principal = A.Fake<ClaimsPrincipal>(); _identity = A.Fake<IIdentity>(); A.CallTo(() => _principal.Identity).Returns(_identity); A.CallTo(() => _identity.IsAuthenticated).Returns(true); _entityValidator = A.Fake<EntityValidator>(); _userStore = A.Fake<IUserStore<IUserDto, int>>(); _authorizationManager = new ClaimsAuthorizationManager(); _authLessonServiceWrapper = new AuthLessonServiceWrapper( _lessonService, _principal, _entityValidator, _userStore, _authorizationManager); }
private void initService() { if (connectionString == null) { connectionString = ConfigurationSettings.AppSettings["repositoryConnectionString"].ToString(); wfmBaseAddress = ConfigurationSettings.AppSettings["wfmBaseAddress"].ToString(); wfmUsername = ConfigurationSettings.AppSettings["wfmUsername"].ToString(); wfmPassword = ConfigurationSettings.AppSettings["wfmPassword"].ToString(); taskStore = StoreHandler.getTaskStore(connectionString); processStore = StoreHandler.getProcessStore(connectionString); userStore = StoreHandler.getUserStore(connectionString); messageStore = StoreHandler.getMessageStore(connectionString); _db = new InFlowDb(); } }
public void SetUp() { autoMocker = new RhinoAutoMocker<UserSessionsController>(); var dataProtector = MockRepository.GenerateMock<IDataProtector>(); userStoreMock = MockRepository.GenerateMock<IUserStore<ApplicationUser>>(); var dataProtectionProvider = MockRepository.GenerateMock<IDataProtectionProvider>(); dataProtectionProvider.Expect(mock => mock.Create("ASP.NET Identity")).Return(dataProtector); var applicationUserManager = MockRepository.GeneratePartialMock<ApplicationUserManager>(userStoreMock, dataProtectionProvider); autoMocker.Inject(applicationUserManager); var controllerContextMock = MockRepository.GeneratePartialMock<HttpControllerContext>(); var actionDescriptorMock = MockRepository.GenerateMock<HttpActionDescriptor>(); autoMocker.ClassUnderTest.ActionContext = new HttpActionContext(controllerContextMock, actionDescriptorMock); autoMocker.ClassUnderTest.Request = new HttpRequestMessage(); autoMocker.ClassUnderTest.Request.SetConfiguration(new HttpConfiguration()); AutomapperConfiguration.Configure(); }
public OperatorService(DataContext db, IUserStore<User> userStore, IRoleStore<IdentityRole, string> roleStore) { this.db = db; userManager = new UserManager<User>(userStore); roleManager = new RoleManager<IdentityRole>(roleStore); if (_operatorRoleId == null) { lock (padlock) { if (_operatorRoleId == null) { // ReSharper disable PossibleMultipleWriteAccessInDoubleCheckLocking _operatorRoleId = roleManager.FindByName(User.OPERATOR_ROLE).Id; // ReSharper restore PossibleMultipleWriteAccessInDoubleCheckLocking } } } }
public virtual void SetUp() { pendingGamingGroupInvitationRetriever = MockRepository.GenerateMock<IPendingGamingGroupInvitationRetriever>(); var dataProtector = MockRepository.GenerateMock<IDataProtector>(); dataProtectionProviderMock = MockRepository.GenerateMock<IDataProtectionProvider>(); dataProtectionProviderMock.Expect(mock => mock.Create(Arg<string>.Is.Anything)).Return(dataProtector); userStoreMock = MockRepository.GenerateMock<IUserStore<ApplicationUser>>(); applicationUserManagerMock = MockRepository.GenerateMock<ApplicationUserManager>(userStoreMock, dataProtectionProviderMock); dataContextMock = MockRepository.GenerateMock<IDataContext>(); gamingGroupInviteConsumer = new GamingGroupInviteConsumer( pendingGamingGroupInvitationRetriever, applicationUserManagerMock, dataContextMock); currentUser = new ApplicationUser() { Id = "user id" }; gamingGroupInvitations = new List<GamingGroupInvitation>(); }
internal UserIdentityService(IUserStore<ApplicationUser> userStore, IAuthenticationManager authenticationManager) { if (userStore == null) { throw new ArgumentNullException("userStore"); } if (authenticationManager == null) { throw new ArgumentNullException("authenticationManager"); } //this.UserDatabase = documentStore; var options = new IdentityFactoryOptions<ApplicationUserManager>(); this.UserManager = ApplicationUserManager.Create(options, userStore); this.SignInManager = new ApplicationSignInManager(this.UserManager, authenticationManager); }
public CustomerService(DataContext db, IUserStore<User> userStore, IRoleStore<IdentityRole, string> roleStore,IDeleterService deleteService) { this.db = db; this.deleteService = deleteService; userManager = new UserManager<User>(userStore); if (_customerRoleID == null) { lock (padlock) { if (_customerRoleID == null) { var roleManager = new RoleManager<IdentityRole>(roleStore); // ReSharper disable PossibleMultipleWriteAccessInDoubleCheckLocking _customerRoleID = roleManager.FindByName(User.CUSTOMER_ROLE).Id; // ReSharper restore PossibleMultipleWriteAccessInDoubleCheckLocking } } } }
public virtual void SetUp() { userStoreMock = MockRepository.GenerateMock<IUserStore<ApplicationUser>>(); gamingGroupInviteConsumerMock = MockRepository.GenerateMock<IGamingGroupInviteConsumer>(); userRegistererMock = MockRepository.GenerateMock<IUserRegisterer>(); this.firstTimeAuthenticatorMock = MockRepository.GenerateMock<IFirstTimeAuthenticator>(); this.authenticationManagerMock = MockRepository.GenerateMock<IAuthenticationManager>(); var dataProtector = MockRepository.GenerateMock<IDataProtector>(); dataProtectionProviderMock = MockRepository.GenerateMock<IDataProtectionProvider>(); gamingGroupRetrieverMock = MockRepository.GenerateMock<IGamingGroupRetriever>(); boardGameGeekUserSaver = MockRepository.GenerateMock<IBoardGameGeekUserSaver>(); boardGameGeekApiClient = MockRepository.GenerateMock<IBoardGameGeekApiClient>(); userRetriever = MockRepository.GenerateMock<IUserRetriever>(); dataProtectionProviderMock.Expect(mock => mock.Create(Arg<string>.Is.Anything)).Return(dataProtector); userManager = new ApplicationUserManager(userStoreMock, dataProtectionProviderMock); accountControllerPartialMock = MockRepository.GeneratePartialMock<AccountController>( userManager, userRegistererMock, this.firstTimeAuthenticatorMock, this.authenticationManagerMock, gamingGroupInviteConsumerMock, gamingGroupRetrieverMock, boardGameGeekUserSaver, boardGameGeekApiClient, userRetriever); currentUser = new ApplicationUser() { Id = "new application user", CurrentGamingGroupId = 1 }; registerViewModel = new RegisterViewModel() { ConfirmPassword = "******", Password = "******", UserName = "******", EmailAddress = "*****@*****.**" }; }
public AuthScoreServiceWrapper( IScoreService scoreService, ClaimsPrincipal principal, EntityValidator entityValidator, IUserStore<IUserDto, int> userStore, ClaimsAuthorizationManager authorizationManager) { if (scoreService == null) { throw new ArgumentNullException("scoreService"); } if (principal == null) { throw new ArgumentNullException("principal"); } if (entityValidator == null) { throw new ArgumentNullException("entityValidator"); } if (userStore == null) { throw new ArgumentNullException("userStore"); } if (authorizationManager == null) { throw new ArgumentNullException("authorizationManager"); } _scoreService = scoreService; _principal = principal; _entityValidator = entityValidator; _userStore = userStore; _authorizationManager = authorizationManager; }
public AuthVisitServiceWrapper( IVisitService visitService, ClaimsPrincipal principal, EntityValidator entityValidator, IUserStore<IUserDto, int> userStore, ClaimsAuthorizationManager authorizationManager) { if (visitService == null) { throw new ArgumentNullException("visitService"); } _visitService = visitService; if (principal == null) { throw new ArgumentNullException("principal"); } _principal = principal; if (entityValidator == null) { throw new ArgumentNullException("entityValidator"); } _entityValidator = entityValidator; if (userStore == null) { throw new ArgumentNullException("userStore"); } _userStore = userStore; if (authorizationManager == null) { throw new ArgumentNullException("authorizationManager"); } _authorizationManager = authorizationManager; }
public CustomIdentityUserManager(IUserStore <CustomIdentityUser> store) : base(store) { }
public AppUserManager(IUserStore <AppUser> store) : base(store) { }
public ApplicationUserManager(IUserStore <ApplicationUser> store) : base(store) { PasswordHasher = new AspNetCorePasswordHasher(); }
public UsersController(IUserStore userStore, ISubscriptionStore subscriptionStore) { this.userStore = userStore; this.subscriptionStore = subscriptionStore; }
public ApplicationUserManager(IUserStore <Users, string> store) : base(store) { }
public ApplicationUserManager(IUserStore <IdentityUser, int> store) : base(store) { }
public ApplicationUserManager(IUserStore <Student> store) : base(store) { }
public TUserManager(IUserStore <TUser> store) : base(store) { }
public ApplicationUserManager(IUserStore <AppMember, int> store) : base(store) { }
public UsersManager(IUserStore <Users> store) : base(store) { }
public UserManager(IUserStore <User, long> store) : base(store) { }
public ApplicationUserManager(IUserStore <ApplicationUser> store) : base(store) { }
public BlogPostService() { this.userStore = new CoblogaUserStore(); }
public PasswordAuthorization(IUserStore userStore, ISessionManager sessionManager) { _userStore = userStore; _sessionManager = sessionManager; }
public DealDoubleUserManager(IUserStore <DealDoubleUser> store) : base(store) { }
public CustomUserManager(IUserStore <CustomUser> store) : base(store) { }
public ProfileService(IUserStore users) { _users = users; }
private ApplicationUserManager(IUserStore <ApplicationUser> store) : base(store) { }
public UserManager(IUserStore <User, int> store) : base(store) { UserValidator = new UserValidator <User, int>(this); PasswordValidator = new PasswordValidator(); }
public UserAppManager(IUserStore <Usuario> store) : base(store) { }
public ApplicationUserManager(IUserStore <CustomUser, long> store) : base(store) { }
public ApplicationUserManager(IUserStore <ApplicationUser> store, IOptions <IdentityOptions> optionsAccessor, IPasswordHasher <ApplicationUser> passwordHasher, IEnumerable <IUserValidator <ApplicationUser> > userValidators, IEnumerable <IPasswordValidator <ApplicationUser> > passwordValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, IServiceProvider services, ILogger <UserManager <ApplicationUser> > logger) : base(store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger) { }
public UserController(IUserStore userStore) { _userStore = userStore; }
public ApplicationUserManager(IUserStore <ApplicationUser> store, IIdentityMessageService emailService) : base(store) { this.EmailService = emailService; }
public ApplicationUserManager(IUserStore <User> userStore) : base(userStore) { }
public ApplicationUserManager(IUserStore<Hieu_TMDT.Models.IdentityModel.ApplicationUser> store) : base(store) { }