1 31 32 package org.apache.commons.httpclient.auth; 33 34 import java.util.Map ; 35 36 45 public abstract class RFC2617Scheme extends AuthSchemeBase { 46 47 50 private Map params = null; 51 52 60 public RFC2617Scheme(final String challenge) throws MalformedChallengeException { 61 super(challenge); 62 String s = AuthChallengeParser.extractScheme(challenge); 63 if (!s.equalsIgnoreCase(getSchemeName())) { 64 throw new MalformedChallengeException( 65 "Invalid " + getSchemeName() + " challenge: " + challenge); 66 } 67 this.params = AuthChallengeParser.extractParams(challenge); 68 } 69 70 75 protected Map getParameters() { 76 return this.params; 77 } 78 79 86 public String getParameter(String name) { 87 if (name == null) { 88 throw new IllegalArgumentException ("Parameter name may not be null"); 89 } 90 return (String ) this.params.get(name.toLowerCase()); 91 } 92 93 98 public String getRealm() { 99 return getParameter("realm"); 100 } 101 102 120 public String getID() { 121 return getRealm(); 122 } 123 } 124 | Popular Tags |