Search in sources :

Example 1 with SshCredentialVersionData

use of org.cloudfoundry.credhub.entity.SshCredentialVersionData in project credhub by cloudfoundry-incubator.

the class CredentialRotationTest method rotate_givenSshCredential_reEncryptsWithActiveKey.

@Test
public void rotate_givenSshCredential_reEncryptsWithActiveKey() {
    SshCredentialVersionData sshCredentialData = new SshCredentialVersionData("ssh-key");
    SshCredentialVersion credential = new SshCredentialVersion(sshCredentialData);
    assertRotation(credential, sshCredentialData);
}
Also used : SshCredentialVersionData(org.cloudfoundry.credhub.entity.SshCredentialVersionData) Test(org.junit.Test)

Example 2 with SshCredentialVersionData

use of org.cloudfoundry.credhub.entity.SshCredentialVersionData in project credhub by cloudfoundry-incubator.

the class CredentialVersionDataServiceTest method save_whenTheCredentialSavedWithoutEncryptedValueSet_doesNotSetTheMasterEncryptionKeyUuid.

@Test
public void save_whenTheCredentialSavedWithoutEncryptedValueSet_doesNotSetTheMasterEncryptionKeyUuid() {
    SshCredentialVersionData sshCredentialData = new SshCredentialVersionData("/my-credential");
    SshCredentialVersion credential = new SshCredentialVersion(sshCredentialData).setEncryptor(encryptor).setPublicKey("fake-public-key");
    subject.save(credential);
    assertThat(sshCredentialData.getEncryptionKeyUuid(), nullValue());
}
Also used : SshCredentialVersion(org.cloudfoundry.credhub.domain.SshCredentialVersion) SshCredentialVersionData(org.cloudfoundry.credhub.entity.SshCredentialVersionData) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Example 3 with SshCredentialVersionData

use of org.cloudfoundry.credhub.entity.SshCredentialVersionData in project credhub by cloudfoundry-incubator.

the class CredentialVersionDataServiceTest method save_whenTheCredentialSavedWithEncryptedValueSet_setsTheMasterEncryptionKeyUuid.

@Test
public void save_whenTheCredentialSavedWithEncryptedValueSet_setsTheMasterEncryptionKeyUuid() {
    SshCredentialVersionData sshCredentialData = new SshCredentialVersionData("/my-credential");
    SshCredentialVersion credential = new SshCredentialVersion(sshCredentialData).setEncryptor(encryptor).setPrivateKey("private-key").setPublicKey("fake-public-key");
    subject.save(credential);
    assertThat(sshCredentialData.getEncryptionKeyUuid(), equalTo(activeCanaryUuid));
}
Also used : SshCredentialVersion(org.cloudfoundry.credhub.domain.SshCredentialVersion) SshCredentialVersionData(org.cloudfoundry.credhub.entity.SshCredentialVersionData) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Example 4 with SshCredentialVersionData

use of org.cloudfoundry.credhub.entity.SshCredentialVersionData in project credhub by cloudfoundry-incubator.

the class SshCredentialVersionTest method setUp.

@Before
public void setUp() {
    sshPublicKeyParser = mock(SshPublicKeyParser.class);
    SshCredentialVersionData credentialVersionData = mock(SshCredentialVersionData.class);
    subject = new SshCredentialVersion(credentialVersionData, sshPublicKeyParser);
}
Also used : SshPublicKeyParser(org.cloudfoundry.credhub.util.SshPublicKeyParser) SshCredentialVersionData(org.cloudfoundry.credhub.entity.SshCredentialVersionData) Before(org.junit.Before)

Aggregations

SshCredentialVersionData (org.cloudfoundry.credhub.entity.SshCredentialVersionData)4 Test (org.junit.Test)3 SshCredentialVersion (org.cloudfoundry.credhub.domain.SshCredentialVersion)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2 SshPublicKeyParser (org.cloudfoundry.credhub.util.SshPublicKeyParser)1 Before (org.junit.Before)1