看起來這是在註銷時觸發的用戶名/密碼驗證的相同情況。如果你還沒有這樣做,你可以通過推出自己的CustomAuthProvider
來克服這個問題。在驗證部分,您應該將註銷作爲提供者排除。
public class CustomAuthProvider : CredentialsAuthProvider
{
private class CredentialsAuthValidator : AbstractValidator<Authenticate>
{
public CredentialsAuthValidator()
{
RuleFor(x => x.UserName)
.NotEmpty().WithMessage("Username Required")
.When(d => d.provider != "logout");
RuleFor(x => x.Password)
.NotEmpty().WithMessage("Password Required")
.When(d => d.provider != "logout");
}
}
public override object Authenticate(IServiceBase authService, IAuthSession session, Authenticate request)
{
new CredentialsAuthValidator().ValidateAndThrow(request);
return Authenticate(authService, session, request.UserName, request.Password, request.Continue);
}
}
您還需要註冊CustomAuthProvider
Plugins.Add(new AuthFeature(() => new CustomUserSession(),
new IAuthProvider[] {
new CustomAuthProvider()
}) { HtmlRedirect = null });
注意:你缺少在/auth/{provider}?username=&password=
提供商使用招,什麼是想退出時,你得到的錯誤訊息?它是「400不是空的」嗎? – Rachid 2015-04-02 14:49:48
@Rachid它的401 - 未經授權 – 2015-04-07 08:12:15