Configuration

Keycloak

Once Keycloak has been deployed, a realm must be created (matching the values defined in the DS API configuration):

Create Realm

A client must also be created:

Create Client
Configure Client

Configure your client with the correct Web Origins and Valid Redirect URIs for your setup. If you wish to obtain access tokens via a password grant, enable Direct Access Grants and Implicit Flow. This may simplify obtaining tokens for an initial setup of the DS

In order for the Kong gateway to be able to validate the tokens issued by the realm client, the DS keystore must be configured as a Key Provider

Add Keystore - Java Keystore
Configure Key Provider

When configuring the keystore, specify the keystore path (either mounted as a volume in your container or on the server filesystem) in the Keystore field. Also you must make sure the keystore has a higher Priority value than the other default providers.

After creating a user, you can obtain an access token using the implicit flow by performing the following request:

This token can then be used to address the secured DS API endpoints

Distribution Service API

The configuration of the Distribution Service API can be done entirely through environment variables, or directly by editing the application.conf which can be found in the conf folder in the server distributable. An overview of both configuration options can be found below.

Configuration Options

Key

Environment Variable

Type

Description

t1c-ds.general.max-page-size

DS_MAX_PAGE_SIZE

Integer

The maximum allowed pagination size for results. This can be used in order to prevent the retrieval of too large a sample result. Default value is 100.

t1c-ds.t1c.domain

T1C_DOMAIN

String

The domain the T1C runs on.

t1c-ds.t1c.port

T1C_PORT

Integer

The port the T1C runs on.

t1c-ds.rmc.label

RMC_LABEL

String

The application label that can be used by the RMC web application.

t1c-ds.development.include-stacktrace

INCLUDE_STACKTRACE

Boolean

Include a stacktrace in the application's JSON response, which can be useful for debugging purposes. Must be set to false in production environments

t1c-ds.development.require-gateway-headers

REQUIRE_GATEWAY_HEADERS

Boolean

Incoming requests are checked for the presence of a X-Consumer-Custom-ID header placed by the gateway

t1c-ds.keystore.path

DS_KEYSTORE_PATH

String

The path (can be relative to the application root) to the DS API keystore in PKCS12 format, containing the DS certificate/keypair.

t1c-ds.keystore.password

DS_KEYSTORE_PASSWORD

String

The password to the DS API keystore. This is sensitive information. We recommend storing it as an environment variable.

t1c-ds.keystore.alias

DS_KEYSTORE_ALIAS

String

The alias of the DS API certificate/keypair stored in the keystore.

t1c-ds.security.enabled

DS_SECURITY_ENABLED

Boolean

Enables or disables the parsing of JSON web tokens on incoming requests. If set to false, all JWT payloads will be set to a default blank value. This must be set to true in production environments.

t1c-ds.security.jwt.ds-issuer

DS_ISSUER

String

The name of the DS API token issuer. It is used to generate JSON web tokens containing digests of configuration files.

t1c-ds.security.jwt.idp-issuer

DS_IDP_ISSUER

String

The name of the IDP token issuer. This is the value that can be found in the iss property in tokens issued by your configured IDP client. For Keyloak, this will take the form of https://{{idp-url}}/auth/realms/{{realmId}}.

t1c-ds.security.jwt.registration-token-validity-seconds

DS_REG_TOKEN_VALIDITY_SECONDS

Integer

The seconds a token issued for a registration API key should remain valid.

t1c-ds.security.jwt.application-token-validity-seconds

DS_APP_TOKEN_VALIDITY_SECONDS

Integer

The seconds a token issued for a label API key should remain valid.

t1c-ds.gateway.enabled

DS_GATEWAY_ENABLED

Boolean

Set to false while developing in order to test the DS API without needing a Kong gateway to be available. Must be set to true for production environments.

t1c-ds.gateway.url

DS_GATEWAY_URL

String

The Kong gateway URL. This value is used to generate download links for the Trust1Connector installer.

t1c-ds.gateway.admin-url

DS_GATEWAY_ADMIN_URL

String

The Kong gateway admin API URL. This URL is used to dynamically create API keys for labels and versions.

t1c-ds.gateway.ds-base-path

DS_GATEWAY_BASE_PATH

String

Used for generation of download links. If you route the DS on a non-default path, i.e. not on the root of the Kong gateway, you can specify it here. Default value is an empty string

t1c-ds.gateway.config.consumers.registration

DS_GATEWAY_CONSUMER_REGISTRATION

String

The username and custom_id of the registration consumer entity on the Kong gateway.

t1c-ds.gateway.config.consumers.application

DS_GATEWAY_CONSUMER_APPLICATION

String

The username and custom_id of the registration application entity on the Kong gateway.

t1c-ds.gateway.config.consumers.user

DS_GATEWAY_CONSUMER_USER

String

The username and custom_id of the registration consumer entity on the Kong gateway.

slick.dbs.default.db.url

T1C_DB_URL

String

The JNDI value for the PostgreSQL database to be used by the DS API, e. jdbc:postgresql://localhost:5433/t1c-ds

slick.dbs.default.db.user

T1C_DS_DB_USER

String

The PostgreSQL database username that has owner access to the t1c-ds database. We recommend storing this information as an environment variable.

slick.dbs.default.db.password

T1C_DS_DB_PWD

String

The PostgreSQL database user's password. We recommend storing this information as an environment variable.

play.evolutions.db.default.enabled

T1C_EVOLUTIONS_ENABLED

Boolean

Toggle whether database evolutions are enabled. We recommend setting it to false in production environments and manually updating the database models with a script.

play.evolutions.db.default.autoApply

T1C_EVOLUTIONS_AUTO

Boolean

Toggle whether database evolutions are automatically applied. We recommend setting it to false in production environments and manually updating the database models with a script.

play.evolutions.db.default.autoApplyDowns

T1C_EVOLUTIONS_AUTO_DOWNS

Boolean

Toggle whether database evolution downgrades are automatically applied. This must be set to false in production environments or data loss may occur.

play.http.secret.key

PLAY_SECRET

String

A secret used for built-in encryption utilities, signing session cookies and CSRF tokens, amongst other. This value must be set, and must be unique per environment.

pidfile.path

PIDFILE_PATH

String

The path where the RUNNING_PID file will be created. For dockerized environments, this must be set to /dev/null

Sample Configuration File

Kong

The Kong gateway can be configured in 2 ways:

  1. By letting the DS bootstrap the gateway using its default and configured values

  2. By running a script

The second option requires that the machine the script is executed on can access the admin API of the Kong Gateway.

DS Bootstrapping

Using a valid token obtained from Keycloak, execute the following request:

Property

Description

dsServiceName

The name of the DS API service to create on the gateway. Can be freely chosen.

dsServiceHost

The hostname of the DS API service

dsPort

The port to which the gateway can proxy requests

Script

You can also run a script to configure the Kong gateway. However, you need to adjust the script to your needs prior to executing it. You must also run it on a device on which curl is available.

The script contains requests to create every required entity on the Kong gateway. An overview can be found in the table below:

Entity Name

Entity Type

Enabled Plugins

Paths

t1c-ds-v3

Service

jwt-route

Route

jwt

"/v3/configurations/", "/v3/configurations", "/v3/devices/", "/v3/devices", "/v3/gateway/", "/v3/labels/", "/v3/labels", "/v3/organizations/", "/v3/organizations", "/v3/registration/", "/v3/versions/", "/v3/versions", "/v3/transactions/"

key-auth-route

Route

key-auth

"/v3/tokens/"

no-auth-route

Route

"/v3/system/", "/v3/device/", "/v3/downloads/", "/rmc/", "/rmc", "/mgt/", "/mgt", "/"

t1cds-reg

Consumer

jwt (key-auth plugin will be dynamically added when creating a new version)

t1cds-app

Consumer

jwt (key-auth plugin will be dynamically added when creating a new label)

t1cds-user

Consumer

jwt

Last updated

Was this helpful?