Search in sources :

Example 1 with UsageType

use of org.opensaml.security.credential.UsageType in project verify-hub by alphagov.

the class HubIdentityProviderMetadataDtoToEntityDescriptorTransformerTest method assertCertificateIsPresent.

private void assertCertificateIsPresent(List<KeyDescriptor> keyDescriptors, Certificate encryptionCert) {
    for (KeyDescriptor keyDescriptor : keyDescriptors) {
        String keyEntityId = keyDescriptor.getKeyInfo().getKeyNames().get(0).getValue();
        String x509Value = keyDescriptor.getKeyInfo().getX509Datas().get(0).getX509Certificates().get(0).getValue();
        UsageType keyUse = keyDescriptor.getUse();
        if (keyEntityId.equals(encryptionCert.getIssuerId()) && x509Value.equals(encryptionCert.getCertificate()) && keyUse == UsageType.ENCRYPTION) {
            return;
        }
    }
    Assertions.fail("Certificate is not present.");
}
Also used : KeyDescriptor(org.opensaml.saml.saml2.metadata.KeyDescriptor) UsageType(org.opensaml.security.credential.UsageType)

Aggregations

KeyDescriptor (org.opensaml.saml.saml2.metadata.KeyDescriptor)1 UsageType (org.opensaml.security.credential.UsageType)1