Search in sources :

Example 6 with SecureStoreData

use of co.cask.cdap.api.security.store.SecureStoreData in project cdap by caskdata.

the class FileSecureStoreTest method testGet.

@Test
public void testGet() throws Exception {
    populateStore();
    SecureStoreMetadata metadata = SecureStoreMetadata.of(KEY1, DESCRIPTION1, PROPERTIES_1);
    SecureStoreData secureStoreData = new SecureStoreData(metadata, VALUE1.getBytes(Charsets.UTF_8));
    Assert.assertArrayEquals(secureStoreData.get(), secureStore.getSecureData(NAMESPACE1, KEY1).get());
    Assert.assertEquals(metadata.getDescription(), secureStore.getSecureData(NAMESPACE1, KEY1).getMetadata().getDescription());
    Assert.assertEquals(metadata.getName(), secureStore.getSecureData(NAMESPACE1, KEY1).getMetadata().getName());
}
Also used : SecureStoreData(co.cask.cdap.api.security.store.SecureStoreData) SecureStoreMetadata(co.cask.cdap.api.security.store.SecureStoreMetadata) Test(org.junit.Test)

Example 7 with SecureStoreData

use of co.cask.cdap.api.security.store.SecureStoreData in project cdap by caskdata.

the class KeyStoreEntry method readObject.

private void readObject(ObjectInputStream in) throws IOException {
    byte[] buf = new byte[in.readInt()];
    in.readFully(buf);
    byte[] dataBuf = new byte[in.readInt()];
    in.readFully(dataBuf);
    metadata = deserializeMetadata(buf);
    data = new SecureStoreData(metadata, dataBuf);
}
Also used : SecureStoreData(co.cask.cdap.api.security.store.SecureStoreData)

Aggregations

SecureStoreData (co.cask.cdap.api.security.store.SecureStoreData)7 SecureStoreMetadata (co.cask.cdap.api.security.store.SecureStoreMetadata)4 Test (org.junit.Test)3 SecureKeyId (co.cask.cdap.proto.id.SecureKeyId)2 IOException (java.io.IOException)2 AlreadyExistsException (co.cask.cdap.common.AlreadyExistsException)1 NamespaceNotFoundException (co.cask.cdap.common.NamespaceNotFoundException)1 NotFoundException (co.cask.cdap.common.NotFoundException)1 KeyStoreException (java.security.KeyStoreException)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 KeyProvider (org.apache.hadoop.crypto.key.KeyProvider)1