This is a sample minimal implementation of the service provider integration as downloaded from https://web-sandbox.perftest.verimi.tech/sdk/html/example.html on 2018-06-08T13:00:00+03:00. It demonstrates the following flow:
- Redirects to the authorization server in order to login.
- Replies with the authorization
code
- Web server then uses the authorization
code
in aPOST
token request and receives theaccess_token
. - Decodes the
access_token
content (not working with current sandbox environment) - Retrieves the user baskets containing user information and prints them to log. (not working with current sandbox environment)
Verimi offers two (2) environments for testing:
Sandbox environment offers only the ability to login and get an access_token
. You cannot perform anything else there. Sandbox environment is freely accessible. You can find documentation about it here.
This is a testing environment which offers the complete functionality as described in the Verimi API documentation. This environment is not publicly accessible. In order to be granted access to the API you need to contact Verimi who will provide you with:
- A personal client certificate which is a
.p12
file with a private key. - A
client_id
. - A
client_secret
. - The redirect urls you and Verimi have agreed for testing. For example if your server resides in
http://localhost:8000
and inhttps://mysite.com
you have to inform Verimi explicitly about this information in order to whitelist these URLs.
By acquiring the aforementioned information, you can register a new account in https://verimi-uat.coretransform.com/login. You can use whatever email you want as the email will be sent to a Mailhog test mail server located in: https://sp-verimi-uat.coretransform.com/mailhog.
- JDK 1.8 installed
- Apache Maven or an IDE which supports Maven , such as Eclipse Spring Tool Suite, IntelliJ IDEA, Netbeans.
In order to run this sample Spring Boot application using Verimi Sandbox environment you have to proceed to the following steps:
-
Edit
src/main/resources/application.properties
with a configuration like the followingserver.port: 9000 oauth.api_environment=sandbox oauth.redirect_uri=http://localhost:9000/authorization/code?parameter=dummy1 oauth.client_id=ACME oauth.client_secret=G|41|0an18ZIs_w # SANDBOX ENVIRONMENT oauth.authorization_server_protocol=https oauth.authorization_server_host=verimi.com oauth.authorization_server_port=443/dipp/api keyStore.location= keyStore.password= logging.level.com.dipp=DEBUG
-
Run :
- From a shell:
mvn spring-boot:run
in order to compile and execute the application. - Run the
SpringBootWebApplication
class from your favourite IDE.
- From a shell:
If everything is OK, then proceed to the next section.
In order to run this sample Spring Boot application using Verimi UAT - User Acceptance Testing environment you have to proceed to the following steps:
-
Edit
src/main/resources/application.properties
with a configuration like the followingserver.port: 9000 # This property accepts 2 values: "uat" or "sandbox". Default: "sandbox" oauth.api_environment=uat oauth.redirect_uri=http://localhost:9000/authorization/code?parameter=dummy1 oauth.client_id=clientIdVerimiGaveYou oauth.client_secret=clientSecretVerimiGaveYou # UAT ENVIRONMENT oauth.authorization_server_protocol=https oauth.authorization_server_host=verimi-uat.coretransform.com oauth.authorization_server_port=443/dipp/api ### Keystore keyStore.location=/home/sbobos/verimi-sdk-spring-boot/verimi-client-cert.p12 keyStore.password=mysuperpassword logging.level.com.dipp=DEBUG
- Run :
- From a shell:
mvn spring-boot:run
in order to compile and execute the application. - Run the
SpringBootWebApplication
class from your favourite IDE.
- From a shell:
If everything is OK, then proceed to the next section.
The application will load on localhost on port 9000 by default (you can configure a different port in the src/main/resources/application.properties
. Open a browser on http://localhost:9000 and press the "Login with Verimi" button to proceed.
In the UAT environment if everything works as expected you will be able to retrieve baskets, i.e. user information. This information will be logged in logs and is going to look like the following:
2018-06-19 10:56:21.505 INFO 1420 --- [io-8080-exec-10] com.dipp.WelcomeController : Basket Response:{"basketId":"50ae7281-258a-4d4d-aa74-7434b80da157","serviceProviderId":"bobos","dataScopes":[{"scopeId":"email","data":[{"name":"email","value":"[email protected]"},{"name":"standard","value":"true"},{"name":"verified","value":"true"},{"name":"contact","value":"true"},{"name":"id","value":"3a2b46aa-5065-327d-9a52-47175ee06b94"}]},{"scopeId":"name","data":[{"name":"firstName","value":"John"},{"name":"lastName","value":"Longjohn"},{"name":"title","value":"mr"},{"name":"academicTitle","value":""},{"name":"verified","value":"false"},{"name":"id","value":"b2de28ac-ec23-db6e-1863-300013a7af24"}]}]}