public async Task <IAASCreateUserPoolResponse> CreateUserPool(IAASCreateUserPoolRequest createRequest) { var request = new CreateUserPoolRequest { PoolName = createRequest.Name, Policies = new UserPoolPolicyType { PasswordPolicy = new PasswordPolicyType { MinimumLength = createRequest.PasswordPolicy.MinimumLength, RequireLowercase = createRequest.PasswordPolicy.RequireLowercase, RequireNumbers = createRequest.PasswordPolicy.RequireNumbers, RequireSymbols = createRequest.PasswordPolicy.RequireSymbols, RequireUppercase = createRequest.PasswordPolicy.RequireUppercase } } }; var response = await Client.CreateUserPoolAsync(request); var clientId = await CreateUserPoolClient($"{createRequest.Name} Prototype Client", response.UserPool.Id); return(new IAASCreateUserPoolResponse { Id = response.UserPool.Id, Audience = clientId, Authority = $"{BaseAuthority}/{response.UserPool.Id}" }); }
public async Task <ActionResult <string> > CreateOrganization(IAASCreateUserPoolRequest pool) { try { var response = await authService.CreateUserPool(pool); var newOrg = new Organization { OrganizationId = Guid.NewGuid(), CognitoUserPoolId = response.Id, CognitoAuthority = response.Authority, CognitoAudience = response.Audience }; db.Organizations.Add(newOrg); db.SaveChanges(); return(Ok(new CreateOrganizationResponse { OrganizationId = newOrg.OrganizationId })); } catch (Exception exception) { return(BadRequest(exception)); } }