Example #1
0
        /// <summary>
        /// Encrypts internal identifier before sending it out to client.
        /// Private helper method.
        /// </summary>
        /// <param name="id">Identifier to be encrypted.</param>
        /// <param name="tableName">Database table in which identifier resides.</param>
        /// <returns>Encrypted stringified identifier.</returns>
        private string EncryptId(int id, string tableName)
        {
            string s = id.ToString() + "|" + tableName;

            return(Crypto.ActionEncrypt(s));
        }
        public async Task <Cliente> Authenticate(string userName, string password)
        {
            Cliente cliente = await _clienteRepository.GetForAuthentication(userName, Crypto.ActionEncrypt(password));

            ///Valida se autenticação funcionou e gera notificação
            if (!AssertionConcern.IsSatisfiedBy(AssertionConcern.AssertNotNull(cliente, "Usuário ou senha inválidos")))
            {
                return(null);
            }

            return(cliente);
        }
Example #3
0
        public Cliente PrepareForSubscription()
        {
            DsSenha = Crypto.ActionEncrypt(DsSenha);

            return(this);
        }