コード例 #1
0
        public async Task <bool> Execute(string scopeName)
        {
            _managerEventSource.StartToRemoveScope(scopeName);
            if (string.IsNullOrWhiteSpace(scopeName))
            {
                throw new ArgumentNullException(nameof(scopeName));
            }

            var scope = await _scopeRepository.GetAsync(scopeName);

            if (scope == null)
            {
                throw new IdentityServerManagerException(ErrorCodes.InvalidRequestCode,
                                                         string.Format(ErrorDescriptions.TheScopeDoesntExist, scopeName));
            }

            var res = await _scopeRepository.DeleteAsync(scope);

            if (res)
            {
                _managerEventSource.FinishToRemoveScope(scopeName);
            }

            return(res);
        }