JSPWiki-Developers,
I'm in the process of writing a WikiPageProvider to our "eSciDoc" framework
(http://www.escidoc.org/).
To access the storage backend I need credentials which I normally get as a
cookie from a login page. Therefore I also wrote a JAAS login module that does
this login.
Now my question is: How can I transport the credential information from the
JAAS module to the page provider? My idea was to get the WikiEngine from a
WikiEngineCallback and put my credential into a WikiEngine attribute.
Unfortunately I'm not able to get a WikiEngineCallback. When trying this I
always get a javax.security.auth.callback.UnsupportedCallbackException.
My login.config looks like:
eSciDocLogin
{
de.escidoc.auth.jaas.eSciDocWebContainerLoginModule required
eSciDocURL="http://localhost:8080/"
debug=true;
};
The method login() from the LoginModule does the following:
public boolean login() throws LoginException {
println("login called");
loginOk = false;
NameCallback namecallback = new NameCallback("user name");
PasswordCallback passwordcallback = new PasswordCallback("password",
false);
WikiEngineCallback wikicallback = new WikiEngineCallback();
try {
handler.handle(new Callback[] {namecallback, passwordcallback,
wikicallback});
userName = namecallback.getName();
String password = new String(passwordcallback.getPassword());
try {
println("try to login user \"" + userName + "\"");
eSciDocLoginHandler handler = new
eSciDocLoginHandler((String)options.get(PROP_URL), userName, password);
println("store handle: " + handler.getSecurityHandle());
wikicallback.getEngine().setAttribute(ATTR_ESCIDOC_HANDLE,
handler.getSecurityHandle());
handler.logout();
println("login successful");
loginOk = true;
}
catch (Exception e) {
println("login failed: " + e.toString());
throw new FailedLoginException(e.toString());
}
}
catch (IOException e) {
println("login failed: " + e.toString());
throw new LoginException(e.toString());
}
catch (UnsupportedCallbackException e) {
println("login failed: " + e.toString());
throw new LoginException("Error: " + e.getCallback().toString() +
" not available to garner authentication information " + "from the user");
}
return loginOk;
}
Could someone please give me a hint what the problem could be?
Thanks in advance!
Best regards,
André
-------------------------------------------------------
Fachinformationszentrum Karlsruhe, Gesellschaft für wissenschaftlich-technische
Information mbH.
Sitz der Gesellschaft: Eggenstein-Leopoldshafen, Amtsgericht Mannheim HRB
101892.
Geschäftsführerin: Sabine Brünger-Weilandt.
Vorsitzender des Aufsichtsrats: MinR Hermann Riehl.