public void doStart() throws Exception { if (_authenticator==null) { // Find out the Authenticator. if (Constraint.__BASIC_AUTH.equalsIgnoreCase(_authMethod)) _authenticator=new BasicAuthenticator(); else if (Constraint.__DIGEST_AUTH.equalsIgnoreCase(_authMethod)) _authenticator=new DigestAuthenticator(); else if(Constraint.__CERT_AUTH.equals(_authMethod) || Constraint.__CERT_AUTH2.equals(_authMethod)) _authenticator=(Authenticator)Loader.loadClass(ConstraintsSecurityHandler.class,"org.mortbay.jetty.security.ClientCertAuthenticator").newInstance(); else if (Constraint.__FORM_AUTH.equalsIgnoreCase(_authMethod)) _authenticator=new FormAuthenticator(); else Log.warn("Unknown Authentication method:"+_authMethod); } super.doStart(); }
public void sendChallenge(UserRealm realm, Request request, Response response, boolean stale) throws IOException { String contextPath=request.getContextPath(); response.setHeader(HttpHeaders.WWW_AUTHENTICATE, "Digest realm=\""+realm.getName()+ "\", domain=\""+contextPath + "\", nonce=\""+newNonce(request)+ "\", algorithm=MD5, qop=\"auth\"" + (useStale?(" stale="+stale):"") ); response.sendError(HttpServletResponse.SC_UNAUTHORIZED); }
int n=checkNonce(digest.nonce,request); if (n>0) user = realm.authenticate(digest.username,digest,request); sendChallenge(realm,request,response,stale);
int n=checkNonce(digest.nonce,request); if (n>0) user = realm.authenticate(digest.username,digest,request); sendChallenge(realm,request,response,stale);
public void doStart() throws Exception { if (_authenticator==null) { // Find out the Authenticator. if (Constraint.__BASIC_AUTH.equalsIgnoreCase(_authMethod)) _authenticator=new BasicAuthenticator(); else if (Constraint.__DIGEST_AUTH.equalsIgnoreCase(_authMethod)) _authenticator=new DigestAuthenticator(); else if (Constraint.__CERT_AUTH.equalsIgnoreCase(_authMethod)) _authenticator=new ClientCertAuthenticator(); else if (Constraint.__FORM_AUTH.equalsIgnoreCase(_authMethod)) _authenticator=new FormAuthenticator(); else Log.warn("Unknown Authentication method:"+_authMethod); } super.doStart(); }
public void sendChallenge(UserRealm realm, Request request, Response response, boolean stale) throws IOException { String domain=request.getContextPath(); if (domain==null) domain="/"; response.setHeader(HttpHeaders.WWW_AUTHENTICATE, "Digest realm=\""+realm.getName()+ "\", domain=\""+domain + "\", nonce=\""+newNonce(request)+ "\", algorithm=MD5, qop=\"auth\"" + (useStale?(" stale="+stale):"") ); response.sendError(HttpServletResponse.SC_UNAUTHORIZED); }
webModuleData.setAttribute("authenticator", new BasicAuthenticator()); } else if ("DIGEST".equals(authMethod)) { webModuleData.setAttribute("authenticator", new DigestAuthenticator()); } else if ("FORM".equals(authMethod)) {
authenticator=new BasicAuthenticator(); else if(Constraint.__DIGEST_AUTH.equals(m)) authenticator=new DigestAuthenticator(); else if(Constraint.__CERT_AUTH.equals(m)) authenticator=new ClientCertAuthenticator();