src/java.base/share/classes/sun/net/www/protocol/http/DigestAuthentication.java
changeset 53018 8bf9268df0e2
parent 47216 71c04702a3d5
child 57956 e0b8b019d2f5
equal deleted inserted replaced
53017:e10a1f7aaa13 53018:8bf9268df0e2
   277         HeaderParser p = new HeaderParser (header);
   277         HeaderParser p = new HeaderParser (header);
   278         String s = p.findValue ("stale");
   278         String s = p.findValue ("stale");
   279         if (s == null || !s.equals("true"))
   279         if (s == null || !s.equals("true"))
   280             return false;
   280             return false;
   281         String newNonce = p.findValue ("nonce");
   281         String newNonce = p.findValue ("nonce");
   282         if (newNonce == null || "".equals(newNonce)) {
   282         if (newNonce == null || newNonce.isEmpty()) {
   283             return false;
   283             return false;
   284         }
   284         }
   285         params.setNonce (newNonce);
   285         params.setNonce (newNonce);
   286         return true;
   286         return true;
   287     }
   287     }
   321             // here.
   321             // here.
   322             authMethod = Character.toUpperCase(authMethod.charAt(0))
   322             authMethod = Character.toUpperCase(authMethod.charAt(0))
   323                         + authMethod.substring(1).toLowerCase();
   323                         + authMethod.substring(1).toLowerCase();
   324         }
   324         }
   325         String algorithm = p.findValue("algorithm");
   325         String algorithm = p.findValue("algorithm");
   326         if (algorithm == null || "".equals(algorithm)) {
   326         if (algorithm == null || algorithm.isEmpty()) {
   327             algorithm = "MD5";  // The default, accoriding to rfc2069
   327             algorithm = "MD5";  // The default, accoriding to rfc2069
   328         }
   328         }
   329         params.setAlgorithm (algorithm);
   329         params.setAlgorithm (algorithm);
   330 
   330 
   331         // If authQop is true, then the server is doing RFC2617 and
   331         // If authQop is true, then the server is doing RFC2617 and
   449             if (!rspauth.equals (expected)) {
   449             if (!rspauth.equals (expected)) {
   450                 throw new ProtocolException ("Response digest invalid");
   450                 throw new ProtocolException ("Response digest invalid");
   451             }
   451             }
   452             /* Check if there is a nextnonce field */
   452             /* Check if there is a nextnonce field */
   453             String nextnonce = p.findValue ("nextnonce");
   453             String nextnonce = p.findValue ("nextnonce");
   454             if (nextnonce != null && ! "".equals(nextnonce)) {
   454             if (nextnonce != null && !nextnonce.isEmpty()) {
   455                 params.setNonce (nextnonce);
   455                 params.setNonce (nextnonce);
   456             }
   456             }
   457 
   457 
   458         } catch (NoSuchAlgorithmException ex) {
   458         } catch (NoSuchAlgorithmException ex) {
   459             throw new ProtocolException ("Unsupported algorithm in response");
   459             throw new ProtocolException ("Unsupported algorithm in response");