Jump to content
Changes to the Jaspersoft community edition download ×

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


bixia.ji
Go to solution Solved by bixia.ji,

Recommended Posts

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.

 

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Solution
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;
}
[/code]
 

after line 60 

 

                if(typeof response === "string"){[/code]
 

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 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...