Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
reg-app
Regapp
Commits
d12d4743
Commit
d12d4743
authored
Apr 15, 2021
by
michael.simon
Browse files
Add more sophisticated method to retrieve encrypted key
parent
8b69b6cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
bwreg-service/src/main/java/edu/kit/scc/webreg/service/saml/Saml2AssertionService.java
View file @
d12d4743
...
...
@@ -30,11 +30,15 @@ import org.opensaml.saml.saml2.core.EncryptedID;
import
org.opensaml.saml.saml2.core.NameID
;
import
org.opensaml.saml.saml2.core.Response
;
import
org.opensaml.saml.saml2.encryption.Decrypter
;
import
org.opensaml.saml.saml2.encryption.EncryptedElementTypeEncryptedKeyResolver
;
import
org.opensaml.saml.saml2.metadata.EntityDescriptor
;
import
org.opensaml.security.credential.Credential
;
import
org.opensaml.security.x509.BasicX509Credential
;
import
org.opensaml.xmlsec.encryption.support.ChainingEncryptedKeyResolver
;
import
org.opensaml.xmlsec.encryption.support.DecryptionException
;
import
org.opensaml.xmlsec.encryption.support.EncryptedKeyResolver
;
import
org.opensaml.xmlsec.encryption.support.InlineEncryptedKeyResolver
;
import
org.opensaml.xmlsec.encryption.support.SimpleRetrievalMethodEncryptedKeyResolver
;
import
org.opensaml.xmlsec.keyinfo.KeyInfoCredentialResolver
;
import
org.opensaml.xmlsec.keyinfo.impl.StaticKeyInfoCredentialResolver
;
import
org.slf4j.Logger
;
...
...
@@ -234,7 +238,14 @@ public class Saml2AssertionService {
}
KeyInfoCredentialResolver
keyResolver
=
new
StaticKeyInfoCredentialResolver
(
decryptCredentialList
);
InlineEncryptedKeyResolver
encryptionKeyResolver
=
new
InlineEncryptedKeyResolver
();
final
List
<
EncryptedKeyResolver
>
list
=
new
ArrayList
<>();
list
.
add
(
new
InlineEncryptedKeyResolver
());
list
.
add
(
new
EncryptedElementTypeEncryptedKeyResolver
());
list
.
add
(
new
SimpleRetrievalMethodEncryptedKeyResolver
());
ChainingEncryptedKeyResolver
encryptionKeyResolver
=
new
ChainingEncryptedKeyResolver
(
list
);
// At this point, we have some missing methods to get the encrypted Key out of the xml
// This seems to be necessary with some IDPs
//InlineEncryptedKeyResolver encryptionKeyResolver = new InlineEncryptedKeyResolver();
Decrypter
decrypter
=
new
Decrypter
(
null
,
keyResolver
,
encryptionKeyResolver
);
decrypter
.
setRootInNewDocument
(
true
);
return
decrypter
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment