code: public static String getRealm(ChallengeRequest challengeRequest) {
          String authenticationParameters = challengeRequest.getAuthenticationParameters();
          if ( authenticationParameters == null) {
              return null;
          }
          Matcher m = REALM_PATTERN.matcher(authenticationParameters);
          if ( m.matches() && m.groupCount()>=3) {
              return m.group(3);
          }
          return null;
      }
docs: A realm parameter is a valid authentication parameter for all authentication schemes
  according to <a href="http://tools.ietf.org/html/rfc2617#section-2.1">RFC 2617 Section 2.1"</a>.
  
  <quote>
  The realm directive (case-insensitive) is required for all
  authentication schemes that issue a challenge. The realm value
  (case-sensitive), in combination with the canonical root URL (the
  absoluteURI for the server whose abs_path is empty) of the server
  being accessed, defines the protection space.
  </quote>
  
  @param challengeRequest the challenge request to extract a realm from
  
  @return the unquoted realm parameter value if present, or {@code null} if no such parameter exists.