Beispiel #1
0
        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 = apiResourceName, Scopes = new[] { "foxids_master" }.ToList()
                    }
                },
                ResponseTypes = new[] { "token" }.ToList(),
                AccessTokenLifetime = 1800 // 30 minutes
            };

            (var secret, var oauthClientSecret) = await CreateSecretAsync();

            seedClientDownParty.Client.Secrets = new List <OAuthClientSecret> {
                oauthClientSecret
            };
            seedClientDownParty.SetPartitionId();

            await simpleTenantRepository.SaveAsync(seedClientDownParty);

            Console.WriteLine("Seed client document created and saved in Cosmos DB");
            Console.WriteLine($"Seed client secret is: {secret}");
        }
Beispiel #2
0
        private async Task CreateFoxIDsApiResourceDocumentAsync()
        {
            Console.WriteLine("Creating FoxIDs api resource");

            var apiResourceDownParty = new OAuthDownParty();
            await apiResourceDownParty.SetIdAsync(new Party.IdKey {
                TenantName = settings.MasterTenant, TrackName = settings.MasterTrack, PartyName = apiResourceName
            });

            apiResourceDownParty.Resource = new OAuthDownResource
            {
                Scopes = apiResourceScopes.ToList()
            };
            apiResourceDownParty.SetPartitionId();

            await simpleTenantRepository.SaveAsync(apiResourceDownParty);

            Console.WriteLine($"FoxIDs api resource document created and saved in Cosmos DB");
        }