Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Mar 3, 2022
2 parents 2eb0d4c + 7376680 commit ac3af69
Showing 1 changed file with 37 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,48 +152,50 @@ private static void createRelyingPartyRegistration(RelyingPartyRegistration.Buil
}
});
Saml2X509Credential activeCredential = null;
ModuleSaml2SimpleKeyType simpleKeyType = keysType.getActiveSimpleKey();
if (simpleKeyType != null) {
activeCredential = getSaml2Credential(simpleKeyType, true);
}
ModuleSaml2KeyStoreKeyType storeKeyType = keysType.getActiveKeyStoreKey();
if (storeKeyType != null) {
activeCredential = getSaml2Credential(storeKeyType, true);
}
if (keysType != null) {
ModuleSaml2SimpleKeyType simpleKeyType = keysType.getActiveSimpleKey();
if (simpleKeyType != null) {
activeCredential = getSaml2Credential(simpleKeyType, true);
}
ModuleSaml2KeyStoreKeyType storeKeyType = keysType.getActiveKeyStoreKey();
if (storeKeyType != null) {
activeCredential = getSaml2Credential(storeKeyType, true);
}

List<Saml2X509Credential> credentials = new ArrayList<>();
if (activeCredential != null) {
credentials.add(activeCredential);
}
List<Saml2X509Credential> credentials = new ArrayList<>();
if (activeCredential != null) {
credentials.add(activeCredential);
}

if (keysType.getStandBySimpleKey() != null && !keysType.getStandBySimpleKey().isEmpty()) {
for (ModuleSaml2SimpleKeyType standByKey : keysType.getStandBySimpleKey()) {
Saml2X509Credential credential = getSaml2Credential(standByKey, false);
if (credential != null) {
credentials.add(credential);
if (keysType.getStandBySimpleKey() != null && !keysType.getStandBySimpleKey().isEmpty()) {
for (ModuleSaml2SimpleKeyType standByKey : keysType.getStandBySimpleKey()) {
Saml2X509Credential credential = getSaml2Credential(standByKey, false);
if (credential != null) {
credentials.add(credential);
}
}
}
}
if (keysType.getStandByKeyStoreKey() != null && !keysType.getStandByKeyStoreKey().isEmpty()) {
for (ModuleSaml2KeyStoreKeyType standByKey : keysType.getStandByKeyStoreKey()) {
Saml2X509Credential credential = getSaml2Credential(standByKey, false);
if (credential != null) {
credentials.add(credential);
if (keysType.getStandByKeyStoreKey() != null && !keysType.getStandByKeyStoreKey().isEmpty()) {
for (ModuleSaml2KeyStoreKeyType standByKey : keysType.getStandByKeyStoreKey()) {
Saml2X509Credential credential = getSaml2Credential(standByKey, false);
if (credential != null) {
credentials.add(credential);
}
}
}
}

if (!credentials.isEmpty()) {
registrationBuilder.decryptionX509Credentials(c -> credentials.forEach(cred -> {
if (cred.getCredentialTypes().contains(Saml2X509Credential.Saml2X509CredentialType.DECRYPTION)) {
c.add(cred);
}
}));
registrationBuilder.signingX509Credentials(c -> credentials.forEach(cred -> {
if (cred.getCredentialTypes().contains(Saml2X509Credential.Saml2X509CredentialType.SIGNING)) {
c.add(cred);
}
}));
if (!credentials.isEmpty()) {
registrationBuilder.decryptionX509Credentials(c -> credentials.forEach(cred -> {
if (cred.getCredentialTypes().contains(Saml2X509Credential.Saml2X509CredentialType.DECRYPTION)) {
c.add(cred);
}
}));
registrationBuilder.signingX509Credentials(c -> credentials.forEach(cred -> {
if (cred.getCredentialTypes().contains(Saml2X509Credential.Saml2X509CredentialType.SIGNING)) {
c.add(cred);
}
}));
}
}
}

Expand Down

0 comments on commit ac3af69

Please sign in to comment.