Example source code
There are example Java projects that use Trivore ID's SSO mechanisms. Both mechanisms have their own GitLab repository. The Management API example project can be found here, and the OpenID Connect mechanism example project can be found here.
Management API
The source code for the example implementation of an SSO target via the Management API can be downloaded from GitLab.
Use Maven to build this example. The result of the Maven build is a simple .war package that
can be deployed on Apache Tomcat or Eclipse Jetty.
$ mvn clean package
# Resulting .war file is located at target/sso-example-1.0-SNAPSHOT.war
When deploying the .war file to a servlet container, you need to define the following
settings.
| Property name | Description | Example value |
|---|---|---|
sso.example.configLocation | Location of the .properties file that contains settings | classpath:sso-example.properties or file:///etc/tomcat/sso-example.properties |
sso.example.api.url | Trivore ID Management API URL | https://{your-id-server}/api/rest/v1 |
sso.example.api.clientId | Trivore ID Management API client ID | 5892346374634783124 |
sso.example.api.clientSecret | Trivore ID Management API client secret | Fjw526789fsAHf1j23TH312g3u |
sso.example.configLocation can be defined as (in order of preference) the environment
variable SSO_EXAMPLE_CONFIG_LOCATION, a Java system property using the -D argument, or a
context init parameter in web.xml. Other properties can be defined as (in order of
preference) a Java system property, a properties file defined by sso.example.configLocation,
or a context init parameter in web.xml. The preferred way to define these properties for
Apache Tomcat on Linux is to edit /etc/tomcat/tomcat.conf and add a new line at the end:
SSO_EXAMPLE_CONFIG_LOCATION=/etc/tomcat/sso-example.properties
and then create the /etc/tomcat/sso-example.properties file with content such as:
sso.example.api.url=https://{your-id-server}/api/rest/v1
sso.example.api.clientId=5892346374634783124
sso.example.api.clientSecret=Fjw526789fsAHf1j23TH312g3u
OpenID Connect
The source code for the example implementation of an SSO target via OpenID Connect can be downloaded from GitLab.
Use Maven to build this example. The result of the Maven build is a simple .war package that
can be deployed on Apache Tomcat or Eclipse Jetty.
$ mvn clean package
# Resulting .war file is located at target/openid-example-1.0-SNAPSHOT.war
When deploying the .war file to a servlet container, you need to define the following
settings.
| Property name | Description | Example value |
|---|---|---|
openid.example.configLocation | Location of the .properties file that contains settings | classpath:openid-example.properties or file:///etc/tomcat/openid-example.properties |
openid.example.metadataUrl | Trivore ID OpenID Connect metadata URL | https://{your-id-server}/.well-known/openid-configuration |
openid.example.redirectUrl | OpenID Connect redirect URL | https://<example-hostname>/openid-example/callback |
openid.example.clientId | OpenID Connect client ID | 5892346374634783124 |
openid.example.clientSecret | OpenID Connect client secret | Fjw526789fsAHf1j23TH312g3u |
openid.example.scope | OpenID Connect scope parameter value | openid profile |
openid.example.configLocation can be defined as (in order of preference) the environment
variable OPENID_EXAMPLE_CONFIG_LOCATION, a Java system property using the -D argument, or a
context init parameter in web.xml. Other properties can be defined as (in order of
preference) a Java system property, a properties file defined by
openid.example.configLocation, or a context init parameter in web.xml. The preferred way to
define these properties for Apache Tomcat on Linux is to edit /etc/tomcat/tomcat.conf and add
a new line at the end:
OPENID_EXAMPLE_CONFIG_LOCATION=/etc/tomcat/openid-example.properties
and then create the /etc/tomcat/openid-example.properties file with content such as:
openid.example.metadataUrl=https://id-server.example.com/.well-known/openid-configuration
openid.example.redirectUrl=https://my-client.example.com/openid-example/callback
openid.example.clientId=5892346374634783124
openid.example.clientSecret=Fjw526789fsAHf1j23TH312g3u
openid.example.scope=openid profile