Search in sources :

Example 1 with CollectionKeyInfoCredentialResolver

use of org.opensaml.xmlsec.keyinfo.impl.CollectionKeyInfoCredentialResolver in project spring-security by spring-projects.

the class LogoutRequestEncryptedIdUtils method decrypter.

private static Decrypter decrypter(RelyingPartyRegistration registration) {
    Collection<Credential> credentials = new ArrayList<>();
    for (Saml2X509Credential key : registration.getDecryptionX509Credentials()) {
        Credential cred = CredentialSupport.getSimpleCredential(key.getCertificate(), key.getPrivateKey());
        credentials.add(cred);
    }
    KeyInfoCredentialResolver resolver = new CollectionKeyInfoCredentialResolver(credentials);
    Decrypter decrypter = new Decrypter(null, resolver, encryptedKeyResolver);
    decrypter.setRootInNewDocument(true);
    return decrypter;
}
Also used : Credential(org.opensaml.security.credential.Credential) Saml2X509Credential(org.springframework.security.saml2.core.Saml2X509Credential) ArrayList(java.util.ArrayList) Saml2X509Credential(org.springframework.security.saml2.core.Saml2X509Credential) Decrypter(org.opensaml.saml.saml2.encryption.Decrypter) CollectionKeyInfoCredentialResolver(org.opensaml.xmlsec.keyinfo.impl.CollectionKeyInfoCredentialResolver) KeyInfoCredentialResolver(org.opensaml.xmlsec.keyinfo.KeyInfoCredentialResolver) CollectionKeyInfoCredentialResolver(org.opensaml.xmlsec.keyinfo.impl.CollectionKeyInfoCredentialResolver)

Example 2 with CollectionKeyInfoCredentialResolver

use of org.opensaml.xmlsec.keyinfo.impl.CollectionKeyInfoCredentialResolver in project spring-security by spring-projects.

the class OpenSamlDecryptionUtils method decrypter.

private static Decrypter decrypter(RelyingPartyRegistration registration) {
    Collection<Credential> credentials = new ArrayList<>();
    for (Saml2X509Credential key : registration.getDecryptionX509Credentials()) {
        Credential cred = CredentialSupport.getSimpleCredential(key.getCertificate(), key.getPrivateKey());
        credentials.add(cred);
    }
    KeyInfoCredentialResolver resolver = new CollectionKeyInfoCredentialResolver(credentials);
    Decrypter decrypter = new Decrypter(null, resolver, encryptedKeyResolver);
    decrypter.setRootInNewDocument(true);
    return decrypter;
}
Also used : Credential(org.opensaml.security.credential.Credential) Saml2X509Credential(org.springframework.security.saml2.core.Saml2X509Credential) ArrayList(java.util.ArrayList) Saml2X509Credential(org.springframework.security.saml2.core.Saml2X509Credential) Decrypter(org.opensaml.saml.saml2.encryption.Decrypter) CollectionKeyInfoCredentialResolver(org.opensaml.xmlsec.keyinfo.impl.CollectionKeyInfoCredentialResolver) KeyInfoCredentialResolver(org.opensaml.xmlsec.keyinfo.KeyInfoCredentialResolver) CollectionKeyInfoCredentialResolver(org.opensaml.xmlsec.keyinfo.impl.CollectionKeyInfoCredentialResolver)

Aggregations

ArrayList (java.util.ArrayList)2 Decrypter (org.opensaml.saml.saml2.encryption.Decrypter)2 Credential (org.opensaml.security.credential.Credential)2 KeyInfoCredentialResolver (org.opensaml.xmlsec.keyinfo.KeyInfoCredentialResolver)2 CollectionKeyInfoCredentialResolver (org.opensaml.xmlsec.keyinfo.impl.CollectionKeyInfoCredentialResolver)2 Saml2X509Credential (org.springframework.security.saml2.core.Saml2X509Credential)2