Пример #1
0
        public UserLogin GetLoginUser(dynamic param)
        {
            UserLogin _UserLogin = new UserLogin();

            try
            {
                UserLoginRepo rp = new UserLoginRepo();
                _UserLogin = rp.GetLogin(param.FilterParameter.UserName.ToString(), param.FilterParameter.UserPassword.ToString());
            }
            catch (Exception ex)
            {
                DBLogger loger = new DBLogger(Convert.ToInt32(param.FilterParameter.UserLoginID));
                loger.LogMessage = "Apı  => GetLoginUser => Exception : " + ex.Message;
                LogManager lm = new LogManager(loger);
                lm.LogMe();
            }
            return(_UserLogin);
        }
Пример #2
0
 public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
 {
     try
     {
         context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] { "*" });
         UserLoginRepo ulr = new UserLoginRepo();
         UserLogin     ul  = ulr.GetLogin(context.UserName, context.Password);
         if (ul != null)
         {
             var identity = new ClaimsIdentity(context.Options.AuthenticationType);
             identity.AddClaim(new Claim(ClaimTypes.Role, "Role Ayarlanicak"));
             identity.AddClaim(new Claim(ClaimTypes.Name, context.UserName));
             context.Validated(identity);
         }
         else
         {
             context.SetError("invalid_grant", "Username and Password is Incorrect");
             return;
         }
     }
     catch (Exception ex)
     {
     }
 }