public AuthorizationCodeRepository(IEtimoIdDbContext dbContext) { _dbContext = dbContext; }
public UserRepository(IEtimoIdDbContext dbContext) { _dbContext = dbContext; }
public RefreshTokenRepository(IEtimoIdDbContext dbContext) { _dbContext = dbContext; }
public AccessTokenRepository(IEtimoIdDbContext dbContext) { _dbContext = dbContext; }
public RoleRepository(IEtimoIdDbContext dbContext) { _dbContext = dbContext; }
public static async Task SeedAsync(IEtimoIdDbContext context, IServiceProvider services) { context.Database.EnsureCreated(); if (context.Users.Any()) { return; } var passwordHasher = services.GetService(typeof(IPasswordHasher)) as IPasswordHasher; Console.WriteLine("Start seeding the database."); var adminUserId = new Guid("b7b229a3-c84d-495f-b4ac-da3a4fd0757f"); var adminUser = new User { UserId = adminUserId, Username = "******", Password = passwordHasher.Hash("etimo") }; context.Users.Add(adminUser); var adminClientId = new Guid("11111111-1111-1111-1111-111111111111"); context.Applications.Add(new Application { ApplicationId = 1, Name = "etimo-default", Description = "Automatically generated.", HomepageUri = "https://localhost:5010", RedirectUri = "https://localhost:5010/oauth2/callback", ClientId = adminClientId, ClientSecret = passwordHasher.Hash("etimo"), UserId = adminUserId, Type = "confidential" }); var adminRole = new Role { Name = "admin", Description = "Automatically generated.", ApplicationId = 1, Users = new List <User> { adminUser } }; context.Roles.Add(adminRole); var scopes = GetBuiltInScopes("read") .Concat(GetBuiltInScopes("write")) .Concat(GetBuiltInScopes("admin")) .ToList(); context.Scopes.AddRange(scopes); adminRole.Scopes = scopes; await context.SaveChangesAsync(); Console.WriteLine("Finished seeding the database."); }
public ApplicationRepository(IEtimoIdDbContext dbContext) { _dbContext = dbContext; }