org.apache.hive.jdbc.saml

## Class HiveJdbcBrowserClient

- java.lang.Object
- - org.apache.hive.jdbc.saml.HiveJdbcBrowserClient

All Implemented Interfaces:
  Closeable, AutoCloseable, IJdbcBrowserClient

    public class HiveJdbcBrowserClient
    extends Object
    implements IJdbcBrowserClient

This class is used to execute a browser based SSO workflow with the authentication mode is browser.

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.apache.hive.jdbc.saml.IJdbcBrowserClient

`IJdbcBrowserClient.HiveJdbcBrowserException, IJdbcBrowserClient.HiveJdbcBrowserServerResponse, IJdbcBrowserClient.JdbcBrowserClientContext`

### Field Summary

Fields
`protected IJdbcBrowserClient.JdbcBrowserClientContext` `clientContext`
`static String` `TIMEOUT_ERROR_MSG`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addServerResponse(IJdbcBrowserClient.HiveJdbcBrowserServerResponse response)`
`void` `close()`
`void` `doBrowserSSO()` Execute the browser actions to complete the SSO workflow.
`String` `getClientIdentifier()` Gets the client identifier to be used to set in the http header for the requests from this browser client.
`org.apache.hive.jdbc.saml.HiveJdbcBrowserClient.OsType` `getMatchingOs(String osName)`
`Integer` `getPort()` Gets the port on this localhost where this browser client is listening on.
`IJdbcBrowserClient.HiveJdbcBrowserServerResponse` `getServerResponse()` Returns the `IJdbcBrowserClient.HiveJdbcBrowserServerResponse` as received from the server on the port where this browser client is listening on.
`void` `init(IJdbcBrowserClient.JdbcBrowserClientContext clientContext)` Initializes the browser client context.
`protected void` `openBrowserWindow()`
`void` `startListening()` Start a webserver and bind to a port number as configued.
`String` `toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### TIMEOUT_ERROR_MSG

    public static final String TIMEOUT_ERROR_MSG

See Also:
  Constant Field Values

#### clientContext

    protected IJdbcBrowserClient.JdbcBrowserClientContext clientContext

### Method Detail

#### startListening

    public void startListening()
                        throws IJdbcBrowserClient.HiveJdbcBrowserException

Description copied from interface: `IJdbcBrowserClient`
Start a webserver and bind to a port number as configued.

Specified by:
  `startListening` in interface `IJdbcBrowserClient`
Throws:
  `IJdbcBrowserClient.HiveJdbcBrowserException`

#### getPort

    public Integer getPort()

Description copied from interface: `IJdbcBrowserClient`
Gets the port on this localhost where this browser client is listening on.

Specified by:
  `getPort` in interface `IJdbcBrowserClient`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### getServerResponse

    public IJdbcBrowserClient.HiveJdbcBrowserServerResponse getServerResponse()

Description copied from interface: `IJdbcBrowserClient`
Returns the `IJdbcBrowserClient.HiveJdbcBrowserServerResponse` as received from the server on the port where this browser client is listening on.

Specified by:
  `getServerResponse` in interface `IJdbcBrowserClient`

#### close

    public void close()
               throws IOException

Specified by:
  `close` in interface `Closeable`
Specified by:
  `close` in interface `AutoCloseable`
Throws:
  `IOException`

#### init

    public void init(IJdbcBrowserClient.JdbcBrowserClientContext clientContext)

Description copied from interface: `IJdbcBrowserClient`
Initializes the browser client context. The client context contains a client identifier which must be used to set the http header with key `HiveSamlUtils.SSO_CLIENT_IDENTIFIER`.

Specified by:
  `init` in interface `IJdbcBrowserClient`

#### doBrowserSSO

    public void doBrowserSSO()
                      throws IJdbcBrowserClient.HiveJdbcBrowserException

Description copied from interface: `IJdbcBrowserClient`
Execute the browser actions to complete the SSO workflow. This method assumes that the `IJdbcBrowserClient.init(JdbcBrowserClientContext)` method has been called already to initialize the state needed for doing the browser based flow.

Specified by:
  `doBrowserSSO` in interface `IJdbcBrowserClient`
Throws:
  `IJdbcBrowserClient.HiveJdbcBrowserException` - in case of any errors to instantiate or execute browser flow.

#### openBrowserWindow

    protected void openBrowserWindow()
                              throws IJdbcBrowserClient.HiveJdbcBrowserException

Throws:
  `IJdbcBrowserClient.HiveJdbcBrowserException`

#### addServerResponse

    public void addServerResponse(IJdbcBrowserClient.HiveJdbcBrowserServerResponse response)

#### getClientIdentifier

    public String getClientIdentifier()

Description copied from interface: `IJdbcBrowserClient`
Gets the client identifier to be used to set in the http header for the requests from this browser client.

Specified by:
  `getClientIdentifier` in interface `IJdbcBrowserClient`

#### getMatchingOs

    public org.apache.hive.jdbc.saml.HiveJdbcBrowserClient.OsType getMatchingOs(String osName)