Print this page


Split Close
Expand all
Collapse all
          --- old/src/share/classes/sun/net/www/protocol/http/DigestAuthentication.java
          +++ new/src/share/classes/sun/net/www/protocol/http/DigestAuthentication.java
↓ open down ↓ 192 lines elided ↑ open up ↑
 193  193                port,
 194  194                realm);
 195  195          this.authMethod = authMethod;
 196  196          this.pw = pw;
 197  197          this.params = params;
 198  198      }
 199  199  
 200  200      /**
 201  201       * @return true if this authentication supports preemptive authorization
 202  202       */
 203      -    boolean supportsPreemptiveAuthorization() {
      203 +    @Override
      204 +    public boolean supportsPreemptiveAuthorization() {
 204  205          return true;
 205  206      }
 206  207  
 207  208      /**
 208      -     * @return the name of the HTTP header this authentication wants set
 209      -     */
 210      -    String getHeaderName() {
 211      -        if (type == SERVER_AUTHENTICATION) {
 212      -            return "Authorization";
 213      -        } else {
 214      -            return "Proxy-Authorization";
 215      -        }
 216      -    }
 217      -
 218      -    /**
 219  209       * Reclaculates the request-digest and returns it.
 220  210       *
 221  211       * <P> Used in the common case where the requestURI is simply the
 222  212       * abs_path.
 223  213       *
 224  214       * @param  url
 225  215       *         the URL
 226  216       *
 227  217       * @param  method
 228  218       *         the HTTP method
 229  219       *
 230  220       * @return the value of the HTTP header this authentication wants set
 231  221       */
 232      -    String getHeaderValue(URL url, String method) {
      222 +    @Override
      223 +    public String getHeaderValue(URL url, String method) {
 233  224          return getHeaderValueImpl(url.getFile(), method);
 234  225      }
 235  226  
 236  227      /**
 237  228       * Reclaculates the request-digest and returns it.
 238  229       *
 239  230       * <P> Used when the requestURI is not the abs_path. The exact
 240  231       * requestURI can be passed as a String.
 241  232       *
 242  233       * @param  requestURI
↓ open down ↓ 9 lines elided ↑ open up ↑
 252  243      }
 253  244  
 254  245      /**
 255  246       * Check if the header indicates that the current auth. parameters are stale.
 256  247       * If so, then replace the relevant field with the new value
 257  248       * and return true. Otherwise return false.
 258  249       * returning true means the request can be retried with the same userid/password
 259  250       * returning false means we have to go back to the user to ask for a new
 260  251       * username password.
 261  252       */
 262      -    boolean isAuthorizationStale (String header) {
      253 +    @Override
      254 +    public boolean isAuthorizationStale (String header) {
 263  255          HeaderParser p = new HeaderParser (header);
 264  256          String s = p.findValue ("stale");
 265  257          if (s == null || !s.equals("true"))
 266  258              return false;
 267  259          String newNonce = p.findValue ("nonce");
 268  260          if (newNonce == null || "".equals(newNonce)) {
 269  261              return false;
 270  262          }
 271  263          params.setNonce (newNonce);
 272  264          return true;
 273  265      }
 274  266  
 275  267      /**
 276  268       * Set header(s) on the given connection.
 277  269       * @param conn The connection to apply the header(s) to
 278  270       * @param p A source of header values for this connection, if needed.
 279  271       * @param raw Raw header values for this connection, if needed.
 280  272       * @return true if all goes well, false if no headers were set.
 281  273       */
 282      -    boolean setHeaders(HttpURLConnection conn, HeaderParser p, String raw) {
      274 +    @Override
      275 +    public boolean setHeaders(HttpURLConnection conn, HeaderParser p, String raw) {
 283  276          params.setNonce (p.findValue("nonce"));
 284  277          params.setOpaque (p.findValue("opaque"));
 285  278          params.setQop (p.findValue("qop"));
 286  279  
 287  280          String uri;
 288  281          String method;
 289  282          if (type == PROXY_AUTHENTICATION &&
 290  283                  conn.tunnelState() == HttpURLConnection.TunnelState.SETUP) {
 291  284              uri = HttpURLConnection.connectRequestURI(conn.getURL());
 292  285              method = HTTP_CONNECT;
↓ open down ↓ 226 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX