Search in sources :

Example 1 with KerberosContextAndServiceNameCallback

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());
        }
    }
}
Also used : NameCallback(javax.security.auth.callback.NameCallback) KerberosContextAndServiceNameCallback(org.apache.wss4j.common.kerberos.KerberosContextAndServiceNameCallback) PasswordCallback(javax.security.auth.callback.PasswordCallback) WSPasswordCallback(org.apache.wss4j.common.ext.WSPasswordCallback) WSPasswordCallback(org.apache.wss4j.common.ext.WSPasswordCallback) KerberosContextAndServiceNameCallback(org.apache.wss4j.common.kerberos.KerberosContextAndServiceNameCallback)

Aggregations

NameCallback (javax.security.auth.callback.NameCallback)1 PasswordCallback (javax.security.auth.callback.PasswordCallback)1 WSPasswordCallback (org.apache.wss4j.common.ext.WSPasswordCallback)1 KerberosContextAndServiceNameCallback (org.apache.wss4j.common.kerberos.KerberosContextAndServiceNameCallback)1