0
我使用的是嵌入式的jetty 9。挑战登录,基本身份验证
我想在我的属性文件中不存在用户名时发送质询。
我扩展了BasicAuthenticator类来捕获当用户名不存在时通常抛出的异常。在用户再次登录后,我无法看到如何操作。
public class MyBasicAuthenticator extends BasicAuthenticator{
@Override
public Authentication validateRequest(ServletRequest req,
ServletResponse res, boolean mandatory)
{
Authentication authentication = null;
try{
authentication = super.validateRequest(req,res,mandatory);
return authentication;
}catch (Exception e){
return Authentication.SEND_FAILURE;
}
}
Authentication.SEND_FAILURE防止ErrorHandler被调用,但它只是加载一个空白页。 SEND_FAILURE来自认证界面。
按照这个问题的答案Jetty6有一个发送挑战方法,Jetty9没有。 Jetty UserRealm redirect on 3th failed login