This class is not part of the public API.

Class: sun.net.www.protocol.http.AuthenticationInfo

AuthenticationInfo: Encapsulate the information needed to authenticate a user to a server.
Authors:
@author Jon Payne
@author Herb Jellinek
@author Bill Foote

Inheritance

Superclass tree: Implements:

Methods

  • AuthenticationInfotop

    AuthenticationInfo(char type, char authType, String host, int port, String realm)
    Use this constructor only for proxy entries
    Google Code Search
    Stack Overflow
  • AuthenticationInfotop

    AuthenticationInfo(char type, char authType, URL url, String realm)
    Google Code Search
    Stack Overflow
  • addToCachetop

    void addToCache()
    Add this authentication to the cache
    Google Code Search
    Stack Overflow
  • cacheKeytop

    String cacheKey(boolean includeRealm)
    Give a key for hash table lookups.
    Parameters:
    @param includeRealm if you want the realm considered. Preemptively setting an authorization is done before the realm is known.
    Google Code Search
    Stack Overflow
  • checkResponsetop

    abstract void checkResponse(String header, String method, URL url) throws IOException
    Check for any expected authentication information in the response from the server
    Google Code Search
    Stack Overflow
  • 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:
     x.clone() != x
    will be true, and that the expression:
     x.clone().getClass() == x.getClass()
    will be true, but these are not absolute requirements. While it is typically the case that:
     x.clone().equals(x)
    will be true, this is not an absolute requirement.

    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.

    Return:
    @return a clone of this instance.
    Override hierarchy:
    clone from Object
    Google Code Search
    Stack Overflow
  • credentialstop

    public PasswordAuthentication credentials()
    the credentials associated with this authentication
    Override hierarchy:
    credentials from AuthCacheValue
    Google Code Search
    Stack Overflow
  • endAuthRequesttop

    void endAuthRequest()
    Google Code Search
    Stack Overflow
  • getAuthtop

    static AuthenticationInfo getAuth(String key, URL url)
    Return the AuthenticationInfo object from the cache if it's path is a substring of the supplied URLs path.
    Google Code Search
    Stack Overflow
  • getAuthTypetop

    public AuthCacheValue.Type getAuthType()
    Override hierarchy:
    getAuthType from AuthCacheValue
    Google Code Search
    Stack Overflow
  • getHeaderNametop

    abstract String getHeaderName()
    Return:
    @return the name of the HTTP header this authentication wants set. This is used for preemptive authorization.
    Google Code Search
    Stack Overflow
  • getHeaderValuetop

    abstract String getHeaderValue(URL url, String method)
    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.
    Parameters:
    @param url The URL
    @param method The request method
    Return:
    @return the value of the HTTP header this authentication wants set. Used for preemptive authorization.
    Google Code Search
    Stack Overflow
  • getHosttop

    public String getHost()
    name of server/proxy
    Override hierarchy:
    getHost from AuthCacheValue
    Google Code Search
    Stack Overflow
  • getPathtop

    public String getPath()
    root path of realm or the request path if the root is not known yet.
    Override hierarchy:
    getPath from AuthCacheValue
    Google Code Search
    Stack Overflow
  • getPorttop

    public int getPort()
    portnumber of server/proxy
    Override hierarchy:
    getPort from AuthCacheValue
    Google Code Search
    Stack Overflow
  • getProtocolSchemetop

    public String getProtocolScheme()
    returns http or https
    Override hierarchy:
    getProtocolScheme from AuthCacheValue
    Google Code Search
    Stack Overflow
  • 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.
    Google Code Search
    Stack Overflow
  • getProxyAuthtop

    static AuthenticationInfo getProxyAuth(String host, int port, String realm, char atype)
    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.
    Google Code Search
    Stack Overflow
  • getRealmtop

    public String getRealm()
    realm of authentication if known
    Override hierarchy:
    getRealm from AuthCacheValue
    Google Code Search
    Stack Overflow
  • 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).
    Google Code Search
    Stack Overflow
  • getServerAuthtop

    static AuthenticationInfo getServerAuth(URL url, String realm, char atype)
    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
    Google Code Search
    Stack Overflow
  • 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.
    Google Code Search
    Stack Overflow
  • readObjecttop

    private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException
    Google Code Search
    Stack Overflow
  • reducePathtop

    static String reducePath(String urlPath)
    Google Code Search
    Stack Overflow
  • removeFromCachetop

    void removeFromCache()
    Remove this authentication from the cache
    Google Code Search
    Stack Overflow
  • requestCompletedtop

    static private void requestCompleted(String key)
    Google Code Search
    Stack Overflow
  • requestIsInProgresstop

    static private boolean requestIsInProgress(String key)
    Google Code Search
    Stack Overflow
  • setHeaderstop

    abstract boolean setHeaders(HttpURLConnection conn, HeaderParser p, String raw)
    Set header(s) on the given connection. Subclasses must override This will only be called for definitive (i.e. non-preemptive) authorization.
    Parameters:
    @param conn The connection to apply the header(s) to
    @param p A source of header values for this connection, if needed.
    @param raw The raw header field (if needed)
    Return:
    @return true if all goes well, false if no headers were set.
    Google Code Search
    Stack Overflow
  • supportsPreemptiveAuthorizationtop

    abstract boolean supportsPreemptiveAuthorization()
    Return:
    @return true if this authentication supports preemptive authorization
    Google Code Search
    Stack Overflow
  • writeObjecttop

    synchronized private void writeObject(ObjectOutputStream s) throws IOException
    Google Code Search
    Stack Overflow

Fields

  • PROXY_AUTHENTICATION

    static final char PROXY_AUTHENTICATION = 112
  • SERVER_AUTHENTICATION

    static final char SERVER_AUTHENTICATION = 115
  • authType

    char authType
    The authentication type (basic/digest). Also used for key lookup
  • host

    String host
    The host we're authenticating against.
  • path

    String path
    The shortest path from the URL we authenticated against.
  • port

    int port
    The port on the host we're authenticating against.
  • protocol

    String protocol
    The 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 realm
    The realm we're authenticating against.
  • requests

    static private HashMap requests
    requests 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 serializeAuth
    If 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 type
    The type (server/proxy) of authentication this is. Used for key lookup