public virtual bool RemoveToken(IdentityUserToken <string> token)
        {
            if (token == null)
            {
                throw new ArgumentNullException(nameof(token));
            }
            var modelToken = token as IdentityUserToken ?? new IdentityUserToken(token);

            return(RemoveFromCollection(this.Tokens, modelToken));
        }
        public virtual void AddToken(IdentityUserToken <string> token)
        {
            if (token == null)
            {
                throw new ArgumentNullException(nameof(token));
            }
            EnsureTokensCollection();
            var modelToken = token as IdentityUserToken ?? new IdentityUserToken(token);

            AddToCollection(this.Tokens, modelToken);
        }
        protected override async Task AddUserTokenAsync(IdentityUserToken token)
        {
            ThrowIfDisposed();
            if (token == null)
            {
                throw new ArgumentNullException(nameof(token));
            }
            await session.SaveAsync(token);

            await FlushChanges();
        }
Ejemplo n.º 4
0
 public IdentityUserToken(IdentityUserToken <string> token)
 {
     if (token == null)
     {
         throw new ArgumentNullException(nameof(token));
     }
     this.Name          = token.Name;
     this.UserId        = token.UserId;
     this.LoginProvider = token.LoginProvider;
     this.Value         = token.Value;
 }
        protected override async Task RemoveUserTokenAsync(IdentityUserToken <string> token)
        {
            this.ThrowIfDisposed();
            if (token == null)
            {
                throw new ArgumentNullException(nameof(token));
            }
            var user = (IdentityUser)await this.Context.GetAsync(typeof(IdentityUser), token.UserId);

            user.RemoveToken(token);
            await this.Context.FlushAsync();
        }
Ejemplo n.º 6
0
        public virtual bool Equals(IdentityUserToken <string> other)
        {
            if (other is null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(other.Name == this.Name && other.LoginProvider == this.LoginProvider && other.UserId == this.UserId);
        }
Ejemplo n.º 7
0
 public virtual bool Equals(IdentityUserToken other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     if (!this.GetType().IsUnproxiedTypeEqual(other.GetType()))
     {
         return(false);
     }
     return(this.Name == other.Name &&
            this.LoginProvider == other.LoginProvider &&
            this.UserId == other.UserId &&
            this.Value == other.Value);
 }
 protected bool Equals(IdentityUserToken other)
 {
     return(UserId == other.UserId &&
            LoginProvider == other.LoginProvider &&
            Name == other.Name);
 }