Search in sources :

Example 6 with CertificateGenerationRequestParameters

use of org.cloudfoundry.credhub.request.CertificateGenerationRequestParameters in project credhub by cloudfoundry-incubator.

the class CertificateGenerationParametersTest method constructor_prependsForwardSlashToCaName.

@Test
public void constructor_prependsForwardSlashToCaName() throws Exception {
    final CertificateGenerationRequestParameters requestParameters1 = new CertificateGenerationRequestParameters();
    requestParameters1.setCaName("ca-name");
    requestParameters1.setCommonName("a-common-name");
    final CertificateGenerationRequestParameters requestParameters2 = new CertificateGenerationRequestParameters();
    requestParameters2.setCaName("/ca-name");
    requestParameters2.setCommonName("a-common-name");
    final CertificateGenerationParameters parameters1 = new CertificateGenerationParameters(requestParameters1);
    final CertificateGenerationParameters parameters2 = new CertificateGenerationParameters(requestParameters2);
    assertThat(parameters1.equals(parameters2), equalTo(true));
}
Also used : CertificateGenerationRequestParameters(org.cloudfoundry.credhub.request.CertificateGenerationRequestParameters) Test(org.junit.Test)

Example 7 with CertificateGenerationRequestParameters

use of org.cloudfoundry.credhub.request.CertificateGenerationRequestParameters in project credhub by cloudfoundry-incubator.

the class CertificateGenerationParametersTest method equals_returnsFalseWhenKeyUsagesAreDifferent.

@Test
public void equals_returnsFalseWhenKeyUsagesAreDifferent() throws Exception {
    final CertificateGenerationRequestParameters requestParameters1 = new CertificateGenerationRequestParameters();
    final String[] keyUsages1 = new String[] { "data_encipherment", "digital_signature", "non_repudiation", "key_encipherment" };
    final String[] keyUsages2 = new String[] { "data_encipherment", "digital_signature", "non_repudiation" };
    requestParameters1.setKeyUsage(keyUsages1);
    requestParameters1.setCommonName("a-common-name");
    final CertificateGenerationRequestParameters requestParameters2 = new CertificateGenerationRequestParameters();
    requestParameters2.setKeyUsage(keyUsages2);
    requestParameters2.setCommonName("a-common-name");
    final CertificateGenerationParameters parameters1 = new CertificateGenerationParameters(requestParameters1);
    final CertificateGenerationParameters parameters2 = new CertificateGenerationParameters(requestParameters2);
    assertThat(parameters1.equals(parameters2), equalTo(false));
}
Also used : CertificateGenerationRequestParameters(org.cloudfoundry.credhub.request.CertificateGenerationRequestParameters) Test(org.junit.Test)

Aggregations

CertificateGenerationRequestParameters (org.cloudfoundry.credhub.request.CertificateGenerationRequestParameters)7 Test (org.junit.Test)6 CertificateCredentialValue (org.cloudfoundry.credhub.credential.CertificateCredentialValue)2 CertificateGenerationParameters (org.cloudfoundry.credhub.domain.CertificateGenerationParameters)2 X500Name (org.bouncycastle.asn1.x500.X500Name)1 X509CertificateHolder (org.bouncycastle.cert.X509CertificateHolder)1 JcaX509CertificateConverter (org.bouncycastle.cert.jcajce.JcaX509CertificateConverter)1 UserContext (org.cloudfoundry.credhub.auth.UserContext)1 CertificateAuthorityService (org.cloudfoundry.credhub.data.CertificateAuthorityService)1 ParameterizedValidationException (org.cloudfoundry.credhub.exceptions.ParameterizedValidationException)1 PermissionCheckingService (org.cloudfoundry.credhub.service.PermissionCheckingService)1 Before (org.junit.Before)1