use of com.yahoo.athenz.auth.PrivateKeyStore in project athenz by yahoo.
the class FilePrivateKeyStoreTest method testRetrievePrivateKeyValid.
@SuppressWarnings("deprecation")
@Test
public void testRetrievePrivateKeyValid() {
FilePrivateKeyStoreFactory factory = new FilePrivateKeyStoreFactory();
PrivateKeyStore store = factory.create();
String saveProp = System.getProperty(FilePrivateKeyStore.ATHENZ_PROP_PRIVATE_KEY);
System.setProperty(FilePrivateKeyStore.ATHENZ_PROP_PRIVATE_KEY, "src/test/resources/unit_test_zts_private_k0.key");
StringBuilder keyId = new StringBuilder(256);
PrivateKey privKey = store.getPrivateKey("zms", "localhost", keyId);
assertNotNull(privKey);
if (saveProp == null) {
System.clearProperty(FilePrivateKeyStore.ATHENZ_PROP_PRIVATE_KEY);
} else {
System.setProperty(FilePrivateKeyStore.ATHENZ_PROP_PRIVATE_KEY, saveProp);
}
}
use of com.yahoo.athenz.auth.PrivateKeyStore in project athenz by yahoo.
the class ZMSFileChangeLogStoreFactoryTest method testCreateMTLSClientStoreWithKeyStoree.
@Test
public void testCreateMTLSClientStoreWithKeyStoree() {
setupMTLSSettings();
PrivateKeyStore privateKeyStore = new PrivateKeyStore() {
@Override
public String getApplicationSecret(String appName, String keyName) {
return keyName;
}
};
ZMSFileChangeLogStoreFactory factory = new ZMSFileChangeLogStoreFactory();
factory.setPrivateKeyStore(privateKeyStore);
ChangeLogStore store = factory.create(ZTS_DATA_STORE_PATH, null, null);
assertNotNull(store);
assertTrue(store instanceof ZMSFileMTLSChangeLogStore);
clearMTLSSettings();
}
use of com.yahoo.athenz.auth.PrivateKeyStore in project athenz by yahoo.
the class MsdStoreFactoryTest method createTest.
@Test
public void createTest() {
MsdStore mockMsdStore = Mockito.mock(MsdStore.class);
MsdStoreFactory factory = (PrivateKeyStore ks) -> mockMsdStore;
PrivateKeyStore keyStore = new PrivateKeyStore() {
};
MsdStore msdStore = factory.create(keyStore);
assertNotNull(msdStore);
}
use of com.yahoo.athenz.auth.PrivateKeyStore in project athenz by yahoo.
the class SSLUtilsTest method testLoadServicePrivateKey.
@Test
public void testLoadServicePrivateKey() {
PrivateKeyStore keyStore = SSLUtils.loadServicePrivateKey("com.yahoo.athenz.auth.impl.FilePrivateKeyStoreFactory");
Assert.assertNotNull(keyStore);
}
use of com.yahoo.athenz.auth.PrivateKeyStore in project athenz by yahoo.
the class JDBCSSHRecordStoreFactoryTest method testCreate.
@Test
public void testCreate() {
System.setProperty(ZTSConsts.ZTS_PROP_SSH_JDBC_STORE, "jdbc:mysql://localhost");
System.setProperty(ZTSConsts.ZTS_PROP_SSH_JDBC_USER, "user");
System.setProperty(ZTSConsts.ZTS_PROP_SSH_JDBC_PASSWORD, "password");
PrivateKeyStore keyStore = Mockito.mock(PrivateKeyStore.class);
Mockito.doReturn("password").when(keyStore).getApplicationSecret("jdbc", "password");
JDBCSSHRecordStoreFactory factory = new JDBCSSHRecordStoreFactory();
SSHRecordStore store = factory.create(keyStore);
assertNotNull(store);
}
Aggregations