use of org.apache.wss4j.common.ext.WSPasswordCallback in project tesb-rt-se by Talend.
the class ServiceKeystorePasswordCallback method handle.
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) {
WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];
String pass = (String) passwords.get(pc.getIdentifier());
if (pass != null) {
pc.setPassword(pass);
return;
}
}
}
use of org.apache.wss4j.common.ext.WSPasswordCallback in project tesb-rt-se by Talend.
the class WSPasswordCallbackHandlerTest method handleNotEncryptedPasswordTest.
@Test
public void handleNotEncryptedPasswordTest() throws Exception {
String username = "username";
String password = "password";
WSPasswordCallbackHandler h = new WSPasswordCallbackHandler(username, password);
Callback c = new WSPasswordCallback(username, 0);
List<Callback> cs = new ArrayList<Callback>();
cs.add(c);
h.handle(cs.toArray(new Callback[0]));
}
use of org.apache.wss4j.common.ext.WSPasswordCallback in project tesb-rt-se by Talend.
the class PasswordCallbackHandlerTest method testPasswordCallbackHandler.
@Test
public void testPasswordCallbackHandler() throws Exception {
PasswordCallbackHandler handler = new PasswordCallbackHandler();
List<Callback> callbacksList = new ArrayList<Callback>();
WSPasswordCallback callback = new WSPasswordCallback("id", 0);
callback.setIdentifier("mystskey");
callbacksList.add(callback);
handler.handle(callbacksList.toArray(new Callback[callbacksList.size()]));
assertSame("stskpass", callback.getPassword());
}
use of org.apache.wss4j.common.ext.WSPasswordCallback in project syncope by apache.
the class SAMLSPCallbackHandler method handle.
@Override
public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException {
for (Callback callback : callbacks) {
if (callback instanceof WSPasswordCallback) {
WSPasswordCallback wspc = (WSPasswordCallback) callback;
wspc.setPassword(keyPass);
}
}
}
use of org.apache.wss4j.common.ext.WSPasswordCallback in project jbossws-cxf by jbossws.
the class KeystorePasswordCallback method handle.
/**
* It attempts to get the password from the private
* alias/passwords map.
*/
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) {
WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];
String pass = passwords.get(pc.getIdentifier());
if (pass != null) {
pc.setPassword(pass);
return;
}
}
}
Aggregations