APIdia Launch Partner
Top Description Fields Constructors Methods
sun.net.www.protocol.http

pack-priv final Class NegotiateAuthentication

extends AuthenticationInfo
Class Inheritance
Imports
java.net.URL, .Authenticator.RequestorType, java.io.IOException, java.util.Base64, .HashMap, .Locale, java.util.concurrent.locks.ReentrantLock, sun.net.www.HeaderParser

NegotiateAuthentication:
Author
[email protected]
Since
1.6

Field Summary

Modifier and TypeField and Description
pack-priv static ThreadLocal<HashMap<String, Negotiator>>
private final HttpCallerInfo
private static final ReentrantLock
private Negotiator
pack-priv static HashMap<String, Boolean>
Inherited from sun.net.www.protocol.http.AuthenticationInfo:
authSchemehostpathportprotocolPROXY_AUTHENTICATIONpwrealmserializeAuthSERVER_AUTHENTICATIONtype

Constructor Summary

AccessConstructor and Description
public
NegotiateAuthentication(HttpCallerInfo
a schemed object.
hci
)

Constructor used for both WWW and proxy entries.

Method Summary

Modifier and TypeMethod and Description
public void
disposeContext()

Overrides sun.net.www.protocol.http.AuthenticationInfo.disposeContext.

Releases any system resources and cryptographic information stored in the context object and invalidates the context.

private byte[]

Returns:

the token
firstToken
()

return the first token.

private static HashMap<String, Negotiator>
public String
public boolean
isAuthorizationStale(String header)

Implements abstract sun.net.www.protocol.http.AuthenticationInfo.isAuthorizationStale.

Check if the header indicates that the current auth.

public static boolean

Returns:

true if supported
isSupported
(HttpCallerInfo hci)

Find out if the HttpCallerInfo supports Negotiate protocol.

private byte[]

Returns:

the token
nextToken
(byte[]
the token to be fed into negotiator.nextToken()
token
)

return more tokens

public void
setHeaders(HttpURLConnection
The connection to apply the header(s) to
conn
,
HeaderParser
A source of header values for this connection, not used because HeaderParser converts the fields to lower case, use raw instead
p
,
String
The raw header field.
raw
)

Implements abstract sun.net.www.protocol.http.AuthenticationInfo.setHeaders.

Set header(s) on the given connection.

public boolean
supportsPreemptiveAuthorization()

Implements abstract sun.net.www.protocol.http.AuthenticationInfo.supportsPreemptiveAuthorization.

Returns: true if this authentication supports preemptive authorization

protected boolean
useAuthCache()

Overrides sun.net.www.protocol.http.AuthenticationInfo.useAuthCache.

Whether we should cache this instance in the AuthCache.

Inherited from sun.net.www.protocol.http.AuthenticationInfo:
addToCachecacheKeyclonecredentialsendAuthRequestgetAuthgetAuthSchemegetAuthTypegetHeaderNamegetHostgetPathgetPortgetProtocolSchemegetProxyAuthgetProxyAuthgetProxyAuthKeygetRealmgetServerAuthgetServerAuthgetServerAuthKeyreducePathremoveFromCache

Field Detail

cacheback to summary
pack-priv static ThreadLocal<HashMap<String, Negotiator>> cache
hciback to summary
private final HttpCallerInfo hci
negotiateLockback to summary
private static final ReentrantLock negotiateLock
negotiatorback to summary
private Negotiator negotiator
supportedback to summary
pack-priv static HashMap<String, Boolean> supported

Constructor Detail

NegotiateAuthenticationback to summary
public NegotiateAuthentication(HttpCallerInfo hci)

Constructor used for both WWW and proxy entries.

Parameters
hci:HttpCallerInfo

a schemed object.

Method Detail

disposeContextback to summary
public void disposeContext()

Overrides sun.net.www.protocol.http.AuthenticationInfo.disposeContext.

Releases any system resources and cryptographic information stored in the context object and invalidates the context.

Annotations
@Override
firstTokenback to summary
private byte[] firstToken() throws IOException

return the first token.

Returns:byte[]

the token

Exceptions
IOException:
if Negotiator.getNegotiator() or Negotiator.firstToken() failed.
getCacheback to summary
private static HashMap<String, Negotiator> getCache()
getHeaderValueback to summary
public String getHeaderValue(URL url, String method)

Implements abstract sun.net.www.protocol.http.AuthenticationInfo.getHeaderValue.

Not supported. Must use the setHeaders() method

Annotations
@Override
isAuthorizationStaleback to summary
public boolean isAuthorizationStale(String header)

Implements abstract sun.net.www.protocol.http.AuthenticationInfo.isAuthorizationStale.

Check if the header indicates that the current auth. parameters are stale. If so, then replace the relevant field with the new value and return true. Otherwise return false. returning true means the request can be retried with the same userid/password returning false means we have to go back to the user to ask for a new username password.

Annotations
@Override
isSupportedback to summary
public static boolean isSupported(HttpCallerInfo hci)

Find out if the HttpCallerInfo supports Negotiate protocol. In order to find out yes or no, an initialization of a Negotiator object against it is tried. The generated object will be cached under the name of the hostname at a success try.
If this method is called for the second time on an HttpCallerInfo with the same hostname, the answer is retrieved from cache.

Returns:boolean

true if supported

nextTokenback to summary
private byte[] nextToken(byte[] token) throws IOException

return more tokens

Parameters
token:byte[]

the token to be fed into negotiator.nextToken()

Returns:byte[]

the token

Exceptions
IOException:
if negotiator.nextToken() throws Exception. May happen if the input token is invalid.
setHeadersback to summary
public void setHeaders(HttpURLConnection conn, HeaderParser p, String raw) throws IOException

Implements abstract sun.net.www.protocol.http.AuthenticationInfo.setHeaders.

Set header(s) on the given connection.

Parameters
conn:HttpURLConnection

The connection to apply the header(s) to

p:HeaderParser

A source of header values for this connection, not used because HeaderParser converts the fields to lower case, use raw instead

raw:String

The raw header field.

Annotations
@Override
Exceptions
IOException:
if no headers were set
supportsPreemptiveAuthorizationback to summary
public boolean supportsPreemptiveAuthorization()

Implements abstract sun.net.www.protocol.http.AuthenticationInfo.supportsPreemptiveAuthorization.

Returns:boolean

true if this authentication supports preemptive authorization

Annotations
@Override
useAuthCacheback to summary
protected boolean useAuthCache()

Overrides sun.net.www.protocol.http.AuthenticationInfo.useAuthCache.

Doc from sun.net.www.protocol.http.AuthenticationInfo.useAuthCache.

Whether we should cache this instance in the AuthCache. This method returns true by default. Subclasses may override this method to add additional restrictions.

Annotations
@Override