code: protected String parseUsername(String authorization) {
          // System.out.println("Authorization token : " + authorization);
          // Validate the authorization credentials format
          if (authorization == null)
              return (null);
          if (!authorization.startsWith("Digest "))
              return (null);
          String tmpAuthorization = authorization.substring(7).trim();
  
          StringTokenizer commaTokenizer = new StringTokenizer(tmpAuthorization, ",");
  
          while (commaTokenizer.hasMoreTokens()) {
              String currentToken = commaTokenizer.nextToken();
              int equalSign = currentToken.indexOf('=');
              if (equalSign < 0)
                  return null;
              String currentTokenName = currentToken.substring(0, equalSign).trim();
              String currentTokenValue = currentToken.substring(equalSign + 1).trim();
              if ("username".equals(currentTokenName))
                  return (removeQuotes(currentTokenValue));
          }
          return (null);
      }
docs: Parse the username from the specified authorization string. If none can be identified, return <code>null</code>
  
  @param authorization Authorization string to be parsed