NOTE: Trivore ID Documentation has moved to https://trivoreid.com
The content on this site IS OUT OF DATE!
This space has been archived!
Please go ahead to the new site!
Example source code
There are example Java projects which utilise the Trivore Identity Service's SSO mechanisms. Both mechanisms have their own gitlab repository, from where they can be cloned. 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 example implementation of SSO target via Management API can be downloaded from gitlab.
Use maven to build this example. 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 .properties file that contains settings | classpath:sso-example.properties |
sso.example.api.url | onePortal Management API URL | https://fi.trivoreid.com/api/rest/v1 |
sso.example.api.clientId | onePortal Management API clientId | 5892346374634783124 |
sso.example.api.clientSecret | onePortal Management API clientSecret | Fjw526789fsAHf1j23TH312g3u |
Property sso.example.configLocation
can be defined as (in order of preference) environment variable SSO_EXAMPLE_CONFIG_LOCATION
, Java system property using -D
argument or as context init parameter in web.xml. Other properties can be defined as (in order of preference) Java system property, properties file defined by sso.example.configLocation
or context init parameter in web.xml. Preferred way to define these properties for Apache Tomcat on Linux is to edit /etc/tomcat/tomcat.conf
and add new line at the end
SSO_EXAMPLE_CONFIG_LOCATION=/etc/tomcat/sso-example.properties
and then creating the /etc/tomcat/sso-example.properties
file with content such as
sso.example.api.url=https://<oneportal-hostname>/api/rest/v1
sso.example.api.clientId=5892346374634783124
sso.example.api.clientSecret=Fjw526789fsAHf1j23TH312g3u
OpenID Connect
Source code for example implementation of SSO target via OpenID Connect can be downloaded from gitlab.
Use maven to build this example. Result of the maven build is a simple .war package that can be deployed on Apache Tomcat or Eclipse Jetty.
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 .properties file that contains settings | classpath:openid-example.properties |
openid.example.metadataUrl | onePortal OpenID metadata url | |
openid.example.redirectUrl | OpenID Connect redirect URL | https://<example-hostname>/openid-example/callback |
openid.example.clientId | onePortal Management API clientID | 5892346374634783124 |
openid.example.clientSecret | onePortal Management API clientSecret | Fjw526789fsAHf1j23TH312g3u |
openid.example.scope | OpenID scope parameter value | openid profile |
Property openid.example.configLocation
can be defined as (in order of preference) environment variable OPENID_EXAMPLE_CONFIG_LOCATION
, Java system property using -D
argument or as context init parameter in web.xml. Other properties can be defined as (in order of preference) Java system property, properties file defined by openid.example.configLocation
or context init parameter in web.xml. Preferred way to define these properties for Apache Tomcat on Linux is to edit /etc/tomcat/tomcat.conf
and add new line at the end
and then creating the /etc/tomcat/openid-example.properties
file with content such as