//*******************************************************
        public override async Task GrantResourceOwnerCredentials
            (OAuthGrantResourceOwnerCredentialsContext context)
        {
            string mail = null;

            using (DBBTAEntities obj = new DBBTAEntities())
            {
                string contMail = context.UserName.Trim();
                string contPass = context.Password.Trim();

                CTEmployee emp1 = obj.CTEmployees.Where(
                    x => x.Email == contMail).FirstOrDefault();

                if (emp1 != null)
                {
                    bool PassEq = encrypt.decryptPass(emp1.Pass) == contPass;
                    mail = emp1.Email;

                    if (!PassEq)
                    {
                        context.SetError("invalid_grant",
                                         "The password is incorrect.");
                        return;
                    }
                }
                else
                {
                    context.SetError("invalid_grant",
                                     "User name not found.");
                    return;
                }
            }

            ClaimsIdentity oAuthIdentity =
                new ClaimsIdentity(context.Options.AuthenticationType);
            ClaimsIdentity cookiesIdentity =
                new ClaimsIdentity(context.Options.AuthenticationType);

            //ovo dodajem
            oAuthIdentity.AddClaim(new Claim(ClaimTypes.Name, mail));

            AuthenticationProperties NameProperty = CreateProperties(context.UserName);

            AuthenticationTicket ticket =
                new AuthenticationTicket(oAuthIdentity, NameProperty);

            context.Validated(ticket);
            context.Request.Context.Authentication.SignIn(cookiesIdentity);
        }