sun.net.www.protocol.http
Class AuthenticationHeader

java.lang.Object
  extended by sun.net.www.protocol.http.AuthenticationHeader

public class AuthenticationHeader
extends Object

This class is used to parse the information in WWW-Authenticate: and Proxy-Authenticate: headers. It searches among multiple header lines and within each header line for the best currently supported scheme. It can also return a HeaderParser containing the challenge data for that particular scheme. Some examples: WWW-Authenticate: Basic realm="foo" Digest realm="bar" NTLM Note the realm parameter must be associated with the particular scheme. or WWW-Authenticate: Basic realm="foo" WWW-Authenticate: Digest realm="foo",qop="auth",nonce="thisisanunlikelynonce" WWW-Authenticate: NTLM or WWW-Authenticate: Basic realm="foo" WWW-Authenticate: NTLM ASKAJK9893289889QWQIOIONMNMN The last example shows how NTLM breaks the rules of rfc2617 for the structure of the authentication header. This is the reason why the raw header field is used for ntlm. At present, the class chooses schemes in following order : 1. Digest 2. NTLM (if supported) 3. Basic


Constructor Summary
AuthenticationHeader(String hdrname, MessageHeader response)
          parse a set of authentication headers and choose the preferred scheme that we support
 
Method Summary
 HeaderParser headerParser()
          return a header parser containing the preferred authentication scheme (only).
 boolean isPresent()
          returns true is the header exists and contains a recognised scheme
 String raw()
           
 String scheme()
          return the name of the preferred scheme
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AuthenticationHeader

public AuthenticationHeader(String hdrname,
                            MessageHeader response)
parse a set of authentication headers and choose the preferred scheme that we support

Method Detail

headerParser

public HeaderParser headerParser()
return a header parser containing the preferred authentication scheme (only). The preferred scheme is the strongest of the schemes proposed by the server. The returned HeaderParser will contain the relevant parameters for that scheme


scheme

public String scheme()
return the name of the preferred scheme


raw

public String raw()

isPresent

public boolean isPresent()
returns true is the header exists and contains a recognised scheme