On 09/13/2012 02:55 PM, echocoder wrote:
My instance of Xwiki is using custom authentication.
I have a new
requirement to add Yubikey based authentication now. I believe in order to
pull it off, I need to set a session attribute in the Xwiki context with a
value defined in a JSP file.
I tried to set it in the current HTTP session, with the code below but it is
not showing up in the Xwiki context session when the checkAuth method is
called
...
session.setAttribute("okc_sso_username", username);
...
public XWikiUser checkAuth(XWikiContext context) throws XWikiException
{
....
String okc_sso_username =
(String)context.getRequest().getSession().getAttribute("okc_sso_username");
....
}
Any idea on how to bind the two to make a JSP session variable available in
the XwikiContext?
Well, a session is usually valid inside one application. Since XWiki
doesn't use JSP, I'm assuming that the JSP file is either in a different
application, or you added a custom page to the XWiki webapp. Are you
sure the two contexts share the same session?
If you added the file to XWiki, then the session should be the same.
Make sure you're using the right API calls to get to the session object.
If you have two distinct applications, you could configure your
container to use server-wide sessions.
--
Sergiu Dumitriu
http://purl.org/net/sergiu/