Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

How to use JAR files and call Java functions on the client side from React  RSS feed

 
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my company, we have a standard SingleSignOn site that all apps must call (and provide a callback to your app) to validate users. In order to decrypt the cookie returned from the SSO, the implementors provided 2 JAR files, assuming that everyone would be using Java or JSP or the like. There is no JavaScript based sample code (and no method that they know of to do it - I asked) provided by the implementors. They provide Java, Perl, PHP, others, but no JavaScript-based method. How can I include these JAR files in my React-based application and subsequently call the Java functions for cookie decryption included in those JARs?? Thanks!
 
Saloon Keeper
Posts: 9118
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have two options. Either you create a service that exposes the library's functions as a web API that you can call through AJAX, or you write your own JavaScript port of the Java libraries.

If the site uses a well known protocol such as OAuth, WS-Fed or SAML, you might want to look for a third party JavaScript library instead.
 
Lanny Gilbert
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think writing my own JS version of the JAR file code is probably a security violation (I work for a big company - pretty much any tweaking of standard tools provided is considering a violation). Also, these JAR files are compatible with Java1.4, so they don't have OAuth, WS-Fed or SAML protocols built in. I'd kinda hoped for a "there's a library on GitHub that I use all the time and works perfect" response )
I'll look at building a service that my app can call. Thanks!
 
Stephan van Hulst
Saloon Keeper
Posts: 9118
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OAuth, WS-Fed and SAML aren't related to Java versions. I'm sure there are libraries that are compatible with older versions of Java that support these protocols just fine.

Well, we can't really suggest any libraries if we don't know what single sign on site you're talking about, or even what protocol it uses.
 
Stephan van Hulst
Saloon Keeper
Posts: 9118
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you work for a big company, I suggest you take it up with your manager and see if they can sort something out with the developers of the original libraries. If they have ports for various languages, they may make one for JavaScript as well.
 
Lanny Gilbert
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"If they have ports for various languages, they may make one for JavaScript as well.".. I asked, they won't.

Also, these JARs are all hand-rolled from many moons ago and I haven't run a Java Decompiler on them, so not sure exactly what's in there.

I'll look into building a service my React App can call. That's probably my easiest way out of this.

Thanks!
 
Author and ninkuma
Marshal
Posts: 66783
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Lanny Gilbert wrote:I'll look into building a service my React App can call. That's probably my easiest way out of this.


I think you are correct. I've had to do this myself a number of times (for different features, but the same reason).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!