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