public object Login(User_Login value) { try { //执行业务操作 Dm_ResultDefault result = User_LoginBLO.Login(value); return(result); } catch (Exception e) { throw e; } }
/// <summary> /// /// </summary> /// <param name="context"></param> /// <returns></returns> public Task ValidateAsync(ResourceOwnerPasswordValidationContext context) { User_Login ul = new User_Login(); ul.Login_Name = context.UserName; ul.Login_PassWord = context.Password; ul.Login_Ip = ""; Dm_ResultDefault dm = User_LoginBLO.Logins(ul); //if (context.UserName == "Aju" && context.Password == "Aju_password") if (dm.Result == 1) { context.Result = new GrantValidationResult( subject: context.UserName, authenticationMethod: OidcConstants.AuthenticationMethods.Password); } else { context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant, "无效的秘钥"); } return(Task.FromResult("")); }