コード例 #1
0
        public void RemoveScope(int scopeId)
        {
            var scopeToRemove = Scopes.FirstOrDefault(s => s.ScopeId == scopeId);

            if (scopeToRemove != null)
            {
                Scopes.Remove(scopeToRemove);
            }
        }
コード例 #2
0
        public void RemoveNamedScope(string scopeName)
        {
            var scope = GetScope(scopeName);

            if (!string.IsNullOrWhiteSpace(scope))
            {
                _namedScopes.Remove(scopeName);
                Scopes.Remove(scope);
            }
        }
コード例 #3
0
 public void RemoveScope(string scope)
 {
     if (!string.IsNullOrWhiteSpace(scope))
     {
         foreach (var item in _namedScopes.Where(kvp => kvp.Value == scope).ToList())
         {
             _namedScopes.Remove(item.Key);
         }
         Scopes.Remove(scope);
     }
 }
コード例 #4
0
 public void RemovePolicy(string policy)
 {
     if (!string.IsNullOrWhiteSpace(policy))
     {
         foreach (var item in _namedPolicies.Where(kvp => kvp.Value == policy).ToList())
         {
             _namedPolicies.Remove(item.Key);
         }
         Scopes.Remove(policy);
     }
 }
コード例 #5
0
        public async Task <IdentityServiceResult> RemoveScopeAsync(TApplication application, string scope, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            ThrowIfDisposed();
            if (application == null)
            {
                throw new ArgumentNullException(nameof(application));
            }

            if (scope == null)
            {
                throw new ArgumentNullException(nameof(scope));
            }

            var existingScope = await Scopes
                                .SingleAsync(ru => ru.ApplicationId.Equals(application.Id) && ru.Value.Equals(scope));

            Scopes.Remove(existingScope);

            return(IdentityServiceResult.Success);
        }