use of org.apache.wss4j.common.kerberos.KerberosContextAndServiceNameCallback in project cxf by apache.
the class KerberosServicePasswordCallback method handle.
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) {
if (callbacks[i] instanceof WSPasswordCallback) {
super.handle(new Callback[] { callbacks[i] });
} else if (callbacks[i] instanceof KerberosContextAndServiceNameCallback) {
KerberosContextAndServiceNameCallback pc = (KerberosContextAndServiceNameCallback) callbacks[i];
pc.setContextName("bob");
pc.setServiceName("bob@service.ws.apache.org");
} else if (callbacks[i] instanceof NameCallback) {
NameCallback nameCallback = (NameCallback) callbacks[i];
nameCallback.setName("bob");
} else if (callbacks[i] instanceof PasswordCallback) {
PasswordCallback passwordCallback = (PasswordCallback) callbacks[i];
passwordCallback.setPassword("bob".toCharArray());
}
}
}
Aggregations