示例#1
0
        public void AddAllowedScope(string scopeName)
        {
            if (_allowedScopes.Contains(scopeName))
            {
                throw new EntityValidationException($"This scope ({scopeName}) is already allowed.");
            }

            var e = new AddedAllowedScopeEvent()
            {
                ClientId   = Id,
                OccurredOn = DateTime.UtcNow,
                ScopeName  = scopeName
            };

            _changes.Add(e);
            EventHandler.AllowedScopeAdded(this, e);
        }
示例#2
0
 public static Client AllowedScopeAdded(Client client, AddedAllowedScopeEvent e)
 {
     client._allowedScopes.Add(e.ScopeName);
     return(client);
 }