Search in sources :

Example 1 with KeyName

use of org.opensaml.xmlsec.signature.KeyName in project verify-hub by alphagov.

the class HubIdentityProviderMetadataDtoToEntityDescriptorTransformerTest method assertCertificateCorrect.

private void assertCertificateCorrect(KeyDescriptor keyDescriptor, String issuerId, Certificate certificateValue) {
    final KeyInfo keyInfo = keyDescriptor.getKeyInfo();
    final List<KeyName> keyNames = keyInfo.getKeyNames();
    Assertions.assertThat(keyNames.size()).isEqualTo(1);
    Assertions.assertThat(keyNames.get(0).getValue()).isEqualTo(issuerId);
    Assertions.assertThat(keyInfo.getX509Datas().size()).isEqualTo(1);
    final List<X509Data> x509Datas = keyInfo.getX509Datas();
    final List<X509Certificate> x509Certificates = x509Datas.get(0).getX509Certificates();
    Assertions.assertThat(x509Certificates.size()).isEqualTo(1);
    Assertions.assertThat(x509Certificates.get(0).getValue()).isEqualTo(certificateValue.getCertificate());
}
Also used : KeyName(org.opensaml.xmlsec.signature.KeyName) KeyInfo(org.opensaml.xmlsec.signature.KeyInfo) X509Data(org.opensaml.xmlsec.signature.X509Data) X509Certificate(org.opensaml.xmlsec.signature.X509Certificate)

Aggregations

KeyInfo (org.opensaml.xmlsec.signature.KeyInfo)1 KeyName (org.opensaml.xmlsec.signature.KeyName)1 X509Certificate (org.opensaml.xmlsec.signature.X509Certificate)1 X509Data (org.opensaml.xmlsec.signature.X509Data)1