loadReport using token

Kai Asmussen shared this question 3 years ago
Answered

It seems that token is not one of the options that can be used for yellowfin.loadReport({options);


Is there a way to achieve this?


Thanks in advance!

Comments (4)

photo
1

Hello Kai,


Please have a look at the following code:


String filePath = request.getServletContext().getRealPath("./integrationconfig.json");


FileReader reader = new FileReader(filePath);


JSONParser jsonParser = new JSONParser();


JSONObject jsonObject = (JSONObject) jsonParser.parse(reader);


String username = (String) jsonObject.get("username");


String password = (String) jsonObject.get("password");


String host = (String) jsonObject.get("hostname");


Integer port = Integer.parseInt((String) jsonObject.get("port"));


String path = "/services/AdministrationService";


AdministrationServiceResponse rs = null;


AdministrationServiceRequest rsr = new AdministrationServiceRequest();


AdministrationServiceService ts = new AdministrationServiceServiceLocator(host, port, path, false);


AdministrationServiceSoapBindingStub rssbs = (AdministrationServiceSoapBindingStub) ts.getAdministrationService();


rsr.setLoginId(username);


rsr.setPassword(password);


rsr.setOrgId(new Integer(1));


rsr.setFunction("LOGINUSER");


AdministrationPerson ap = new AdministrationPerson();


ap.setUserId(username);


ap.setPassword(password);


rsr.setPerson(ap);


rs = rssbs.remoteAdministrationCall(rsr);


if ("SUCCESS".equals(rs.getStatusCode()) ) {


String url = "http://"; + host + ":" + port + "/logon.i4?LoginWebserviceId=" + rs.getLoginSessionId();


if (request.getParameter("redirect")!=null) {


response.sendRedirect(url);


} else {


out.write("Successfully used Single sign on ..");


out.write("<BR>URL: <A href='" + url + "'>");


out.write(url + "</a>");


}


} else {


out.write("Failed to single sign on the user");


}


[


this is the bit that generates the token so then you can load whatever reports you need


if (request.getParameter("redirect")!=null) {


response.sendRedirect(url);

}


I hope that this is of help!


Best regards,

Pete

photo
1

Hello Pete,


thanks for the reply! I am able to generate the token (using Java). After that I want to use for example the javascript API to run a report with specific parameters. In your example I do not see for example the option to pass a User filter (like fe Supplier Number). Is that possible?

Best regards,

Kai

photo
1

Hello Peter,

Thanks for your suggestion. That is the way I managed to redirect an url including a token. This results in opening Yellowfin without having to enter a password (Single Signon). Only then it is (to my knowledge) not possible to run a specific report with parameters/filters that also might change and need to be included when starting up the report.

Javascript enables the use of parameters/filters (included an example I used to pass filter values) only it seems not possible to include a token. So a user needs to be logged in already to run the report this way.

Is it possible to combine dynamic filters with single signon? The part under “Option 4: Embed Reports using Javascript integration” mentions “Single-sign is only possible with Yellowfin 6 + builds”. We are on 6.3.

Thanks in advance, kind regards,

Kai

From: Yellowfin Support Team [mailto:community@yellowfin.bi]

Sent: Monday, October 17, 2016 4:25 PM

To: Kai Asmussen

Subject: Status is Updated

photo
1

Hello Kai,


Sorry for the delay!


inside this if if statement:

if (request.getParameter("redirect")!=null) {

response.sendRedirect(url);

}


you can then use the information from the wiki:

http://wiki.yellowfin.com.au/display/USER72/Advanced+Use#AdvancedUse-LoadingaReport


to allow you to load a report and use custom filters.


I hope this helps!

Best regards,

Pete