use of com.yahoo.athenz.auth.PrivateKeyStore in project athenz by yahoo.
the class DynamoDBClientSettingsTest method credentialsNotProvided.
@Test
public void credentialsNotProvided() {
PrivateKeyStore keyStore = Mockito.mock(PrivateKeyStore.class);
DynamoDBClientSettings dynamoDBClientSettings = new DynamoDBClientSettings(keyStore);
assertFalse(dynamoDBClientSettings.areCredentialsProvided());
}
use of com.yahoo.athenz.auth.PrivateKeyStore in project athenz by yahoo.
the class DynamoDBSSHRecordStoreFactoryTest method testGetDynamoDBClient.
@Test
public void testGetDynamoDBClient() {
System.setProperty(ZTS_PROP_DYNAMODB_KEY_PATH, "test.keypath");
System.setProperty(ZTS_PROP_DYNAMODB_CERT_PATH, "test.certpath");
System.setProperty(ZTS_PROP_DYNAMODB_DOMAIN, "test.domain");
System.setProperty(ZTS_PROP_DYNAMODB_REGION, "test.region");
System.setProperty(ZTS_PROP_DYNAMODB_ROLE, "test.role");
System.setProperty(ZTS_PROP_DYNAMODB_TRUSTSTORE, "test.truststore");
System.setProperty(ZTS_PROP_DYNAMODB_TRUSTSTORE_PASSWORD, "test.truststore.password");
System.setProperty(ZTS_PROP_DYNAMODB_ZTS_URL, "test.ztsurl");
System.setProperty(ZTS_PROP_DYNAMODB_TRUSTSTORE_APPNAME, "test.appname");
PrivateKeyStore keyStore = Mockito.mock(PrivateKeyStore.class);
when(keyStore.getApplicationSecret(Mockito.eq("test.appname"), Mockito.eq("test.truststore.password"))).thenReturn("decryptedPassword");
DynamoDBSSHRecordStoreFactory factory = new DynamoDBSSHRecordStoreFactory();
ZTSClientNotificationSenderImpl ztsClientNotificationSender = Mockito.mock(ZTSClientNotificationSenderImpl.class);
PrivateKeyStore privateKeyStore = Mockito.mock(PrivateKeyStore.class);
AmazonDynamoDB dynamoDBClient = factory.getDynamoDBClient(ztsClientNotificationSender, privateKeyStore);
assertNotNull(dynamoDBClient);
System.clearProperty(ZTS_PROP_DYNAMODB_KEY_PATH);
System.clearProperty(ZTS_PROP_DYNAMODB_CERT_PATH);
System.clearProperty(ZTS_PROP_DYNAMODB_DOMAIN);
System.clearProperty(ZTS_PROP_DYNAMODB_REGION);
System.clearProperty(ZTS_PROP_DYNAMODB_ROLE);
System.clearProperty(ZTS_PROP_DYNAMODB_TRUSTSTORE);
System.clearProperty(ZTS_PROP_DYNAMODB_TRUSTSTORE_PASSWORD);
System.clearProperty(ZTS_PROP_DYNAMODB_ZTS_URL);
System.clearProperty(ZTS_PROP_DYNAMODB_TRUSTSTORE_APPNAME);
}
use of com.yahoo.athenz.auth.PrivateKeyStore in project athenz by yahoo.
the class DynamoDBCertRecordStoreFactoryTest method testGetDynamoDBClient.
@Test
public void testGetDynamoDBClient() {
System.setProperty(ZTS_PROP_DYNAMODB_KEY_PATH, "test.keypath");
System.setProperty(ZTS_PROP_DYNAMODB_CERT_PATH, "test.certpath");
System.setProperty(ZTS_PROP_DYNAMODB_DOMAIN, "test.domain");
System.setProperty(ZTS_PROP_DYNAMODB_REGION, "test.region");
System.setProperty(ZTS_PROP_DYNAMODB_ROLE, "test.role");
System.setProperty(ZTS_PROP_DYNAMODB_TRUSTSTORE, "test.truststore");
System.setProperty(ZTS_PROP_DYNAMODB_TRUSTSTORE_PASSWORD, "test.truststore.password");
System.setProperty(ZTS_PROP_DYNAMODB_ZTS_URL, "test.ztsurl");
System.setProperty(ZTS_PROP_DYNAMODB_TRUSTSTORE_APPNAME, "test.appname");
PrivateKeyStore keyStore = Mockito.mock(PrivateKeyStore.class);
when(keyStore.getApplicationSecret(Mockito.eq("test.appname"), Mockito.eq("test.truststore.password"))).thenReturn("decryptedPassword");
DynamoDBCertRecordStoreFactory factory = new DynamoDBCertRecordStoreFactory();
ZTSClientNotificationSenderImpl ztsClientNotificationSender = Mockito.mock(ZTSClientNotificationSenderImpl.class);
PrivateKeyStore privateKeyStore = Mockito.mock(PrivateKeyStore.class);
AmazonDynamoDB dynamoDBClient = factory.getDynamoDBClient(ztsClientNotificationSender, privateKeyStore);
assertNotNull(dynamoDBClient);
System.clearProperty(ZTS_PROP_DYNAMODB_KEY_PATH);
System.clearProperty(ZTS_PROP_DYNAMODB_CERT_PATH);
System.clearProperty(ZTS_PROP_DYNAMODB_DOMAIN);
System.clearProperty(ZTS_PROP_DYNAMODB_REGION);
System.clearProperty(ZTS_PROP_DYNAMODB_ROLE);
System.clearProperty(ZTS_PROP_DYNAMODB_TRUSTSTORE);
System.clearProperty(ZTS_PROP_DYNAMODB_TRUSTSTORE_PASSWORD);
System.clearProperty(ZTS_PROP_DYNAMODB_ZTS_URL);
System.clearProperty(ZTS_PROP_DYNAMODB_TRUSTSTORE_APPNAME);
}
use of com.yahoo.athenz.auth.PrivateKeyStore in project athenz by yahoo.
the class DynamoDBCertRecordStoreFactoryTest method testCreate.
@Test
public void testCreate() {
System.setProperty(ZTSConsts.ZTS_PROP_CERT_DYNAMODB_TABLE_NAME, "Athenz-ZTS-Table");
System.setProperty(ZTSConsts.ZTS_PROP_CERT_DYNAMODB_INDEX_CURRENT_TIME_NAME, "Athenz-ZTS-Current-Time-Index");
System.setProperty(ZTSConsts.ZTS_PROP_CERT_DYNAMODB_INDEX_HOST_NAME, "Athenz-ZTS-Host-Name-Index");
PrivateKeyStore keyStore = Mockito.mock(PrivateKeyStore.class);
TestDynamoDBCertRecordStoreFactory factory = new TestDynamoDBCertRecordStoreFactory();
CertRecordStore store = factory.create(keyStore);
assertNotNull(store);
System.clearProperty(ZTSConsts.ZTS_PROP_CERT_DYNAMODB_TABLE_NAME);
System.clearProperty(ZTSConsts.ZTS_PROP_CERT_DYNAMODB_INDEX_CURRENT_TIME_NAME);
System.clearProperty(ZTSConsts.ZTS_PROP_CERT_DYNAMODB_INDEX_HOST_NAME);
}
use of com.yahoo.athenz.auth.PrivateKeyStore in project athenz by yahoo.
the class DynamoDBCertRecordStoreFactoryTest method testCreateAmzClient.
@Test
public void testCreateAmzClient() {
System.setProperty(ZTSConsts.ZTS_PROP_CERT_DYNAMODB_TABLE_NAME, "Athenz-ZTS-Table");
System.setProperty(ZTSConsts.ZTS_PROP_CERT_DYNAMODB_INDEX_CURRENT_TIME_NAME, "Athenz-ZTS-Current-Time-Index");
System.setProperty(ZTSConsts.ZTS_PROP_CERT_DYNAMODB_INDEX_HOST_NAME, "Athenz-ZTS-Host-Name-Index");
PrivateKeyStore keyStore = Mockito.mock(PrivateKeyStore.class);
TestDynamoDBCertRecordStoreFactory factory = new TestDynamoDBCertRecordStoreFactory();
try {
factory.create(keyStore);
} catch (Exception ignored) {
}
System.clearProperty(ZTSConsts.ZTS_PROP_CERT_DYNAMODB_TABLE_NAME);
System.clearProperty(ZTSConsts.ZTS_PROP_CERT_DYNAMODB_INDEX_CURRENT_TIME_NAME);
System.clearProperty(ZTSConsts.ZTS_PROP_CERT_DYNAMODB_INDEX_HOST_NAME);
}
Aggregations