BlottoBeats.Library.Authentication.UserToken.Verify C# (CSharp) Method

Verify() public method

Verifies that two tokens are equal to each other and the "expires" date has not passed. Uses SlowEquals to prevent timing attacks.
public Verify ( UserToken token ) : bool
token UserToken Token to compare
return bool
        public bool Verify(UserToken token)
        {
            bool equal = (this.username.ToLower() == token.username.ToLower());

            equal &= (TrimMilliseconds(this.expires) == TrimMilliseconds(token.expires));
            equal &= (this.expires.CompareTo(DateTime.Now) > 0);
            equal &= PasswordHash.PasswordHash.SlowEquals(Convert.FromBase64String(this.token), Convert.FromBase64String(token.token));

            return equal;
        }