コード例 #1
0
        public ActionResult Login(string userName, string password)
        {
            ActionResult result;
            string       connectionString = Config.GetConnectionString("MyWorkbench");

            try
            {
                MultiTenantHelper.Authenticate(userName, password);
                connectionString = MultiTenantHelper.ConnectionString(connectionString);

                if (SecurityProvider.InitConnection(userName, password, HttpContext, XpoDataStoreProviderService, connectionString))
                {
                    result = Ok();
                }
                else
                {
                    result = Unauthorized();
                }
            }
            catch
            {
                result = Unauthorized();
            }

            return(result);
        }
コード例 #2
0
        protected override ValidationResult IsValid(object value, ValidationContext validationContext)
        {
            SecurityProvider securityProvider = (SecurityProvider)validationContext.GetService(typeof(SecurityProvider));
            Login            login            = (Login)value;

            if (securityProvider.InitConnection(login.UserName, login.Password))
            {
                return(ValidationResult.Success);
            }
            return(new ValidationResult("User name or password is incorrect"));
        }
コード例 #3
0
        public ActionResult Login(string userName, string password)
        {
            ActionResult result;

            if (securityProvider.InitConnection(userName, password))
            {
                result = Ok();
            }
            else
            {
                result = Unauthorized();
            }
            return(result);
        }
コード例 #4
0
        public ActionResult Login(string userName, string password)
        {
            ActionResult result;
            string       connectionString = Config.GetConnectionString("XafApplication");

            if (SecurityProvider.InitConnection(userName, password, HttpContext, XpoDataStoreProviderService, connectionString))
            {
                result = Ok();
            }
            else
            {
                result = Unauthorized();
            }
            return(result);
        }
コード例 #5
0
 public ActionResult Login([FromBody] UserLogin data)
 {
     try
     {
         ActionResult result;
         string       userName = data.UserName;
         string       password = data.Password;
         if (securityProvider.InitConnection(userName, password))
         {
             result = Ok();
             GenHelper.WriteLog("[Log]", "[" + userName + "]Login Done:[" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "]");
         }
         else
         {
             result = Unauthorized();
         }
         return(result);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }