[jboss-user] [Security] - Cannot use custom CallbackHandler with LoginContext

mwx.dennis do-not-reply at jboss.com
Thu Nov 5 12:07:20 EST 2009

I'm connecting to a JBoss 5.1.0.GA from a standalone client. I use a custom LoginModule. This is my client side security config:
admin-securitydomain {
  | 	org.jboss.security.ClientLoginModule required;
  | };

This is my client side login code:
  | URL authenticationConfigURL = getClass().getResource(AUTH_PROP_CONFIG_FILENAME);
  | System.setProperty(AUTH_PROP_KEY, authenticationConfigURL.toExternalForm());
  | LoginCallbackHandler callbackHandler = new LoginCallbackHandler(username, password, Role.ADMINISTRATOR, Market.de);
  | LoginContext loginContext = new LoginContext(SECURITY_DOMAIN, callbackHandler);
  | loginContext.login();

I'd like to use my own CallbackHandler but it doesn't work as expected - the CallbackHandler that is passed into the LoginModule is of type javax.security.auth.login.LoginContext$SecureCallbackHandler.

As a consequence, when I try to login, I get a
javax.security.auth.callback.UnsupportedCallbackException: Unrecognized Callback
  | at org.jboss.security.auth.callback.JBossCallbackHandler.handle(JBossCallbackHandler.java:126)
  | at javax.security.auth.login.LoginContext$SecureCallbackHandler$1.run(LoginContext.java:955)
  | ...
Any ideas how I can fix this?

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4264173#4264173

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4264173

More information about the jboss-user mailing list