Пример #1
0
        public async Task <bool> Handle(string scopeName, JObject jObj, CancellationToken cancellationToken)
        {
            var scope = await _oauthScopeRepository.GetOAuthScope(scopeName, cancellationToken);

            if (scope == null)
            {
                _logger.LogError($"the scope '{scopeName}' doesn't exist");
                throw new OAuthScopeNotFoundException(ErrorCodes.INVALID_REQUEST, string.Format(ErrorMessages.UNKNOWN_CLIENT, scopeName));
            }

            var extractedScope = jObj.ToScopeDomain();

            scope.SetClaims(extractedScope.Claims);
            await _oauthScopeRepository.Update(scope, cancellationToken);

            await _oauthScopeRepository.SaveChanges(cancellationToken);

            _logger.LogInformation($"the scope '{scopeName}' has been updated");
            return(true);
        }