Focal Point
[Solved]How to retrieve MRE user ID from a jsp page?

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/4827080916

April 16, 2012, 12:59 PM
bug
[Solved]How to retrieve MRE user ID from a jsp page?
I'd like to automate some jobs that requires some jsp coding. Is there a way to retrieve the MRE user ID (&IBIMR_User in webfocus) in JSP?

I know I can pass it through a form or URL from a webfocus page, but that doesn't seem secure enough. Is there a server variable (Tomcat) that can do this?

Thanks.

This message has been edited. Last edited by: bug,


7.66 and 7.704
System: Windows / AIX / Linux
Output: Mostly HTML, with some PDF, Excel and Lotus(!)
April 16, 2012, 05:51 PM
Waz
If you have already logged into MRE or dashboard, there will be a cookie that will have it.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

April 17, 2012, 02:13 PM
bug
I tried the cookie way, found 3 cookies. But they are long string of numbers. Seems they've been encrypted.


7.66 and 7.704
System: Windows / AIX / Linux
Output: Mostly HTML, with some PDF, Excel and Lotus(!)
April 17, 2012, 02:22 PM
<JG>
quote:
Current: webfocus 5.3->7.66

Big Move.

latest status might help find a solution.
April 17, 2012, 03:30 PM
bug
Oh that was an old status. We started using 7.66 a while ago. Can you please elaborate?


7.66 and 7.704
System: Windows / AIX / Linux
Output: Mostly HTML, with some PDF, Excel and Lotus(!)
April 17, 2012, 06:39 PM
Waz
quote:
But they are long string of numbers. Seems they've been encrypted


There is a javascript library called ibicookie.js.

This exists in ibi_html/javaassist/ibi/html/js.

This should be able to decode the cookie and get the user.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

April 18, 2012, 03:58 PM
bug
quote:
Originally posted by Waz:

There is a javascript library called ibicookie.js.

This exists in ibi_html/javaassist/ibi/html/js.


ibicookie.js does not provide an API to decrypt the WF_COOKIE information. However, I have found the java API from here:

/ibi_html/javadoc/wfapi/ibi/webfoc/wfsecurity/WFCredentials.html#method_summary

It seems that's the way to go. Just need sometime to pickup the jsp syntax I've forgotten a while ago.


7.66 and 7.704
System: Windows / AIX / Linux
Output: Mostly HTML, with some PDF, Excel and Lotus(!)
April 22, 2012, 05:49 PM
Waz
Sorry for leading you down the garden path. Seems I was remembering Maintains cookie encrypt/decrypt.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

April 07, 2014, 11:00 AM
Francis Mariani
So, there's no JavaScript way of retrieving a value from the encrypted MRE cookie?

You have to write and compile a Java program?

I have a case open with Tech Support. They claim

quote:
IBIMR_user is one of the values in the MR cookie.
It is not really encrypted. It is encoded in base64 and there are functions you can call to decode it from Javascipt


Well, I tried several JavaScript functions found on the web and none of them decrypt the MR cookie string to something recognizable.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
April 07, 2014, 11:50 PM
bug
quote:
Originally posted by Francis Mariani:
So, there's no JavaScript way of retrieving a value from the encrypted MRE cookie?

You have to write and compile a Java program?

I have a case open with Tech Support. They claim

quote:
IBIMR_user is one of the values in the MR cookie.
It is not really encrypted. It is encoded in base64 and there are functions you can call to decode it from Javascipt


Well, I tried several JavaScript functions found on the web and none of them decrypt the MR cookie string to something recognizable.



Francis, I opened a case back in 2012 too. But the kid answered my case was not aware that they had such a java library at all.

Anyway I abandoned the case after a few helpless calls. Then a few months later I found this code buried in some old reports:

-SET &UID=EDIT(GETUSER(USERID),'9999999$$$$$');

It worked for me. Hope this helps...


7.66 and 7.704
System: Windows / AIX / Linux
Output: Mostly HTML, with some PDF, Excel and Lotus(!)
April 08, 2014, 10:12 AM
dhagen
For the record: In JSP you would have to get the cookie value, decrypt it then tokenize it to get the MR user id.
April 08, 2014, 11:10 AM
Francis Mariani
dhagen, what about in an HTML file? It appears I cannot use JavaScript to decrypt the cookie value - I get different results from three different base 64 decryption functions...

bug, I can't use -SET &UID=EDIT(GETUSER(USERID),'9999999$$$$$'); - I have an HTML file, not a fex.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
April 08, 2014, 06:30 PM
Waz
Francis, you may have to use xmlhttp functionality to call a fex and get the user from the HTML page. You could have it as part of the onload event of th page.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

April 09, 2014, 01:47 AM
dhagen
quote:
Originally posted by Francis Mariani:
dhagen, what about in an HTML file? It appears I cannot use JavaScript to decrypt the cookie value - I get different results from three different base 64 decryption functions...

bug, I can't use -SET &UID=EDIT(GETUSER(USERID),'9999999$$$$$'); - I have an HTML file, not a fex.


The decrypt is implemented in the web app, and cannot be extended to JS. You would have to do what Waz suggested.


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
April 09, 2014, 10:43 AM
Francis Mariani
Two problems:

1) The JS solution is what IBI Tech Support suggested I use Frowner
2) I don't want to add another fex to an HTML Composer web page - it performs poorly in our cluster environment - nine different fexes to populate controls seems to choke the cluster server Frowner


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
April 09, 2014, 05:24 PM
Waz
Francis,

IF IBI Tech Support suggests a JS solution and you can't get it to work, ask them to give you a working example.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!