Unable to login with Keycloak SSO token using Visualize.js

464 Views Asked by At

I have a requirement to import reports/dashboards from Jasper Server to our web application which is secured by Keycloak. I have struggled a bit to integrate Jasper Server v7.1.0 with Keycloak 2.0.0Final but I am not able to get a Visualize.js session using Keycloak access tokens.

Both applications are registered under the same Keycloak client, therefore a SSO token is theoretically enough to authenticate to both applications (Our app and Jasper Server).

How do we include the token type as bearer in Visualize.js when authenticating?

Something like:

visualize({
server: "http://localhost:8080/jasperserver-pro/",
auth: {
    token: keycloak.token
    headers: {
        Authorization: "Bearer"
    }
}
}, function (v) {
    console.log("LOGGED IN ");
}, function (err) {
    console.log(err.message);
});
1

There are 1 best solutions below

1
On

Use pre-auth mechanism where the service layer should construct a pre-formatted token that should be sent as a part of the header using Visualize.js. JasperReports Server needs to be configured to support this solution.