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!
Client SDK for Java
ermalink: https://doc.oneportal.fi/x/IYCs
Maven Dependency
There are two versions of Client SDK for Java - core and extension. Core covers REST API requests for users, profile, groups, namespases and data storages, and also allows user to send e-mail and SMS messages. The rest of the APIs are covered in extension client.
To start using core version add:
<dependency> <groupId>com.trivore</groupId> <artifactId>trivoreid-sdk</artifactId> <version>2.1.0</version> </dependency>
For an extension client use:
<dependency> <groupId>com.trivore</groupId> <artifactId>trivoreid-sdk-extension</artifactId> <version>1.0.0</version> </dependency>
How to start
There are two ways to start: using Management API or OpenID credentials.
Configurations for both can be defined in the configuration file or straight in the function.
Properties file
All credentials will be taken from the properties file. The default path is: /etc/trivoreid/client_sdk.properties.
# Please, replace with proper values to authorize access to the service. # Must be defined for all types of authorization service.address=<placeholder> # For the OAuth2 or Password Grant oidc.client.id=<placeholder> oidc.client.secret=<placeholder> # OAuth2 oidc.client.redirect.uri=<placeholder> # Management API mgmtapi.id=<placeholder> mgmtapi.secret=<placeholder> # Password Grant password.grant.username=<placeholder> password.grant.password=<placeholder> # default path name # /etc/TrivoreID/client_sdk.properties
Management API
service.address=<placeholder> mgmtapi.id=<placeholder> mgmtapi.secret=<placeholder>
TrivoreID sdk = new TrivoreID();
Password Grant
NB! It is strongly recommended to avoid using Password Grant due to security reasons.
Password grant is disabled for the OIDS Client by default. Ask administrator to enable it in order to use.
service.address=<placeholder> oidc.client.id=<placeholder> oidc.client.secret=<placeholder> password.grant.username=<placeholder> password.grant.password=<placeholder>
TrivoreID sdk = TrivoreID.openIdClient(); // Get the authenticated user info OidcUser oidcUser = sdk.getOidcUser();