• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Creating new users dynamically

Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I'm currently integrating JForum into a NetBeans Java servlets / JSP application and I have some questions about the best way to go about creating users 'on the fly' in JForum. This is the first stage of the broader integration I'm looking at.

At the moment I am using JForum as a separate application under Tomcat from its own .war file. My application, from another .war file, calls JForum and can quite happily log a user in; but I have to pre-create that user in JForum manually.

What I'm looking for is to do this automatically from my application so that everything is seamless.

So my question is, is it better to use my own APIs in my application to call SQL insert statements to create data in JForum's own database tables or is it better to use the SSO methods defined in threads like this one:

https://coderanch.com/t/577802 #17831

And if I use the latter, do I need to compile JForum's code into a .jar file so that I can use it as a library in my own application's code?

I would rather avoid having to change JForum's code beyond the need to remove some options from its JSPs .

Any help would be welcome.


Martin O'Shea.
[originally posted on jforum.net by MartinOShea]
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can do what you want in any of the ways you have laid out.

That said, my preference is to do it via the SSO methods and jForum's DAO functions. The advantage here is that all the jForum code stays in the jForum context and this means that the memory repository updates can also be done as needed.

The basic "trick" is to include your own variation of the SSOUtils register method in your SSO's authenticateUser method. Using this you can populate all the jForum user fields with info from your main app.

Take a look at the code in this posting (about line 116) for a simple example:


You might also think about adding a check in for existing users to verify that the main app data is the same. E.g., someone changes a name in the main app and needs it updated in the jforum info.
[originally posted on jforum.net by monroe]
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic