コード例 #1
0
        public bool RevokeToken(string userName)
        {
            var client = _mySQLContext.Clients.SingleOrDefault(u => (u.SecretClient == userName));

            if (client is null)
            {
                return(false);
            }
            client.RefreshToken = null;
            _mySQLContext.SaveChanges();
            return(true);
        }
コード例 #2
0
        public Credential Create(Credential credential)
        {
            // Criptografar
            credential.Pass   = Encrypt(credential.Pass);
            credential.User   = Encrypt(credential.User);
            credential.Domain = Encrypt(credential.Domain);
            _mySQLContext.Add(credential);
            _mySQLContext.SaveChanges();
            Credential teste = _mySQLContext.Credentials.FirstOrDefault(c => ((c.User == credential.User) && (c.Pass == credential.Pass)));

            return(teste);
        }