1 20 package org.apache.cactus.client.authentication; 21 22 import org.apache.cactus.WebRequest; 23 import org.apache.cactus.internal.configuration.Configuration; 24 import org.apache.commons.httpclient.HttpMethod; 25 import org.apache.commons.httpclient.HttpState; 26 import org.apache.commons.httpclient.UsernamePasswordCredentials; 27 28 36 public class BasicAuthentication extends AbstractAuthentication 37 { 38 42 public BasicAuthentication(String theName, String thePassword) 43 { 44 super(theName, thePassword); 45 } 46 47 50 public void configure(HttpState theState, HttpMethod theMethod, 51 WebRequest theRequest, Configuration theConfiguration) 52 { 53 theState.setAuthenticationPreemptive(true); 54 theState.setCredentials(null, null, 55 new UsernamePasswordCredentials(getName(), getPassword())); 56 theMethod.setDoAuthentication(true); 57 } 58 } 59 | Popular Tags |