Exemplo n.º 1
0
        private bool IsUserTrusted(User user)
        {
            if (!this.configurationManager.Configuration.TrustedUsers.ContainsKey(user.Username))
            {
                return(false);
            }

            string keyHash = HashingUtil.GetSha256Hash(user.PublicKey);

            return(this.configurationManager.Configuration.TrustedUsers[user.Username] == keyHash);
        }
Exemplo n.º 2
0
        private bool TrustUser(User user)
        {
            if (user == null)
            {
                return(false);
            }

            if (this.configurationManager.Configuration.TrustedUsers.ContainsKey(user.Username))
            {
                return(false);
            }

            string keyHash = HashingUtil.GetSha256Hash(user.PublicKey);

            this.configurationManager.Configuration.TrustedUsers.Add(user.Username, keyHash);

            this.configurationManager.SaveChanges();

            return(true);
        }