Class: sun.net.www.protocol.http.AuthenticationInfo
- abstract class AuthenticationInfo
- extends AuthCacheValue
- implements Cloneable
Inheritance
Superclass tree:- java.lang.Object
- sun.net.www.protocol.http.AuthCacheValue
- sun.net.www.protocol.http.AuthenticationInfo
Methods
-
AuthenticationInfotop
Use this constructor only for proxy entries -
AuthenticationInfotop
-
addToCachetop
void addToCache()Add this authentication to the cache -
cacheKeytop
String cacheKey(boolean includeRealm)Give a key for hash table lookups. -
checkResponsetop
Check for any expected authentication information in the response from the server -
clonetop
public Object clone()Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:
will be true, and that the expression:x.clone() != x
will be true, but these are not absolute requirements. While it is typically the case that:x.clone().getClass() == x.getClass()
will be true, this is not an absolute requirement.x.clone().equals(x)
By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().
By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.
The method clone for class Object performs a specific cloning operation. First, if the class of this object does not implement the interface Cloneable, then a CloneNotSupportedException is thrown. Note that all arrays are considered to implement the interface Cloneable. Otherwise, this method creates a new instance of the class of this object and initializes all its fields with exactly the contents of the corresponding fields of this object, as if by assignment; the contents of the fields are not themselves cloned. Thus, this method performs a "shallow copy" of this object, not a "deep copy" operation.
The class Object does not itself implement the interface Cloneable, so calling the clone method on an object whose class is Object will result in throwing an exception at run time.
-
credentialstop
public PasswordAuthentication credentials()the credentials associated with this authentication- Override hierarchy:
- credentials from AuthCacheValue
-
endAuthRequesttop
void endAuthRequest() -
getAuthtop
Return the AuthenticationInfo object from the cache if it's path is a substring of the supplied URLs path. -
getAuthTypetop
public AuthCacheValue.Type getAuthType()- Override hierarchy:
- getAuthType from AuthCacheValue
-
getHeaderNametop
abstract String getHeaderName() -
getHeaderValuetop
Calculates and returns the authentication header value based on the stored authentication parameters. If the calculation does not depend on the URL or the request method then these parameters are ignored. -
getHosttop
public String getHost()name of server/proxy- Override hierarchy:
- getHost from AuthCacheValue
-
getPathtop
public String getPath()root path of realm or the request path if the root is not known yet.- Override hierarchy:
- getPath from AuthCacheValue
-
getPorttop
public int getPort()portnumber of server/proxy- Override hierarchy:
- getPort from AuthCacheValue
-
getProtocolSchemetop
public String getProtocolScheme()returns http or https- Override hierarchy:
- getProtocolScheme from AuthCacheValue
-
getProxyAuthtop
static AuthenticationInfo getProxyAuth(String host, int port)Returns a firewall authentication, for the given host/port. Used for preemptive header-setting. Note, the protocol field is always blank for proxies. -
getProxyAuthtop
Returns a firewall authentication, for the given host/port and realm. Used in response to a challenge. Note, the protocol field is always blank for proxies. -
getRealmtop
public String getRealm()realm of authentication if known- Override hierarchy:
- getRealm from AuthCacheValue
-
getServerAuthtop
static AuthenticationInfo getServerAuth(URL url)Returns info for the URL, for an HTTP server auth. Used when we don't yet know the realm (i.e. when we're preemptively setting the auth). -
getServerAuthtop
Returns info for the URL, for an HTTP server auth. Used when we do know the realm (i.e. when we're responding to a challenge). In this case we do not use the path because the protection space is identified by the host:port:realm only -
isAuthorizationStaletop
abstract boolean isAuthorizationStale(String header)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. -
readObjecttop
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException -
reducePathtop
-
removeFromCachetop
void removeFromCache()Remove this authentication from the cache -
requestCompletedtop
static private void requestCompleted(String key) -
requestIsInProgresstop
static private boolean requestIsInProgress(String key) -
setHeaderstop
Set header(s) on the given connection. Subclasses must override This will only be called for definitive (i.e. non-preemptive) authorization. -
supportsPreemptiveAuthorizationtop
abstract boolean supportsPreemptiveAuthorization() -
writeObjecttop
synchronized private void writeObject(ObjectOutputStream s) throws IOException
Fields
-
PROXY_AUTHENTICATION
static final char PROXY_AUTHENTICATION = 112 -
SERVER_AUTHENTICATION
static final char SERVER_AUTHENTICATION = 115 -
authType
char authTypeThe authentication type (basic/digest). Also used for key lookup -
host
String hostThe host we're authenticating against. -
path
String pathThe shortest path from the URL we authenticated against. -
port
int portThe port on the host we're authenticating against. -
protocol
String protocolThe protocol/scheme (i.e. http or https ). Need to keep the caches logically separate for the two protocols. This field is only used when constructed with a URL (the normal case for server authentication) For proxy authentication the protocol is not relevant. -
pw
transient protected PasswordAuthentication pw -
realm
String realmThe realm we're authenticating against. -
requests
static private HashMap requestsrequests is used to ensure that interaction with the Authenticator for a particular realm is single threaded. ie. if multiple threads need to get credentials from the user at the same time, then all but the first will block until the first completes its authentication. -
s1
String s1 -
s2
String s2 -
serializeAuth
static boolean serializeAuthIf true, then simultaneous authentication requests to the same realm/proxy are serialized, in order to avoid a user having to type the same username/passwords repeatedly, via the Authenticator. Default is false, which means that this behavior is switched off. -
type
char typeThe type (server/proxy) of authentication this is. Used for key lookup
