public SiteRoleManager( SiteContext currentSite, IUserCommands userCommands, IUserQueries userQueries, IOptions <MultiTenantOptions> multiTenantOptionsAccessor, IRoleStore <TRole> roleStore, IEnumerable <IRoleValidator <TRole> > roleValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, ILogger <RoleManager <TRole> > logger, IHttpContextAccessor contextAccessor, IEnumerable <IHandleUserAddedToRole> userAddedToRoleHandlers, IEnumerable <IHandleUserRemovedFromRole> userRemovedFromRoleHandlers ) : base( roleStore, roleValidators, keyNormalizer, errors, logger) { if (roleStore == null) { throw new ArgumentNullException(nameof(roleStore)); } _commands = userCommands ?? throw new ArgumentNullException(nameof(userCommands)); _queries = userQueries ?? throw new ArgumentNullException(nameof(userQueries)); _siteSettings = currentSite ?? throw new ArgumentNullException(nameof(currentSite)); _log = logger; _multiTenantOptions = multiTenantOptionsAccessor.Value; _context = contextAccessor?.HttpContext; _userAddedToRoleHandlers = userAddedToRoleHandlers; _userRemovedFromRoleHandlers = userRemovedFromRoleHandlers; }
public SiteManager( SiteContext currentSite, ISiteCommands siteCommands, ISiteQueries siteQueries, IUserCommands userCommands, IUserQueries userQueries, SiteDataProtector dataProtector, IHttpContextAccessor contextAccessor, ILogger<SiteManager> logger, IOptions<MultiTenantOptions> multiTenantOptionsAccessor, IOptions<SiteConfigOptions> setupOptionsAccessor, CacheHelper cacheHelper ) { commands = siteCommands; queries = siteQueries; this.userCommands = userCommands; this.userQueries = userQueries; multiTenantOptions = multiTenantOptionsAccessor.Value; setupOptions = setupOptionsAccessor.Value; _context = contextAccessor?.HttpContext; this.dataProtector = dataProtector; log = logger; //resolver = siteResolver; siteSettings = currentSite; this.cacheHelper = cacheHelper; }
public SiteManager( SiteSettings currentSite, ISiteCommands siteCommands, ISiteQueries siteQueries, IUserCommands userCommands, IUserQueries userQueries, SiteDataProtector dataProtector, IHttpContextAccessor contextAccessor, ILogger <SiteManager> logger, IOptions <MultiTenantOptions> multiTenantOptionsAccessor, IOptions <SiteConfigOptions> setupOptionsAccessor, CacheHelper cacheHelper ) { commands = siteCommands; queries = siteQueries; this.userCommands = userCommands; this.userQueries = userQueries; multiTenantOptions = multiTenantOptionsAccessor.Value; setupOptions = setupOptionsAccessor.Value; _context = contextAccessor?.HttpContext; this.dataProtector = dataProtector; log = logger; //resolver = siteResolver; siteSettings = currentSite; this.cacheHelper = cacheHelper; }
public SiteManager( SiteContext currentSite, SiteEvents siteEventHandlers, ISiteCommands siteCommands, ISiteQueries siteQueries, IUserCommands userCommands, IUserQueries userQueries, SiteDataProtector dataProtector, IHttpContextAccessor contextAccessor, ILogger <SiteManager> logger, IOptions <MultiTenantOptions> multiTenantOptionsAccessor, IOptions <SiteConfigOptions> setupOptionsAccessor, CacheHelper cacheHelper ) { _commands = siteCommands; _queries = siteQueries; _userCommands = userCommands; _userQueries = userQueries; _multiTenantOptions = multiTenantOptionsAccessor.Value; _setupOptions = setupOptionsAccessor.Value; _context = contextAccessor?.HttpContext; _dataProtector = dataProtector; _log = logger; //resolver = siteResolver; _currentSite = currentSite; _cacheHelper = cacheHelper; _eventHandlers = siteEventHandlers; }
public RoleStore( SiteContext currentSite, ILogger <RoleStore <TRole> > logger, IOptions <MultiTenantOptions> multiTenantOptionsAccessor, IUserCommands userCommands, IUserQueries userQueries ) { if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (currentSite == null) { throw new ArgumentNullException(nameof(currentSite)); } if (userCommands == null) { throw new ArgumentNullException(nameof(userCommands)); } commands = userCommands; if (userQueries == null) { throw new ArgumentNullException(nameof(userQueries)); } queries = userQueries; log = logger; siteSettings = currentSite; multiTenantOptions = multiTenantOptionsAccessor.Value; }
/// <summary> /// Initializes a new <see cref="DevRantClient"/>. /// </summary> public DevRantClient() { client = new HttpClient(); client.BaseAddress = new Uri(Constants.BaseAddress); feeds = new FeedCommands(this, client); user = new UserCommands(this, client); }
public UserService(IUserCommands userCommands, IUserQueries userQueries, [ImportMany] IEnumerable <Lazy <IPasswordStrategy, IPrioritisedMefMetaData> > passwordStrategies, IPasswordPolicy passwordPolicy, IOAuthRegisteredClientCollection oAuthRegisteredClientCollection) { _userCommands = userCommands; _userQueries = userQueries; _passwordStrategy = passwordStrategies.OrderByDescending(x => x.Metadata.Priority).First().Value; _passwordPolicy = passwordPolicy; _oAuthRegisteredClientCollection = oAuthRegisteredClientCollection; }
public AccountController( UserManager <User> userManager, SignInManager <User> signInManager, ILogger <AccountController> logger, IUserCommands userManagementService) { _userManager = userManager; _signInManager = signInManager; _logger = logger; this.userManagementService = userManagementService; }
public IpAddressTracker( IUserCommands userCommands, IUserQueries userQueries, ILogger <IpAddressTracker> logger, IHttpContextAccessor contextAccessor) { commands = userCommands; queries = userQueries; log = logger; context = contextAccessor?.HttpContext; }
public IpAddressTracker( IUserCommands userCommands, IUserQueries userQueries, ILogger <IpAddressTracker> logger, IHttpContextAccessor contextAccessor) { _commands = userCommands; _queries = userQueries; _log = logger; _contextAccessor = contextAccessor; }
public IpAddressTracker( IUserCommands userCommands, IUserQueries userQueries, ILogger<IpAddressTracker> logger, IHttpContextAccessor contextAccessor) { commands = userCommands; queries = userQueries; log = logger; context = contextAccessor?.HttpContext; }
public SiteUserManager( SiteContext currentSite, UserEvents userEventHandlers, IEnumerable <IHandleUserEmailConfirmed> emailConfirmedHandlers, IUserCommands userCommands, IUserQueries userQueries, IUserStore <TUser> store, IOptions <IdentityOptions> optionsAccessor, IOptions <MultiTenantOptions> multiTenantOptionsAccessor, INewUserDisplayNameResolver displayNameResolver, IPasswordHasher <TUser> passwordHasher, IEnumerable <IUserValidator <TUser> > userValidators, IEnumerable <IPasswordValidator <TUser> > passwordValidators, ILookupNormalizer lookupNormalizer, IdentityErrorDescriber errors, IServiceProvider serviceProvider, ILogger <UserManager <TUser> > logger, IHttpContextAccessor contextAccessor) : base( store, optionsAccessor, passwordHasher, userValidators, passwordValidators, lookupNormalizer, errors, serviceProvider, logger) { identityOptions = optionsAccessor.Value; userStore = store; if (userCommands == null) { throw new ArgumentNullException(nameof(userCommands)); } commands = userCommands; if (userQueries == null) { throw new ArgumentNullException(nameof(userQueries)); } queries = userQueries; siteSettings = currentSite; multiTenantOptions = multiTenantOptionsAccessor.Value; this.contextAccessor = contextAccessor; httpContext = contextAccessor?.HttpContext; eventHandlers = userEventHandlers; this.passwordHasher = passwordHasher; _emailConfirmedHandlers = emailConfirmedHandlers; _displayNameResolver = displayNameResolver; }
public RoleStore( SiteContext currentSite, ILogger <RoleStore <TRole> > logger, IOptions <MultiTenantOptions> multiTenantOptionsAccessor, IUserCommands userCommands, IUserQueries userQueries ) { _commands = userCommands ?? throw new ArgumentNullException(nameof(userCommands)); _queries = userQueries ?? throw new ArgumentNullException(nameof(userQueries)); _log = logger ?? throw new ArgumentNullException(nameof(logger)); _siteSettings = currentSite ?? throw new ArgumentNullException(nameof(currentSite)); _multiTenantOptions = multiTenantOptionsAccessor.Value; }
public AuthController(IUserQueries queries, IUserCommands commands) { this.queries = queries; this.commands = commands; // gross hack var secretKey = "Restaurantoppatomus!123"; var signingKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(secretKey)); options = new TokenProviderOptions { Audience = "TheWorld", Issuer = "Restaurantoppotamus", SigningCredentials = new SigningCredentials(signingKey, SecurityAlgorithms.HmacSha256), }; }
public HybridFlowHelper( IUserQueries userQueries, IUserCommands userCommands, IDistributedCache distributedCache, OidcTokenEndpointService oidcTokenEndpointService, IOptions <OidcTokenManagementOptions> tokenOptions, ISystemClock clock, ILogger <HybridFlowHelper> logger ) { _userQueries = userQueries; _userCommands = userCommands; _cache = distributedCache; _oidcTokenEndpointService = oidcTokenEndpointService; _tokenOptions = tokenOptions.Value; _clock = clock; _log = logger; }
public SiteRoleManager( SiteSettings currentSite, IUserCommands userCommands, IUserQueries userQueries, IOptions <MultiTenantOptions> multiTenantOptionsAccessor, IRoleStore <TRole> roleStore, IEnumerable <IRoleValidator <TRole> > roleValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, ILogger <RoleManager <TRole> > logger, IHttpContextAccessor contextAccessor ) : base( roleStore, roleValidators, keyNormalizer, errors, logger, contextAccessor) { if (currentSite == null) { throw new ArgumentNullException(nameof(currentSite)); } if (roleStore == null) { throw new ArgumentNullException(nameof(roleStore)); } if (userCommands == null) { throw new ArgumentNullException(nameof(userCommands)); } commands = userCommands; if (userQueries == null) { throw new ArgumentNullException(nameof(userQueries)); } queries = userQueries; siteSettings = currentSite; this.logger = logger; multiTenantOptions = multiTenantOptionsAccessor.Value; _context = contextAccessor?.HttpContext; }
public UserStore( SiteSettings currentSite, ILogger <UserStore <TUser> > logger, IUserCommands userCommands, IUserQueries userQueries, IOptions <MultiTenantOptions> multiTenantOptionsAccessor ) { log = logger; if (currentSite == null) { throw new ArgumentNullException(nameof(currentSite)); } _siteSettings = currentSite; if (userCommands == null) { throw new ArgumentNullException(nameof(userCommands)); } commands = userCommands; if (userQueries == null) { throw new ArgumentNullException(nameof(userQueries)); } queries = userQueries; multiTenantOptions = multiTenantOptionsAccessor.Value; //debugLog = config.GetOrDefault("AppSettings:UserStoreDebugEnabled", false); if (debugLog) { log.LogInformation("constructor"); } }
public AccountService( SiteUserManager <SiteUser> userManager, SignInManager <SiteUser> signInManager, IIdentityServerIntegration identityServerIntegration, ISocialAuthEmailVerfificationPolicy socialAuthEmailVerificationPolicy, ILdapHelper ldapHelper, IUserCommands userCommands, IProcessAccountLoginRules loginRulesProcessor, INewUserDisplayNameResolver displayNameResolver, IOptions <CustomSocialAuthSchemes> customSchemesAccessor //,ILogger<AccountService> logger ) { UserManager = userManager; SignInManager = signInManager; IdentityServerIntegration = identityServerIntegration; SocialAuthEmailVerificationPolicy = socialAuthEmailVerificationPolicy; LoginRulesProcessor = loginRulesProcessor; DisplayNameResolver = displayNameResolver; CustomSocialAuthSchemes = customSchemesAccessor.Value; LdapHelper = ldapHelper; UserCommands = userCommands; }
public UsersService(IUserQueries userQueries, IUserCommands userCommands) { mUserQueries = userQueries; mUserCommands = userCommands; }
public UserEraser(IUserRepository userRepository, IUserCommands userCommands) { this.userRepository = userRepository; this.userCommands = userCommands; }
private static async Task EnsureData( ISiteQueries siteQueries, ISiteCommands siteCommands, IUserQueries userQueries, IUserCommands userCommands, IGeoQueries geoQueries, IGeoCommands geoCommands, IBasicQueries <SiteRole> roleQueries, IBasicQueries <SiteUser> userBasic, IProjectResolver projectResolver ) { int count = await geoQueries.GetCountryCount(); if (count == 0) { foreach (GeoCountry c in InitialData.BuildCountryList()) { await geoCommands.Add(c); } foreach (GeoZone c in InitialData.BuildStateList()) { await geoCommands.Add(c); } } //count = await geoQueries.GetLanguageCount(); //if (count == 0) //{ // foreach (Language c in InitialData.BuildLanguageList()) // { // await geoCommands.Add(c); // } //} var all = await geoQueries.GetAllCurrencies(); count = all.Count; if (count == 0) { foreach (Currency c in InitialData.BuildCurrencyList()) { await geoCommands.Add(c); } } count = await siteQueries.GetCount(); SiteSettings newSite = null; if (count == 0) { // create first site newSite = InitialData.BuildInitialSite(); await siteCommands.Create(newSite); } // ensure roles var projectId = await projectResolver.ResolveProjectId(); count = await roleQueries.GetCountAsync(projectId); if (count == 0) { var adminRole = InitialData.BuildAdminRole(); adminRole.SiteId = newSite.Id; await userCommands.CreateRole(adminRole); var roleAdminRole = InitialData.BuildRoleAdminRole(); roleAdminRole.SiteId = newSite.Id; await userCommands.CreateRole(roleAdminRole); var contentAdminRole = InitialData.BuildContentAdminsRole(); contentAdminRole.SiteId = newSite.Id; await userCommands.CreateRole(contentAdminRole); var authenticatedUserRole = InitialData.BuildAuthenticatedRole(); authenticatedUserRole.SiteId = newSite.Id; await userCommands.CreateRole(authenticatedUserRole); } // ensure admin user count = await userBasic.GetCountAsync(projectId); if (count == 0) { var role = await userQueries.FetchRole(newSite.Id, "Administrators"); if (role != null) { var adminUser = InitialData.BuildInitialAdmin(); adminUser.SiteId = newSite.Id; await userCommands.Create(adminUser); await userCommands.AddUserToRole(role.Id, adminUser.Id); role = await userQueries.FetchRole(newSite.Id, "Authenticated Users"); if (role != null) { await userCommands.AddUserToRole(role.Id, adminUser.Id); } } } }
private static async Task EnsureData( ISiteQueries siteQueries, ISiteCommands siteCommands, IUserQueries userQueries, IUserCommands userCommands, IGeoQueries geoQueries, IGeoCommands geoCommands, IBasicQueries <SiteRole> roleQueries, IBasicQueries <SiteUser> userBasic ) { int count = await geoQueries.GetCountryCount(); if (count == 0) { foreach (GeoCountry c in InitialData.BuildCountryList()) { await geoCommands.Add(c); } foreach (GeoZone c in InitialData.BuildStateList()) { await geoCommands.Add(c); } } count = await siteQueries.GetCount(); SiteSettings newSite = null; Guid siteId = Guid.Empty; if (count == 0) { // create first site newSite = InitialData.BuildInitialSite(); await siteCommands.Create(newSite); siteId = newSite.Id; } else if (count == 1) { var allSites = await siteQueries.GetList().ConfigureAwait(false); var site = allSites[0]; if (site != null) { siteId = site.Id; } } else { return; } // ensure roles //var projectId = await projectResolver.ResolveProjectId(); var projectId = siteId.ToString();; count = await roleQueries.GetCountAsync(projectId); if (count == 0) { var adminRole = InitialData.BuildAdminRole(); adminRole.SiteId = siteId; await userCommands.CreateRole(adminRole); var roleAdminRole = InitialData.BuildRoleAdminRole(); roleAdminRole.SiteId = siteId; await userCommands.CreateRole(roleAdminRole); var contentAdminRole = InitialData.BuildContentAdminsRole(); contentAdminRole.SiteId = siteId; await userCommands.CreateRole(contentAdminRole); var authenticatedUserRole = InitialData.BuildAuthenticatedRole(); authenticatedUserRole.SiteId = siteId; await userCommands.CreateRole(authenticatedUserRole); } // ensure admin user count = await userBasic.GetCountAsync(projectId); if (count == 0) { var role = await userQueries.FetchRole(newSite.Id, "Administrators"); if (role != null) { var adminUser = InitialData.BuildInitialAdmin(); adminUser.SiteId = siteId; adminUser.CanAutoLockout = false; await userCommands.Create(adminUser); await userCommands.AddUserToRole(siteId, role.Id, adminUser.Id); role = await userQueries.FetchRole(siteId, "Authenticated Users"); if (role != null) { await userCommands.AddUserToRole(siteId, role.Id, adminUser.Id); } } } }
public UserController(IUserQueries userQueries, IUserCommands userCommands) { _userQueries = userQueries; _userCommands = userCommands; }
public UserService(IUserCommands userCommands, IUserQueries userQueries) { _userCommands = userCommands; _userQueries = userQueries; }
public UsersController(IUserCommands <UserDTO> userCommands, IUserQueries <UserDTO> userQueries) { _userCommands = userCommands; _userQueries = userQueries; }
public RegisterService(IUserRepository userRepository, IUserCommands userCommands, SuscribersNotifier notifier) { this.userRepository = userRepository; this.userCommands = userCommands; this.notifier = notifier; }
private static async Task EnsureData( ISiteQueries siteQueries, ISiteCommands siteCommands, IUserQueries userQueries, IUserCommands userCommands, IGeoQueries geoQueries, IGeoCommands geoCommands, IBasicQueries<SiteRole> roleQueries, IBasicQueries<SiteUser> userBasic ) { int count = await geoQueries.GetCountryCount(); if (count == 0) { foreach (GeoCountry c in InitialData.BuildCountryList()) { await geoCommands.Add(c); } foreach (GeoZone c in InitialData.BuildStateList()) { await geoCommands.Add(c); } } count = await siteQueries.GetCount(); SiteSettings newSite = null; Guid siteId = Guid.Empty; if (count == 0) { // create first site newSite = InitialData.BuildInitialSite(); await siteCommands.Create(newSite); siteId = newSite.Id; } else if(count == 1) { var allSites = await siteQueries.GetList().ConfigureAwait(false); var site = allSites[0]; if (site != null) siteId = site.Id; } else { return; } // ensure roles //var projectId = await projectResolver.ResolveProjectId(); var projectId = siteId.ToString(); ; count = await roleQueries.GetCountAsync(projectId); if (count == 0) { var adminRole = InitialData.BuildAdminRole(); adminRole.SiteId = siteId; await userCommands.CreateRole(adminRole); var roleAdminRole = InitialData.BuildRoleAdminRole(); roleAdminRole.SiteId = siteId; await userCommands.CreateRole(roleAdminRole); var contentAdminRole = InitialData.BuildContentAdminsRole(); contentAdminRole.SiteId = siteId; await userCommands.CreateRole(contentAdminRole); var authenticatedUserRole = InitialData.BuildAuthenticatedRole(); authenticatedUserRole.SiteId = siteId; await userCommands.CreateRole(authenticatedUserRole); } // ensure admin user count = await userBasic.GetCountAsync(projectId); if (count == 0) { var role = await userQueries.FetchRole(newSite.Id, "Administrators"); if (role != null) { var adminUser = InitialData.BuildInitialAdmin(); adminUser.SiteId = siteId; await userCommands.Create(adminUser); await userCommands.AddUserToRole(siteId, role.Id, adminUser.Id); role = await userQueries.FetchRole(siteId, "Authenticated Users"); if (role != null) { await userCommands.AddUserToRole(siteId, role.Id, adminUser.Id); } } } }
public PasswordChanger(IUserCommands userCommands, IUserRepository userRepository) { this.userCommands = userCommands; this.userRepository = userRepository; }
public WeatherForecastController(ILogger <WeatherForecastController> logger, IUserQueries userQueries, IUserCommands userCommands) { _logger = logger; _userQueries = userQueries; _userCommands = userCommands; }