code: static public String[] getUserNameAndPassword(String auth) throws Exception {
  
  		auth = auth.trim();
  		String[] components = auth.split("\\s+");
  		if( components.length > 0 ) {
  			if( "basic".equalsIgnoreCase(components[0].trim()) ) {
  				// Basic authentication was used, second word is uuencoded
  				if( components.length > 1 ) {
  					String encoded = components[1];
  
  					byte[] decoded = Base64.decodeBase64( encoded.getBytes() );
  					StringWriter sw = new StringWriter();
  					for(int loop=0; loop<decoded.length; ++loop) {
  						sw.write((int)decoded[loop]);
  					}
  
  					String userAndPass = sw.toString();
  					String[] tokens = userAndPass.trim().split(":");
  					
  					if( tokens.length < 2 ) {
  						throw new Exception("Unable to decode name from basic authorization");
  					}
  					
  					return tokens;
  				} else {
  					throw new Exception("Invalid authorization using Basic encoding");
  				}
  			}
  		}
  		
  		throw new Exception("Unknown authorization type: "+auth);
  	}
docs: This method takes the auth string from found in a HTTP request
  header (Authorization) and returns the name and password.
  @param auth Value of the Authorization HTTP header
  @return Array of username and password
  @throws Exception