Search in sources :

Example 61 with WSPasswordCallback

use of org.apache.wss4j.common.ext.WSPasswordCallback in project tesb-rt-se by Talend.

the class WSPasswordCallbackHandlerTest method handleEncryptedPasswordTest.

@Ignore
public void handleEncryptedPasswordTest() throws Exception {
    String username = "username";
    String password = PropertyValueEncryptionUtils.encrypt("password", getEncryptor());
    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]));
}
Also used : WSPasswordCallbackHandler(org.talend.esb.security.saml.WSPasswordCallbackHandler) WSPasswordCallback(org.apache.wss4j.common.ext.WSPasswordCallback) Callback(javax.security.auth.callback.Callback) ArrayList(java.util.ArrayList) WSPasswordCallback(org.apache.wss4j.common.ext.WSPasswordCallback) Ignore(org.junit.Ignore)

Example 62 with WSPasswordCallback

use of org.apache.wss4j.common.ext.WSPasswordCallback in project tesb-rt-se by Talend.

the class WSPasswordCallbackHandlerTest method handleNoUserTest.

@Test
public void handleNoUserTest() throws Exception {
    String username = null;
    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]));
}
Also used : WSPasswordCallbackHandler(org.talend.esb.security.saml.WSPasswordCallbackHandler) WSPasswordCallback(org.apache.wss4j.common.ext.WSPasswordCallback) Callback(javax.security.auth.callback.Callback) ArrayList(java.util.ArrayList) WSPasswordCallback(org.apache.wss4j.common.ext.WSPasswordCallback) Test(org.junit.Test)

Example 63 with WSPasswordCallback

use of org.apache.wss4j.common.ext.WSPasswordCallback in project tesb-rt-se by Talend.

the class PasswordCallbackHandlerTest method testPasswordCallbackHandlerNotCorrectIdentifier.

@Test
public void testPasswordCallbackHandlerNotCorrectIdentifier() throws Exception {
    PasswordCallbackHandler handler = new PasswordCallbackHandler();
    List<Callback> callbacksList = new ArrayList<Callback>();
    WSPasswordCallback callback = new WSPasswordCallback("id", 0);
    callback.setIdentifier("notMystskey");
    callbacksList.add(callback);
    handler.handle(callbacksList.toArray(new Callback[callbacksList.size()]));
    Assert.assertNull(callback.getPassword());
}
Also used : WSPasswordCallback(org.apache.wss4j.common.ext.WSPasswordCallback) Callback(javax.security.auth.callback.Callback) ArrayList(java.util.ArrayList) WSPasswordCallback(org.apache.wss4j.common.ext.WSPasswordCallback) Test(org.junit.Test)

Example 64 with WSPasswordCallback

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());
}
Also used : WSPasswordCallback(org.apache.wss4j.common.ext.WSPasswordCallback) Callback(javax.security.auth.callback.Callback) ArrayList(java.util.ArrayList) WSPasswordCallback(org.apache.wss4j.common.ext.WSPasswordCallback) Test(org.junit.Test)

Example 65 with WSPasswordCallback

use of org.apache.wss4j.common.ext.WSPasswordCallback in project tesb-rt-se by Talend.

the class PasswordCallbackHandlerTest method testPasswordCallbackHandlerNotCorrectIdentifier.

@Test
public void testPasswordCallbackHandlerNotCorrectIdentifier() throws Exception {
    PasswordCallbackHandler handler = new PasswordCallbackHandler();
    List<Callback> callbacksList = new ArrayList<Callback>();
    WSPasswordCallback callback = new WSPasswordCallback("id", 0);
    callback.setIdentifier("notMystskey");
    callbacksList.add(callback);
    handler.handle(callbacksList.toArray(new Callback[callbacksList.size()]));
    Assert.assertNull(callback.getPassword());
}
Also used : WSPasswordCallback(org.apache.wss4j.common.ext.WSPasswordCallback) Callback(javax.security.auth.callback.Callback) ArrayList(java.util.ArrayList) WSPasswordCallback(org.apache.wss4j.common.ext.WSPasswordCallback) Test(org.junit.Test)

Aggregations

WSPasswordCallback (org.apache.wss4j.common.ext.WSPasswordCallback)69 Callback (javax.security.auth.callback.Callback)22 CallbackHandler (javax.security.auth.callback.CallbackHandler)20 IOException (java.io.IOException)17 UnsupportedCallbackException (javax.security.auth.callback.UnsupportedCallbackException)14 WSSecurityException (org.apache.wss4j.common.ext.WSSecurityException)11 ArrayList (java.util.ArrayList)8 HashMap (java.util.HashMap)8 WSS4JOutInterceptor (org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor)8 QName (javax.xml.namespace.QName)7 Endpoint (org.apache.cxf.endpoint.Endpoint)7 Test (org.junit.Test)7 URL (java.net.URL)6 Service (javax.xml.ws.Service)6 SAAJOutInterceptor (org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor)6 Client (org.apache.cxf.endpoint.Client)6 Crypto (org.apache.wss4j.common.crypto.Crypto)6 PrivateKey (java.security.PrivateKey)3 X509Certificate (java.security.cert.X509Certificate)3 DestroyFailedException (javax.security.auth.DestroyFailedException)3