Top Description Inners Fields Constructors Methods
sun.net.www.protocol.http

public Class AuthenticationHeader

extends Object
Class Inheritance
Imports
java.util.Collections, .Iterator, .Locale, .HashMap, .Set, sun.net.www.*, sun.security.action.GetPropertyAction

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. Negotiate (if supported) 2. Kerberos (if supported) 3. Digest 4. NTLM (if supported) 5. Basic This choice can be modified by setting a system property: -Dhttp.auth.preference="scheme" which in this case, specifies that "scheme" should be used as the auth scheme when offered disregarding the default prioritisation. If scheme is not offered, or explicitly disabled, by disabledSchemes, then the default priority is used. Attention: when http.auth.preference is set as SPNEGO or Kerberos, it's actually "Negotiate with SPNEGO" or "Negotiate with Kerberos", which means the user will prefer the Negotiate scheme with GSS/SPNEGO or GSS/Kerberos mechanism. This also means that the real "Kerberos" scheme can never be set as a preference.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private static final String
pack-priv boolean
private final HttpCallerInfo
pack-priv String
pack-priv HeaderParser
pack-priv String
pack-priv MessageHeader
pack-priv HashMap<String, AuthenticationHeader.SchemeMapValue>

Constructor Summary

AccessConstructor and Description
public
AuthenticationHeader(String hdrname, MessageHeader response, HttpCallerInfo hci, boolean dontUseNegotiate)

Parses a set of authentication headers and chooses the preferred scheme that is supported for a given host.

public
AuthenticationHeader(String hdrname, MessageHeader response, HttpCallerInfo hci, boolean dontUseNegotiate, Set<String> disabledSchemes)

Parses a set of authentication headers and chooses the preferred scheme that is supported for a given host.

Method Summary

Modifier and TypeMethod and Description
public HttpCallerInfo
public HeaderParser
headerParser()

return a header parser containing the preferred authentication scheme (only).

public boolean
isPresent()

returns true is the header exists and contains a recognised scheme

private void
parse(Set<String> disabledSchemes)

public String
raw()

public String
scheme()

return the name of the preferred scheme

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

authPrefback to summary
private static final String authPref
dontUseNegotiateback to summary
pack-priv boolean dontUseNegotiate
hciback to summary
private final HttpCallerInfo hci
hdrnameback to summary
pack-priv String hdrname
preferredback to summary
pack-priv HeaderParser preferred
preferred_rback to summary
pack-priv String preferred_r
rspback to summary
pack-priv MessageHeader rsp
schemesback to summary
pack-priv HashMap<String, AuthenticationHeader.SchemeMapValue> schemes

Constructor Detail

AuthenticationHeaderback to summary
public AuthenticationHeader(String hdrname, MessageHeader response, HttpCallerInfo hci, boolean dontUseNegotiate)

Parses a set of authentication headers and chooses the preferred scheme that is supported for a given host.

AuthenticationHeaderback to summary
public AuthenticationHeader(String hdrname, MessageHeader response, HttpCallerInfo hci, boolean dontUseNegotiate, Set<String> disabledSchemes)

Parses a set of authentication headers and chooses the preferred scheme that is supported for a given host.

The disabledSchemes parameter is a, possibly empty, set of authentication schemes that are disabled.

Method Detail

getHttpCallerInfoback to summary
public HttpCallerInfo getHttpCallerInfo()
headerParserback to summary
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

isPresentback to summary
public boolean isPresent()

returns true is the header exists and contains a recognised scheme

parseback to summary
private void parse(Set<String> disabledSchemes)
rawback to summary
public String raw()
schemeback to summary
public String scheme()

return the name of the preferred scheme

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

sun.net.www.protocol.http back to summary

pack-priv Class AuthenticationHeader.SchemeMapValue

extends Object
Class Inheritance
  • java.lang.Object
  • sun.net.www.protocol.http.AuthenticationHeader.SchemeMapValue

Field Summary

Modifier and TypeField and Description
pack-priv HeaderParser
pack-priv String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

parserback to summary
pack-priv HeaderParser parser
rawback to summary
pack-priv String raw

Constructor Detail

SchemeMapValueback to summary
pack-priv SchemeMapValue(HeaderParser h, String r)