use of org.opensaml.saml2.metadata.EntityDescriptor in project verify-hub by alphagov.
the class HubIdentityProviderMetadataDtoToEntityDescriptorTransformerTest method transform_shouldTransformHubEncryptionCertificate.
@Test
public void transform_shouldTransformHubEncryptionCertificate() {
final Certificate encryptionCert = aCertificate().withKeyUse(Certificate.KeyUse.Encryption).build();
final EntityDescriptor result = transformer.apply(IdentityProviderMetadataDtoBuilder.anIdentityProviderMetadataDto().withHubEncryptionCertificate(encryptionCert).build());
final List<KeyDescriptor> keyDescriptors = result.getIDPSSODescriptor(SAMLConstants.SAML20P_NS).getKeyDescriptors();
assertCertificateIsPresent(keyDescriptors, encryptionCert);
}
use of org.opensaml.saml2.metadata.EntityDescriptor in project verify-hub by alphagov.
the class SamlEntityDescriptorValidatorTest method decorate_shouldThrowExceptionWhenX509CertificateElementIsEmpty.
@Test
public void decorate_shouldThrowExceptionWhenX509CertificateElementIsEmpty() throws Exception {
EntityDescriptor entityDescriptor = anEntityDescriptor().withIdpSsoDescriptor(IdpSsoDescriptorBuilder.anIdpSsoDescriptor().withoutDefaultSigningKey().addKeyDescriptor(KeyDescriptorBuilder.aKeyDescriptor().withKeyInfo(KeyInfoBuilder.aKeyInfo().withX509Data(aX509Data().withX509Certificate(X509CertificateBuilder.aX509Certificate().withCertForEntityId(null).withCert(null).build()).build()).build()).build()).build()).build();
assertExceptionMessage(entityDescriptor, SamlTransformationErrorFactory.emptyX509Certificiate());
}
use of org.opensaml.saml2.metadata.EntityDescriptor in project verify-hub by alphagov.
the class SamlEntityDescriptorValidatorTest method decorate_shouldNotThrowExceptionWhenEntityDescriptorIsNotSignedButNotRequired.
@Test
public void decorate_shouldNotThrowExceptionWhenEntityDescriptorIsNotSignedButNotRequired() throws Exception {
EntityDescriptor entityDescriptor = anEntityDescriptor().withoutSigning().build();
validator.validate(entityDescriptor);
}
use of org.opensaml.saml2.metadata.EntityDescriptor in project verify-hub by alphagov.
the class SamlEntityDescriptorValidatorTest method decorate_shouldThrowExceptionWhenRoleDescriptorDoesNotHaveAX509CertificateElement.
@Test
public void decorate_shouldThrowExceptionWhenRoleDescriptorDoesNotHaveAX509CertificateElement() throws Exception {
EntityDescriptor entityDescriptor = anEntityDescriptor().withIdpSsoDescriptor(IdpSsoDescriptorBuilder.anIdpSsoDescriptor().withoutDefaultSigningKey().addKeyDescriptor(KeyDescriptorBuilder.aKeyDescriptor().withKeyInfo(KeyInfoBuilder.aKeyInfo().withX509Data(aX509Data().withX509Certificate(null).build()).build()).build()).build()).build();
assertExceptionMessage(entityDescriptor, SamlTransformationErrorFactory.missingX509Certificate());
}
use of org.opensaml.saml2.metadata.EntityDescriptor in project verify-hub by alphagov.
the class SamlEntityDescriptorValidatorTest method decorate_shouldDoNothingWhenEntityDescriptorIsValid.
@Test
public void decorate_shouldDoNothingWhenEntityDescriptorIsValid() throws Exception {
EntityDescriptor entityDescriptor = anEntityDescriptor().withIdpSsoDescriptor(IdpSsoDescriptorBuilder.anIdpSsoDescriptor().withSingleSignOnService(anEndpoint().buildSingleSignOnService()).build()).build();
validator.validate(entityDescriptor);
}
Aggregations