public class AuthUtil
extends java.lang.Object
| Modifier and Type | Field and Description | 
|---|---|
| static AuthScheme[] | ALL_SCHEMESList of all known authentication schemes. | 
| static java.lang.String | AUTH_HEADERRFC7235 Authorization header key "Authorization" (RFC 7235 sec 4.2). | 
| static java.lang.String | AUTHID_HEADERHeader giving user authenticated ID "X-VO-Authenticated" (SSO_next). | 
| static java.lang.String | CHALLENGE_HEADERRFC 7235 challenge header key "WWW-Authenticate" (RFC 7235 sec 4.1). | 
| static AuthScheme[] | DFLT_SCHEMESDefault list of authentication schemes in order of preference. | 
| static boolean | LOG_SECRETSGlobal config: if true, passwords etc may be logged by logger. | 
| static java.lang.String | LOGSECRETS_PROPName of system property "auth.logsecrets" which if set "true"
 will allow reporting of sensitive information such as passwords
 through the logging system. | 
| static java.lang.String | SCHEMES_PROPName of system property "auth.schemes" giving a comma-separated list of
 AuthScheme instances or classnames, which overrides the default list
 of authentication schemes in order of preference. | 
| static java.nio.charset.Charset | UTF8UTF-8 charset, guaranteed present. | 
| Modifier and Type | Method and Description | 
|---|---|
| static java.lang.String | authFailureMessage(java.net.HttpURLConnection hconn)Prepares a short user-readable message indicating the state of a
 connection that failed because of auth issues. | 
| static java.lang.String | cookieLogText(java.net.HttpCookie cookie)Returns a string suitable for reporting through the logging system
 to represent a cookie. | 
| static java.lang.String | getAuthenticatedId(AuthConnection aconn)Returns the authenticated user ID recorded in the headers of
 a URL connection. | 
| static Challenge[] | getChallenges(java.net.URLConnection conn)Extracts challenges from an HTTP response. | 
| static AuthScheme[] | getDefaultSchemes()Returns a default list of AuthSchemes in order of preference. | 
| static int | getResponseCode(java.net.URLConnection conn)Returns the HTTP response code from a URL connection. | 
| static void | postForm(java.net.HttpURLConnection hconn,
        java.util.Map<java.lang.String,java.lang.String> params)Posts name=value pairs to an HTTP connection
 in  application/x-www-form-urlencodedformat. | 
| static java.net.HttpURLConnection | postForm(java.net.URL url,
        java.util.Map<java.lang.String,java.lang.String> params)Posts name=value pairs over HTTP  in
  application/x-www-form-urlencodedformat. | 
| static java.lang.String | unNullString(java.lang.String txt)Returns the input string, unless it's null, in which case it
 returns the empty string. | 
public static final java.nio.charset.Charset UTF8
public static final java.lang.String CHALLENGE_HEADER
public static final java.lang.String AUTH_HEADER
public static final java.lang.String AUTHID_HEADER
public static final java.lang.String LOGSECRETS_PROP
public static boolean LOG_SECRETS
public static final java.lang.String SCHEMES_PROP
public static final AuthScheme[] DFLT_SCHEMES
public static final AuthScheme[] ALL_SCHEMES
public static int getResponseCode(java.net.URLConnection conn)
conn - URL connectionpublic static Challenge[] getChallenges(java.net.URLConnection conn)
conn - open URL connection (typically, but not necessarily, 401)public static java.lang.String getAuthenticatedId(AuthConnection aconn)
aconn - connection to endpoint expected to yield an auth IDpublic static java.lang.String authFailureMessage(java.net.HttpURLConnection hconn)
hconn - open connection, should usually be 401 or 403public static java.lang.String unNullString(java.lang.String txt)
txt - stringpublic static java.lang.String cookieLogText(java.net.HttpCookie cookie)
LOG_SECRETS,
 it will or will not contain sensitive information.cookie - cookie to representpublic static AuthScheme[] getDefaultSchemes()
SCHEMES_PROP system property;
 if that is not set, it will take the value of DFLT_SCHEMES.public static java.net.HttpURLConnection postForm(java.net.URL url,
                                                  java.util.Map<java.lang.String,java.lang.String> params)
                                           throws java.io.IOException
application/x-www-form-urlencoded format.url - destination URLparams - map of name->value pairsjava.io.IOExceptionpublic static void postForm(java.net.HttpURLConnection hconn,
                            java.util.Map<java.lang.String,java.lang.String> params)
                     throws java.io.IOException
application/x-www-form-urlencoded format.
 The supplied connection can be the result of a call to
 URL.openConnection(), with or without some customization.hconn - unopened connectionparams - map of name->value pairsjava.io.IOException