• 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:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Creating new users dynamically

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

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.

Thanks

Martin O'Shea.
[originally posted on jforum.net by MartinOShea]
 
Migrated From Jforum.net
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:

http://www.jforum.net/posts/list/15/4414.page#18206

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]
 
So I left, I came home, and I ate some pie. And then I read this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!