• 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

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]
 
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
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic