• 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 ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Single SignOn (Again)

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

I have an application that requires users to sign on. I would like to access JForum without users having to sign on again. I tried to follow the guide at the following location: https://coderanch.com/t/574564 .

So I made all the code changes, and after I add the UserSession to the SessionFacade, i try to print out the values. When I run the code, it produces a null pointer exception, at the following statement:

So it seems like my session was not updated.

So my code looks like this:


This is all done in JForum.java, right under the "this.checkCookies()" call. I've also added the configureThreadLocal method, but I'm not sure from where it gets called. Also, at the
statement, which session do I assign? "tmpUs" or "us"?

I've only been using Java for 6 months, so please feel free to point and laugh at the obvious mistakes!

Thanks,
Pieter
[originally posted on jforum.net by Anonymous]
 
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
Woha!! Pieter is alive

So Pieter, the problem with your code is that you set a "dummy" session ID, but SessionFacade.getUserSession() makes a call to JForum.getRequest().getSession().getId(), that must probably has a different session id.

You can try using the method getUserSession(String sessionId) .

Rafael
[originally posted on jforum.net by Rafael Steil]
 
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
Hey Rafael, I think your confusing me with my namesake, Pieter, who wrote the original code for Single Sign-On!

Anyway, your suggestion, along with some other code changes from my part, worked like a charm! Thank you!

Pieter S
[originally posted on jforum.net by Anonymous]
 
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
Pieter, can you please post your final solution here. It would help me out a ton. I'm trying to do the same thing but also can't figure out where configureThreadLocal gets called from. Thanks so much in advance.
[originally posted on jforum.net by rzavi4jc]
 
Please do not shoot the fish in this barrel. But you can shoot at this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic