Authentication via OIDC¶
Overview¶
As of DPF 4.3.0, DPF Batch Client supports authentication via OIDC.
You have to configure the authentication via OIDC on server and client side. If authentication via OIDC is specified on the client side, but not configured for the server, the server ignores the authentication.
Configure the DPF Server¶
-
Specify the following key for
dpf-jobclient-api:AUTH_TYPE: Mode of client authentication, mandatory, set tooidc
If only authentication with bearer token is required, you do not have to specify any other environment key.
-
For the authentication with client id and secret specify for
dpf-jobclient-api:-
AUTH_CLIENT_ID: Client id, mandatory -
AUTH_CLIENT_SECRET: Client secret, mandatory -
AUTH_ISSUER_URL: URL of the token issuer, mandatory, example:https://<server>:32769/realms/SEALfor Keycloak 21 or newer -
AUTH_TOKEN_ENDPOINT: URL of the token endpoint, optional -
AUTH_PROXY: Proxy URL to access the OIDC provider, optional -
AUTH_ADDITIONAL_SCOPES: Additional scopes to use, optional
Hint - AUTH_ISSUER_URL and AUTH_TOKEN_ENDPOINT
AUTH_ISSUER_URLis sufficient, as long as your IDP supports OpenID Connect Discovery.You have to specify both URLs if:
-
Your IDP does not support automatic discovery or the feature is disabled.
-
Your IDP is behind a proxy or otherwise blocks access to the
.well-knownpath.
You can test it by calling
<auth_issuer_url>/.well-known/openid-configurationin a browser. If automatic discovery is supported, the server returns a JSON file containing the OpenID configuration. -
Authenticate the DPF Batch Client¶
You have two ways to specify the authentication for DPF Batch Client:
- Use command line parameters for each call of DPF Batch Client.
- Specify the authentication data in the configuration file of DPF Batch Client.
...with Command Line Parameters¶
For the authentication with client id and secret you have to specify:
-
--auth-client-id <client-id>: Client id, mandatory -
--auth-client-secret <client_secret>: Client secret, mandatory -
--auth-issuer-url <url>: URL of the token issuer, mandatory -
--auth-token-endpoint <url>: URL of the token endpoint, optional -
--auth-additional-scopes <scopes>: Additional scopes to use, optional
For the authentication with a bearer token specify:
--bearer <token>: JSON Web Token (JWT) for authentication, optional
Example - authentication with client id and client secret
dpfclient -wf example -host localhost:4303 -protocol http -loglevel T -v --auth-client-id <client-id> --auth-client-secret <secret> --auth-issuer-url https://localhost:32769/realms/SEAL/ --insecure
...in the Configuration File¶
If you use client id and client secret for authentication, you can specify the credentials in the configuration file dpfclient.xml for DPF Batch Client. This way, you do not have to add them via command line parameters for each call.
-
Open the configuration file
dpfclient.xmlin an editor. It is located at:- Windows:
C:\SEAL\applications\tools\bin_winnt5\dpfclient.xml - Linux:
/opt/seal/tools/bin_linux223/dpfclient.xml
- Windows:
-
Add the following section at the same level as the
ENVIRONMENTSkey and adapt the credentials as needed.<OIDC_AUTH AUTH_ISSUER_URL="https://localhost:32769/realms/SEAL/" AUTH_CLIENT_ID="<client-id>" AUTH_CLIENT_SECRET="<secret>" AUTH_TOKEN_ENDPOINT="<token_endpoint>" AUTH_ADDITIONAL_SCOPES="<additional_scopes>" />Example - dpfclient.xml with client id and client secret
<?xml version="1.0" encoding="ISO-8859-1"?> <DPF> <config> <dpfclient> <COMMANDLINE FLAGS=""> <PROPERTIES> </PROPERTIES> </COMMANDLINE> <ENVIRONMENTS DB_HOST="vs2015-mak" DB_PORT="7128" /> <REST_LOCAL REST_HOST="dpf-jobclient-api" REST_PORT="4303" REST_PROTOCOL="http" /> <OIDC_AUTH AUTH_ISSUER_URL="https://localhost:32769/realms/SEAL/" AUTH_CLIENT_ID="dpf-batch-client" AUTH_CLIENT_SECRET="3ljAX29BcGbnc8VRzmz1X2F49Du1zQUh" /> </dpfclient> </config> </DPF>