Search in sources :

Example 16 with PasswordCredentialVersionData

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

the class CredentialVersionDataServiceTest method setupTestFixturesForFindContainingName.

private void setupTestFixturesForFindContainingName(String valueName, String passwordName, String certificateName) {
    fakeTimeSetter.accept(2000000000123L);
    valueCredentialData = new ValueCredentialVersionData(valueName);
    valueCredentialData.setEncryptedValueData(new EncryptedValue().setEncryptionKeyUuid(activeCanaryUuid).setEncryptedValue("value".getBytes()).setNonce(new byte[] {}));
    ValueCredentialVersion namedValueCredential = new ValueCredentialVersion(valueCredentialData);
    namedValueCredential.setEncryptor(encryptor);
    subject.save(namedValueCredential);
    PasswordCredentialVersionData passwordCredentialData = new PasswordCredentialVersionData("/mySe.cret");
    passwordCredentialData.setEncryptedValueData(new EncryptedValue(activeCanaryUuid, "", ""));
    new PasswordCredentialVersion(passwordCredentialData);
    PasswordCredentialVersion namedPasswordCredential;
    subject.save(namedValueCredential);
    fakeTimeSetter.accept(1000000000123L);
    passwordCredentialData = new PasswordCredentialVersionData(passwordName);
    passwordCredentialData.setEncryptedValueData(new EncryptedValue().setEncryptionKeyUuid(activeCanaryUuid).setEncryptedValue("password".getBytes()).setNonce(new byte[] {}));
    namedPasswordCredential = new PasswordCredentialVersion(passwordCredentialData);
    subject.save(namedPasswordCredential);
    CertificateCredentialVersionData certificateCredentialData = new CertificateCredentialVersionData("/myseecret");
    CertificateCredentialVersion certificateCredential = new CertificateCredentialVersion(certificateCredentialData);
    subject.save(certificateCredential);
    fakeTimeSetter.accept(3000000000123L);
    certificateCredentialData = new CertificateCredentialVersionData(certificateName);
    certificateCredential = new CertificateCredentialVersion(certificateCredentialData);
    subject.save(certificateCredential);
}
Also used : ValueCredentialVersion(org.cloudfoundry.credhub.domain.ValueCredentialVersion) CertificateCredentialVersionData(org.cloudfoundry.credhub.entity.CertificateCredentialVersionData) PasswordCredentialVersionData(org.cloudfoundry.credhub.entity.PasswordCredentialVersionData) EncryptedValue(org.cloudfoundry.credhub.entity.EncryptedValue) PasswordCredentialVersion(org.cloudfoundry.credhub.domain.PasswordCredentialVersion) ValueCredentialVersionData(org.cloudfoundry.credhub.entity.ValueCredentialVersionData) CertificateCredentialVersion(org.cloudfoundry.credhub.domain.CertificateCredentialVersion)

Aggregations

PasswordCredentialVersionData (org.cloudfoundry.credhub.entity.PasswordCredentialVersionData)16 EncryptedValue (org.cloudfoundry.credhub.entity.EncryptedValue)12 Test (org.junit.Test)11 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)10 PasswordCredentialVersion (org.cloudfoundry.credhub.domain.PasswordCredentialVersion)9 ValueCredentialVersion (org.cloudfoundry.credhub.domain.ValueCredentialVersion)5 Credential (org.cloudfoundry.credhub.entity.Credential)5 ValueCredentialVersionData (org.cloudfoundry.credhub.entity.ValueCredentialVersionData)5 CertificateCredentialVersion (org.cloudfoundry.credhub.domain.CertificateCredentialVersion)4 CertificateCredentialVersionData (org.cloudfoundry.credhub.entity.CertificateCredentialVersionData)4 StringGenerationParameters (org.cloudfoundry.credhub.request.StringGenerationParameters)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 CredentialVersion (org.cloudfoundry.credhub.domain.CredentialVersion)2 SshCredentialVersion (org.cloudfoundry.credhub.domain.SshCredentialVersion)2 CredentialVersionData (org.cloudfoundry.credhub.entity.CredentialVersionData)2 SshCredentialVersionData (org.cloudfoundry.credhub.entity.SshCredentialVersionData)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 MockHttpServletRequestBuilder (org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder)2 EncryptionKeyCanary (org.cloudfoundry.credhub.entity.EncryptionKeyCanary)1 JsonObjectMapper (org.cloudfoundry.credhub.util.JsonObjectMapper)1