To configure the driver to use digest authentication:
  • Configure the minimum properties required for a connection:
    • If you are using a Model file, set the Config property to provide the name and location of the Model file. For example, C:/path/to/myrest.rest.
    • If you are using the Sample property, set the Sample property to specify the endpoint that the want to connect to and sample. For example, https://example.com/countries/.
  • Set the AuthenticationMethod property to Digest.
  • Set the User property to specify the user name that is used to connect to your REST service. For example, jsmith.
  • Set the Password property to specify your password.
  • Optionally, set the HealthURI property to specify the URI that the driver calls to confirm connectivity. Services using digest authentication do not perform an explicit action upon connection. You can work around this limitation by specifying a value for this property. The driver performs a connectivity test at connection, when executing a test connect, or whenever the driver needs to confirm connectivity.
  • Optionally, specify values for any additional properties you want to configure.

The following examples demonstrate a session using a Model file and digest authentication.

For a connection URL:

Connection conn = DriverManager.getConnection
("jdbc:datadirect:autorest:https://example.com/;AuthenticationMethod=BearerToken;
  Config=C:/path/to/myrest.rest;User=jsmith;Password=secret;");

For a data source:

AutoRESTDataSource mds = new AutoRESTDataSource();
mds.setDescription("My Autonomous REST Data Source");
mds.setAuthenticationMethod("Digest");
mds.setConfig("C:/path/to/myrest.rest");