private async Task AddApiResources()
    {
        var apiResource = new ApiResource(_testData.ApiResource1Id, "NewApiResource1");

        apiResource.Description = nameof(apiResource.Description);
        apiResource.DisplayName = nameof(apiResource.DisplayName);

        apiResource.AddScope(nameof(ApiResourceScope.Scope));
        apiResource.AddUserClaim(nameof(ApiResourceClaim.Type));
        apiResource.AddSecret(nameof(ApiResourceSecret.Value));

        await _apiResourceRepository.InsertAsync(apiResource);

        await _apiResourceRepository.InsertAsync(new ApiResource(_guidGenerator.Create(), "NewApiResource2"));

        await _apiResourceRepository.InsertAsync(new ApiResource(_guidGenerator.Create(), "NewApiResource3"));

        var apiResource2 = new ApiResource(_guidGenerator.Create(), "Test-ApiResource-Name-1")
        {
            Enabled     = true,
            Description = "Test-ApiResource-Description-1",
            DisplayName = "Test-ApiResource-DisplayName-1"
        };

        apiResource2.AddSecret("secret".Sha256());
        apiResource2.AddScope("Test-ApiResource-ApiScope-Name-1");
        apiResource2.AddScope("Test-ApiResource-ApiScope-DisplayName-1");
        apiResource2.AddUserClaim("Test-ApiResource-Claim-Type-1");

        await _apiResourceRepository.InsertAsync(apiResource2);
    }
        private void AddApiResources()
        {
            var apiResource = new ApiResource(_guidGenerator.Create(), "Test-ApiResource-Name-1")
            {
                Enabled     = true,
                Description = "Test-ApiResource-Description-1",
                DisplayName = "Test-ApiResource-DisplayName-1"
            };

            apiResource.AddSecret("secret".Sha256());
            apiResource.AddScope("Test-ApiResource-ApiScope-Name-1", "Test-ApiResource-ApiScope-DisplayName-1");
            apiResource.AddUserClaim("Test-ApiResource-Claim-Type-1");

            _apiResourceRepository.Insert(apiResource);
        }
Пример #3
0
        private async Task AddApiResources()
        {
            var apiResource = new ApiResource(_guidGenerator.Create(), "Test-ApiResource-Name-1")
            {
                Enabled     = true,
                Description = "Test-ApiResource-Description-1",
                DisplayName = "Test-ApiResource-DisplayName-1"
            };

            apiResource.AddSecret("secret".Sha256());
            apiResource.AddScope("Test-ApiResource-ApiScope-Name-1", "Test-ApiResource-ApiScope-DisplayName-1");
            apiResource.AddUserClaim("Test-ApiResource-Claim-Type-1");

            await _apiResourceRepository.InsertAsync(apiResource).ConfigureAwait(false);
        }