Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Creating new users dynamically

Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • 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: #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 by MartinOShea]
Migrated From
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • 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 by monroe]
I am a man of mystery. Mostly because of this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic