@Override
  public boolean isRedirected(
      final HttpRequest request,
      final HttpResponse response,
      final HttpContext context) throws ProtocolException {
    int status = response.getStatusLine().getStatusCode();
    if (status == HttpStatus.SC_MOVED_TEMPORARILY || status == HttpStatus.SC_SEE_OTHER) {
      URI locationUri = getLocationURI(request, response, context);
      Header clientIdentifier = response
          .getFirstHeader(HiveSamlUtils.SSO_CLIENT_IDENTIFIER);
      IJdbcBrowserClient.JdbcBrowserClientContext browserClientContext = new JdbcBrowserClientContext(
          locationUri, clientIdentifier.getValue());
      browserClient.init(browserClientContext);
    }
    return super.isRedirected(request, response, context);
  }
This is an implementation of {@link RedirectStrategy} to intercept the HTTP redirect
response received from the server in a browser mode auth flow. This is mainly used
to get the redirect URL from the HTTP redirect response since HttpThrift client does
not expose such information when the server throws a HTTP 302 redirect as response.
The redirect URL is then used to initialize the {@link IJdbcBrowserClient} so that it
can do the browser based SSO.
jdbc/src/java/org/apache/hive/jdbc/saml/HiveJdbcSamlRedirectStrategy.java