public EditPostgreSqlConfigurationCommand( PostgreSqlConfiguration configuration, string databaseName, string uniqueRequestId) : base(databaseName, uniqueRequestId) { Configuration = configuration; }
public ConfigurePostgreSqlCommand(PostgreSqlConfiguration configuration) { _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); }
public void Setup() { sut = PostgreSqlConfiguration.Settings; }
public async Task AddUser() { AssertCanUsePostgreSqlIntegration(); using (Database.DocumentsStorage.ContextPool.AllocateOperationContext(out DocumentsOperationContext context)) { var newUserRequest = await context.ReadForMemoryAsync(RequestBodyStream(), "PostgreSQLNewUser"); var dto = JsonDeserializationServer.PostgreSqlUser(newUserRequest); await using (var writer = new AsyncBlittableJsonTextWriter(context, ResponseBodyStream())) { if (string.IsNullOrEmpty(dto.Username)) { HttpContext.Response.StatusCode = (int)HttpStatusCode.BadRequest; context.Write(writer, new DynamicJsonValue { ["Error"] = "Username is null or empty." }); return; } if (string.IsNullOrEmpty(dto.Password)) { HttpContext.Response.StatusCode = (int)HttpStatusCode.BadRequest; context.Write(writer, new DynamicJsonValue { ["Error"] = "Password is null or empty." }); return; } DatabaseRecord databaseRecord; using (Database.ServerStore.ContextPool.AllocateOperationContext(out TransactionOperationContext transactionOperationContext)) using (transactionOperationContext.OpenReadTransaction()) databaseRecord = Database.ServerStore.Cluster.ReadDatabase(transactionOperationContext, Database.Name, out long index); var newUser = new PostgreSqlUser { Username = dto.Username, Password = dto.Password }; var config = databaseRecord.Integrations?.PostgreSql; if (config == null) { config = new PostgreSqlConfiguration() { Authentication = new PostgreSqlAuthenticationConfiguration() { Users = new List <PostgreSqlUser>() } }; } var users = config.Authentication.Users; if (users.Any(x => x.Username.Equals(dto.Username, StringComparison.OrdinalIgnoreCase))) { HttpContext.Response.StatusCode = (int)HttpStatusCode.BadRequest; context.Write(writer, new DynamicJsonValue { ["Error"] = $"{dto.Username} username already exists." }); return; } users.Add(newUser); using (Database.ServerStore.ContextPool.AllocateOperationContext(out TransactionOperationContext transactionOperationContext)) await DatabaseConfigurations(ServerStore.ModifyPostgreSqlConfiguration, transactionOperationContext, RaftIdGenerator.DontCareId, config); } } NoContentStatus(); }
public static IdentityBuilder AddDapperIdentityForPostgreSql <TKey, TUserRole, TRoleClaim>(this IdentityBuilder builder, PostgreSqlConfiguration configurationOverride) { builder.Services.AddSingleton <SqlConfiguration>(configurationOverride); AddStores(builder.Services, builder.UserType, builder.RoleType, typeof(TKey), typeof(TUserRole), typeof(TRoleClaim)); return(builder); }
public static IdentityBuilder AddDapperIdentityForPostgreSql(this IdentityBuilder builder, PostgreSqlConfiguration configurationOverride) { builder.Services.AddSingleton <SqlConfiguration>(configurationOverride); AddStores(builder.Services, builder.UserType, builder.RoleType); return(builder); }
public ShopWriter(PostgreSqlConfiguration postgreSqlConfiguration) : base(postgreSqlConfiguration) { }
public ShopReader(PostgreSqlConfiguration postgreSqlConfiguration) : base(postgreSqlConfiguration) { }
public IntegrationsConfiguration() { PostgreSql = new PostgreSqlConfiguration(); }