When PGX is deployed in client-server mode, it requires users to authenticate themselves by supplying an authentication token.
To integrate with many identity providers PGX offers an abstract API called 'realm'. The realm consists of interfaces that can be implemented to fit a specific identity provider.
Which realm implementation to use needs to be set in the PGX configuration.
The general authentication flow can be seen in the following diagram:
The general flow for authentication is:
When connecting from a PGX client, you need to first acquire a token from a identity provider. The PGX client does not have any method to acquire a token for you.
Once you have acquired a token, you need to provide it to the client using the Pgx.getInstance()
API:
import oracle.pgx.api.*; String authToken; // acquired from identity provider ServerInstance instance = Pgx.getInstance("https://myhost:7007", authToken);
There are multiple ways to present an authentication token using the PGX shell:
When starting the PGX shell with only the argument to connect to a PGX instance, it will automatically prompt for the authentication token on startup:
enter authentication token (press Enter for no token):
You can store the authentication token in a Java keystore and use this to connect to the server using the
--keystore_auth_token
flag. The alias of the token in the keystore needs to be AuthorizationToken
.
To set up a keystore with the an authentication token you can use the keytool
tool:
keytool -importpass -alias AuthorizationToken -keystore keystore.p12 # 1. Enter the password for the keystore # 2. Enter the authentication token
Use the following parameters to pgx-jshell
to provide the token to the PGX shell
./pgx-jshell -b https://myhost:7007 -k keystore.p12 --keystore_auth_token
When deploying PGX you need a PGX realm implementation that matches your identity provider. The realm implementation and all dependencies need to be bundled into the PGX war file before deployment.
To configure the realm implementation to use, it needs to be set in the PGX config in the pgx_realm
section.
For example to set the realm implementation to com.example.realm.ExampleRealm
the relevant section in the pgx.conf
file looks like:
{ "pgx_realm": { "implementation": "com.example.realm.ExampleRealm" } }
Optional, realm-dependent configuration options can be provided under the options
key.
The available keys and meaning of the values is determined by the used realm implementation.
{ "pgx_realm": { "implementation": "com.example.realm.ExampleRealm", "options": { "config_key_1": "value 1", "config_key_2": "value 2" } } }
By default, PGX does not ship with a default realm implementation, thus a realm has to be implemented for a specific deployment scenario and identity provider.
The realm implementation needs to be able to do the following actions given a token: