[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: java api bind() methods
"Kurt D. Zeilenga" wrote:
>
> At 03:15 PM 4/4/01 -0700, Rob Weltman wrote:
> >"Kurt D. Zeilenga" wrote:
> >> If the application wants to do a DIGEST-MD5 authentication with
> >> an bind name of "cn=john" and a SASL authentication identity of
> >> "mary", the LDAP API should provide facilities to accomplish.
> >> If this is not possible with the current LDAP API then the API
> >> is flawed.
> >
> > That is supported.
>
> It's not obvious to me how to do it. An example would
> do wonders.
>
> Kurt
class MarysCallbackHandler implements CallbackHandler {
public void handle(Callback[] callbacks)
throws IOException, UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) {
if (callbacks[i] instanceof NameCallback) {
NameCallback nc = (NameCallback)callbacks[i];
nc.setName( "mary" );
} else if (callbacks[i] instanceof PasswordCallback) {
...
}
}
}
}
...
...
ldc.bind( "cn=john",
new String[] {"DIGEST-MD5"},
null,
new MarysCallbackHandler() );
For how to use callback handlers and callbacks, see http://java.sun.com/security/jaas/doc/api.html#CallbackHandler.
Rob