Can't have multiple visualize.js sessions when using authentication token

0

We are using visualize.js to embed jasper report. When trying to use pre-authentication token for login in, first we ran into problem that refreshing page does not work. By adding logout on event beforeunload, refreshing works now (http://community.jaspersoft.com/questions/851277/sso-pre-auth-visualize). (BTW, this is not ideal way)

However if I open the report page in another tab, the new tab would not work due to authentication error until the jasper session expires. 

I traced the problem to REST api call to http://bjil01:8180/jasperserver-pro/?pp=xxxx. When the api call returns 302, it's treated as authentication success, and when the api return 200, it's treated as authentication failure. Shouldn't http code 200 be treated as user already logged in and thus allow report being shown? 401 is the code to indicate authentication error.

 

bixia.ji's picture
Joined: Aug 27 2015 - 11:50am
Last seen: 2 years 2 days ago

1 Answer:

3
I tried to update the file jasperserver-pro/scripts/bower_components/js-sdk/src/common/auth/Authentication.js to handle 200 as success, adding the following code:
 
                    if (a === "success" && b.status == 200) {
                        result = {success: true};
                        dfd.resolve(result);
                        return dfd;
                    }
after line 60
                if(typeof response === "string"){
Multiple tabs work with the change now.
With this change, page refresh would also work without adding logout step following http://community.jaspersoft.com/questions/851277/sso-pre-auth-visualize
bixia.ji's picture
Joined: Aug 27 2015 - 11:50am
Last seen: 2 years 2 days ago
Feedback