コード例 #1
0
        private async Task <ApiScope> CreateApiScopeAsync(string name)
        {
            var apiScopeClaims = new[]
            {
                "scopClaimTest"
            };

            var apiScope = await _apiScopeRepository.FindByNameAsync(name);

            if (apiScope == null)
            {
                apiScope = await _apiScopeRepository.InsertAsync(
                    new ApiScope()
                {
                    DisplayName             = name + " API",
                    Name                    = name,
                    Emphasize               = false,
                    Enabled                 = true,
                    Required                = false,
                    ShowInDiscoveryDocument = true
                }, true);;
            }


            foreach (var claim in apiScopeClaims)
            {
                if (apiScope.FindClaim(claim) == null)
                {
                    apiScope.AddUserClaim(claim);
                }
            }

            return(await _apiScopeRepository.UpdateAsync(apiScope, true));
        }
コード例 #2
0
 public async Task <bool> UpdateApiScopeAsync(Core.Entities.ApiScope.ApiScope apiScope)
 {
     return(await _repository.UpdateAsync(apiScope));
 }