private async Task CreateSeedClientDocmentAsync() { Console.WriteLine("Creating seed client"); var seedClientDownParty = new OAuthDownParty(); await seedClientDownParty.SetIdAsync(new Party.IdKey { TenantName = settings.MasterTenant, TrackName = settings.MasterTrack, PartyName = settings.ClientId }); seedClientDownParty.Client = new OAuthDownClient { RedirectUris = new[] { settings.RedirectUri }.ToList(), ResourceScopes = new List <OAuthDownResourceScope> { new OAuthDownResourceScope { Resource = controlApiResourceName, Scopes = new[] { controlApiResourceMasterScope }.ToList() } }, ResponseTypes = new[] { "token" }.ToList(), AccessTokenLifetime = 1800 // 30 minutes }; (var secret, var oauthClientSecret) = await CreateSecretAsync(); seedClientDownParty.Client.Secrets = new List <OAuthClientSecret> { oauthClientSecret }; seedClientDownParty.Client.RequirePkce = false; seedClientDownParty.SetTenantPartitionId(); await simpleTenantRepository.SaveAsync(seedClientDownParty); Console.WriteLine("Seed client document created and saved in Cosmos DB"); Console.WriteLine($"Seed client secret is: {secret}"); }
private async Task CreateFoxIDsControlApiResourceDocumentAsync() { Console.WriteLine("Creating FoxIDs control API resource"); var controlApiResourceDownParty = new OAuthDownParty { Name = controlApiResourceName }; await controlApiResourceDownParty.SetIdAsync(new Party.IdKey { TenantName = settings.MasterTenant, TrackName = settings.MasterTrack, PartyName = controlApiResourceName }); controlApiResourceDownParty.Resource = new OAuthDownResource { Scopes = controlApiResourceScopes.ToList() }; controlApiResourceDownParty.SetTenantPartitionId(); await simpleTenantRepository.SaveAsync(controlApiResourceDownParty); Console.WriteLine($"FoxIDs control API resource document created and saved in Cosmos DB"); }