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!

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

There are example Java projects which utilises 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 nameDescriptionExample value
sso.example.configLocationLocation of .properties file that contains settingsclasspath:sso-example.properties
file:///etc/tomcat/sso-example.properties
sso.example.api.urlonePortal Management API URLhttps://fi.trivoreid.com/api/rest/v1
sso.example.api.clientIdonePortal Management API clientId5892346374634783124
sso.example.api.clientSecretonePortal Management API clientSecretFjw526789fsAHf1j23TH312g3u

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.

$ 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 nameDescriptionExample value
openid.example.configLocationLocation of .properties file that contains settingsclasspath:openid-example.properties
file:///etc/tomcat/openid-example.properties
openid.example.metadataUrlonePortal OpenID metadata urlhttps://fi.trivoreid.com/.well-known/openid-configuration
openid.example.redirectUrlOpenID Connect redirect URLhttps://<example-hostname>/openid-example/callback
openid.example.clientIdonePortal Management API clientID5892346374634783124
openid.example.clientSecretonePortal Management API clientSecretFjw526789fsAHf1j23TH312g3u
openid.example.scopeOpenID scope parameter valueopenid 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

OPENID_EXAMPLE_CONFIG_LOCATION=/etc/tomcat/openid-example.properties

and then creating the /etc/tomcat/openid-example.properties file with content such as

openid.example.metadataUrl=https://<oneportal-hostname>/.well-known/openid-configuration
openid.example.redirectUrl=https://<example-hostname>/openid-example/callback
openid.example.clientId=5892346374634783124
openid.example.clientSecret=Fjw526789fsAHf1j23TH312g3u
openid.example.scope=openid profile
  • No labels