On Mar 25, 2009, at 6:21 AM, dojolava wrote:
What I actually want to do, is to authenticate a client by a
specific client
ID. I thought to use a custom CallbackHandler that access my
configuration
files to read this securityString and check it against a prefix in the
username. E.g
@Override
public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException {
username = MyClientAuthenticator.authenticate(username);
for (int i = 0; i < callbacks.length; i++) {
...
}
}
Does anybody know how to achive this?
I'm not sure I understand exactly. Some details on what you mean by
check it against a prefix would be great. We have a couple points on
the client and server where some indirection can be added, but I'm not
sure what to recommend if any.
In terms of just standard JAAS LoginModules, you should be able to
specify your CallbackHandler like so:
URL resource = classLoader.getResource("client.login.conf");
System.setProperty("java.security.auth.login.config",
resource.toExternalForm());
LoginContext lc = new LoginContext("ClientLogin", new
MyCallbackHandler());
-David