Access to this demo API on behalf of end user requires a dedicated token obtained through token exchange. An ID-token obtained from ID-porten is exchanged for an access token to this particular API, on behalf of the logged in user.
See README from pam-tsbx-front for guide to complete local setup.
This app uses the token-support
project to do REST endpoint protection
and access token validation, more specifically the token-validation-spring
library.
Run as Spring Boot application with DevApplication
as main class.
Use the following command to start the Spring Boot app from Maven on the command line:
mvn -Pdev
An OAuth2 server is required to run alongside the application locally. When
using either of the the above two methods to start app, an embedded mock OAuth2
server is automatically started on port 19111
, if something isn't already
listening on that port.
API is available on http://localhost:9211
It is meant to be called from app pam-tsbx-front
on behalf of end users.
Integration test MessagesControllerIT
tests the API token validation
using a temporary mock OAuth2 server instance.