Bug 353465 - JAASLoginService ignores callbackHandlerClass
This commit is contained in:
parent
f7cc402219
commit
56866b3e68
|
@ -11,6 +11,7 @@ jetty-7.5.0-SNAPSHOT
|
|||
+ 353095 maven-jetty-plugin: PermGen leak due to javax.el.BeanELResolver
|
||||
+ 353165 addJars can follow symbolic link jar files
|
||||
+ 353210 Bundle-Version in o.e.j.o.boot.logback fix
|
||||
+ 353465 JAASLoginService ignores callbackHandlerClass
|
||||
|
||||
jetty-7.4.4.v20110707 July 7th 2011
|
||||
+ 308851 Converted all jetty-client module tests to JUnit 4
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.eclipse.jetty.security.DefaultIdentityService;
|
|||
import org.eclipse.jetty.security.IdentityService;
|
||||
import org.eclipse.jetty.security.LoginService;
|
||||
import org.eclipse.jetty.server.UserIdentity;
|
||||
import org.eclipse.jetty.util.Loader;
|
||||
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
|
||||
|
@ -173,28 +174,38 @@ public class JAASLoginService extends AbstractLifeCycle implements LoginService
|
|||
{
|
||||
try
|
||||
{
|
||||
CallbackHandler callbackHandler = new CallbackHandler()
|
||||
CallbackHandler callbackHandler = null;
|
||||
|
||||
|
||||
if (_callbackHandlerClass == null)
|
||||
{
|
||||
|
||||
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException
|
||||
callbackHandler = new CallbackHandler()
|
||||
{
|
||||
for (Callback callback: callbacks)
|
||||
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException
|
||||
{
|
||||
if (callback instanceof NameCallback)
|
||||
for (Callback callback: callbacks)
|
||||
{
|
||||
((NameCallback)callback).setName(username);
|
||||
}
|
||||
else if (callback instanceof PasswordCallback)
|
||||
{
|
||||
((PasswordCallback)callback).setPassword((char[]) credentials.toString().toCharArray());
|
||||
}
|
||||
else if (callback instanceof ObjectCallback)
|
||||
{
|
||||
((ObjectCallback)callback).setObject(credentials);
|
||||
if (callback instanceof NameCallback)
|
||||
{
|
||||
((NameCallback)callback).setName(username);
|
||||
}
|
||||
else if (callback instanceof PasswordCallback)
|
||||
{
|
||||
((PasswordCallback)callback).setPassword((char[]) credentials.toString().toCharArray());
|
||||
}
|
||||
else if (callback instanceof ObjectCallback)
|
||||
{
|
||||
((ObjectCallback)callback).setObject(credentials);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
Class clazz = Loader.loadClass(getClass(), _callbackHandlerClass);
|
||||
callbackHandler = (CallbackHandler)clazz.newInstance();
|
||||
}
|
||||
//set up the login context
|
||||
//TODO jaspi requires we provide the Configuration parameter
|
||||
Subject subject = new Subject();
|
||||
|
@ -220,6 +231,18 @@ public class JAASLoginService extends AbstractLifeCycle implements LoginService
|
|||
{
|
||||
Log.warn(e);
|
||||
}
|
||||
catch (InstantiationException e)
|
||||
{
|
||||
Log.warn(e);
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
Log.warn(e);
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
Log.warn(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue