Пример #1
0
 public PlayerManagementIdentityController(
     IPlayerManagementStore store,
     IApplicationPerformanceMonitor appMonitor,
     ILogger <PlayerManagementIdentityController> logger)
 {
     _appMonitor = appMonitor;
     _store      = store;
     _logger     = logger;
 }
Пример #2
0
 public StoreBackedProfileService(
     IUserStore userStore,
     UserClaimsProvider userClaimsProvider,
     IApplicationPerformanceMonitor appMonitor,
     ILogger <StoreBackedProfileService> logger)
 {
     _userStore          = userStore;
     _userClaimsProvider = userClaimsProvider;
     _appMonitor         = appMonitor;
     _logger             = logger;
 }
Пример #3
0
 public LeaderboardController(
     ILeaderboardStore store,
     ILogger <LeaderboardController> logger,
     IApplicationPerformanceMonitor appMonitor,
     ILeaderboardProvider leaderboardProvider
     )
 {
     _store               = store;
     _logger              = logger;
     _appMonitor          = appMonitor;
     _leaderboardProvider = leaderboardProvider;
 }
Пример #4
0
 public ScoreController(
     ILeaderboardStore store,
     IAnalyticsIntegrationClient analyticsIntegrationClient,
     IApplicationPerformanceMonitor appMonitor,
     ILogger <ScoreController> logger
     )
 {
     _store = store;
     _analyticsIntegrationClient = analyticsIntegrationClient;
     _appMonitor = appMonitor;
     _logger     = logger;
 }
Пример #5
0
 public FacebookUserAccessTokenExtensionGrantValidator(
     IConfiguration configuration,
     IUserStore userStore,
     UserClaimsProvider userClaimsProvider,
     IApplicationPerformanceMonitor appMonitor,
     ILogger <FacebookUserAccessTokenExtensionGrantValidator> logger)
 {
     _configuration      = configuration;
     _userClaimsProvider = userClaimsProvider;
     _userStore          = userStore;
     _appMonitor         = appMonitor;
     _logger             = logger;
 }
Пример #6
0
 public StoreBackedResourceOwnerPasswordValidator(
     IUserStore userStore,
     UserClaimsProvider userClaimsProvider,
     IPasswordHasher passwordHasher,
     IApplicationPerformanceMonitor appMonitor,
     ILogger <StoreBackedResourceOwnerPasswordValidator> logger)
 {
     _userStore          = userStore;
     _userClaimsProvider = userClaimsProvider;
     _passwordHasher     = passwordHasher;
     _appMonitor         = appMonitor;
     _logger             = logger;
 }
 public FacebookUserAccessTokenExtensionGrantValidator(
     FacebookGraphService facebookGraphService,
     IUserStore userStore,
     UserClaimsProvider userClaimsProvider,
     IApplicationPerformanceMonitor appMonitor,
     ILogger <FacebookUserAccessTokenExtensionGrantValidator> logger)
 {
     _facebookGraphService = facebookGraphService;
     _userClaimsProvider   = userClaimsProvider;
     _userStore            = userStore;
     _appMonitor           = appMonitor;
     _logger = logger;
 }
 public LeaderboardController(
     ILeaderboardStore store,
     ILogger <LeaderboardController> logger,
     IApplicationPerformanceMonitor appMonitor,
     ILeaderboardProvider leaderboardProvider,
     ILeaderboardPlayerManagementClient playerManagementClient
     )
 {
     _store                  = store;
     _logger                 = logger;
     _appMonitor             = appMonitor;
     _leaderboardProvider    = leaderboardProvider;
     _playerManagementClient = playerManagementClient;
 }
        private void EnsureInitialAdminUser(IApplicationBuilder app, IConfiguration configuration, ILogger logger)
        {
            IApplicationPerformanceMonitor appMonitor = null;

            try
            {
                var serviceProvider = app.ApplicationServices;
                appMonitor = serviceProvider.GetService <IApplicationPerformanceMonitor>();

                logger.LogInformation("Identity:Store: Checking user store...");

                // construct a context to test if we have a user
                var  identityContext = serviceProvider.GetRequiredService <IdentityContextBase>();
                bool gotUsers        = identityContext.Users.Any(u => u.Role == RoleNames.Admin);
                if (gotUsers)
                {
                    logger.LogInformation("Identity:Store: users exist - no action");
                }
                else
                {
                    logger.LogInformation("Identity:Store: Adding initial admin user...");
                    // Create an initial admin
                    var passwordHasher = serviceProvider.GetRequiredService <IPasswordHasher>();
                    var password       = configuration["Identity:InitialSetup:AdminPassword"];
                    var user           = new UserEntity
                    {
                        Role     = RoleNames.Admin,
                        IsActive = true,
                        Logins   = new List <LoginEntity>
                        {
                            new LoginEntity {
                                ProviderType = LoginProvider.UserNamePassword,
                                ProviderId   = "netheradmin",
                                ProviderData = passwordHasher.HashPassword(password)
                            }
                        }
                    };
                    user.Logins[0].User = user;
                    identityContext.Users.Add(user);
                    identityContext.SaveChanges();
                    logger.LogInformation("Identity:Store: Adding initial admin user... complete");
                }
            }
            catch (Exception ex)
            {
                logger.LogCritical("Identity:Store: Adding initial admin user, exception: {0}", ex);
                appMonitor.LogError(ex, "Error adding initial admin user");
            }
        }
Пример #10
0
 public AccountController(
     IIdentityServerInteractionService interaction,
     IClientStore clientStore,
     IHttpContextAccessor httpContextAccessor,
     IUserStore userStore,
     IResourceOwnerPasswordValidator passwordValidator,
     IIdentityPlayerManagementClient playerManagementClient,
     IApplicationPerformanceMonitor appMonitor,
     ILogger <AccountController> logger)
 {
     // if the TestUserStore is not in DI, then we'll just use the global users collection
     _userStore              = userStore;
     _passwordValidator      = passwordValidator;
     _interaction            = interaction;
     _account                = new AccountService(interaction, httpContextAccessor, clientStore);
     _playerManagementClient = playerManagementClient;
     _appMonitor             = appMonitor;
     _logger = logger;
 }