Search in sources :

Example 1 with AliasSelectorKeyManager

use of org.codice.ddf.cxf.client.impl.SecureCxfClientFactoryImpl.AliasSelectorKeyManager in project ddf by codice.

the class SecureCxfClientFactoryTest method testAliasSelectorKeyManager.

@Test
public void testAliasSelectorKeyManager() {
    X509KeyManager keyManager = mock(X509KeyManager.class);
    String alias = "testAlias";
    String[] aliases = new String[] { alias };
    when(keyManager.chooseClientAlias(any(), any(), any())).thenReturn(alias);
    when(keyManager.getClientAliases(any(), any())).thenReturn(aliases);
    AliasSelectorKeyManager aliasSelectorKeyManager = new AliasSelectorKeyManager(keyManager, alias);
    String chosenAlias = aliasSelectorKeyManager.chooseClientAlias(new String[] { "x509" }, null, null);
    assertThat(chosenAlias, is(alias));
}
Also used : AliasSelectorKeyManager(org.codice.ddf.cxf.client.impl.SecureCxfClientFactoryImpl.AliasSelectorKeyManager) X509KeyManager(javax.net.ssl.X509KeyManager) Test(org.junit.Test)

Aggregations

X509KeyManager (javax.net.ssl.X509KeyManager)1 AliasSelectorKeyManager (org.codice.ddf.cxf.client.impl.SecureCxfClientFactoryImpl.AliasSelectorKeyManager)1 Test (org.junit.Test)1