private static String decodeHeader(String authorizationHeader){
  final String BASIC_AUTH_CHARSET="US-ASCII";
  if (null == authorizationHeader)   throw new NullPointerException("authorization header");
  if (authorizationHeader.isEmpty())   throw new IllegalArgumentException("authorization header is empty");
  Base64.Decoder decoder=Base64.getMimeDecoder();
  byte[] decodedBytes=decoder.decode(authorizationHeader);
  try {
    return new String(decodedBytes,BASIC_AUTH_CHARSET);
  }
 catch (  UnsupportedEncodingException e) {
    throw new IllegalStateException("Unknown Charset: " + BASIC_AUTH_CHARSET,e);
  }
}

private static String decodeHeader ( String authorizationHeader ) { final String BASIC_AUTH_CHARSET = "US-ASCII" ; if ( null == authorizationHeader ) throw new NullPointerException ( "authorization header" ) ; if ( authorizationHeader . isEmpty ( ) ) throw new IllegalArgumentException ( "authorization header is empty" ) ; Base64 . Decoder decoder = Base64 . getMimeDecoder ( ) ; byte [ ] decodedBytes = decoder . decode ( authorizationHeader ) ; try { return new String ( decodedBytes , BASIC_AUTH_CHARSET ) ; } catch ( UnsupportedEncodingException e ) { throw new IllegalStateException ( "Unknown Charset: " + BASIC_AUTH_CHARSET , e ) ; } }
utility for decoding the http basic authentication header .
