Search in sources :

Example 1 with CollectionCredentialResolver

use of org.opensaml.security.credential.impl.CollectionCredentialResolver in project spring-security by spring-projects.

the class OpenSamlVerificationUtils method trustEngine.

static SignatureTrustEngine trustEngine(RelyingPartyRegistration registration) {
    Set<Credential> credentials = new HashSet<>();
    Collection<Saml2X509Credential> keys = registration.getAssertingPartyDetails().getVerificationX509Credentials();
    for (Saml2X509Credential key : keys) {
        BasicX509Credential cred = new BasicX509Credential(key.getCertificate());
        cred.setUsageType(UsageType.SIGNING);
        cred.setEntityId(registration.getAssertingPartyDetails().getEntityId());
        credentials.add(cred);
    }
    CredentialResolver credentialsResolver = new CollectionCredentialResolver(credentials);
    return new ExplicitKeySignatureTrustEngine(credentialsResolver, DefaultSecurityConfigurationBootstrap.buildBasicInlineKeyInfoCredentialResolver());
}
Also used : Credential(org.opensaml.security.credential.Credential) Saml2X509Credential(org.springframework.security.saml2.core.Saml2X509Credential) BasicX509Credential(org.opensaml.security.x509.BasicX509Credential) BasicX509Credential(org.opensaml.security.x509.BasicX509Credential) ExplicitKeySignatureTrustEngine(org.opensaml.xmlsec.signature.support.impl.ExplicitKeySignatureTrustEngine) Saml2X509Credential(org.springframework.security.saml2.core.Saml2X509Credential) CollectionCredentialResolver(org.opensaml.security.credential.impl.CollectionCredentialResolver) CredentialResolver(org.opensaml.security.credential.CredentialResolver) CollectionCredentialResolver(org.opensaml.security.credential.impl.CollectionCredentialResolver) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 Credential (org.opensaml.security.credential.Credential)1 CredentialResolver (org.opensaml.security.credential.CredentialResolver)1 CollectionCredentialResolver (org.opensaml.security.credential.impl.CollectionCredentialResolver)1 BasicX509Credential (org.opensaml.security.x509.BasicX509Credential)1 ExplicitKeySignatureTrustEngine (org.opensaml.xmlsec.signature.support.impl.ExplicitKeySignatureTrustEngine)1 Saml2X509Credential (org.springframework.security.saml2.core.Saml2X509Credential)1