Skip to content

Commit

Permalink
Merge branch 'feature/forgot-username' of github.com:Evolveum/midpoin…
Browse files Browse the repository at this point in the history
…t into feature/forgot-username

* 'feature/forgot-username' of github.com:Evolveum/midpoint:
  small update for getting correlators identifier when no id is defined
  • Loading branch information
katkav committed Aug 3, 2023
2 parents a907418 + 365c29b commit 0d7db7b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ protected CorrelatorConfigDto load() {
String correlatorName = module.getCurrentCorrelatorIdentifier();

String archetypeOid = null;
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication instanceof MidpointAuthentication mpAuthentication) {
archetypeOid = mpAuthentication.getArchetypeOid();
}
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication instanceof MidpointAuthentication mpAuthentication) {
archetypeOid = mpAuthentication.getArchetypeOid();
}

return new CorrelatorConfigDto(correlatorName, archetypeOid, getCorrelationAttributePaths(correlatorName, archetypeOid));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
import com.evolveum.midpoint.model.api.correlator.CandidateOwnersMap;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AuthenticationSequenceModuleType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.CorrelationModuleConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ModuleItemConfigurationType;

import org.apache.commons.collections4.CollectionUtils;

import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -48,6 +49,9 @@ public void setCorrelators(List<CorrelationModuleConfigurationType> correlators)

@Override
public String getCurrentCorrelatorIdentifier() {
if (isEmptyCorrelatorsList()) {
return null; //todo what if correlator identifier isn't specified?
}
return correlators.get(currentProcessingCorrelator).getCorrelatorIdentifier();
}

Expand All @@ -59,6 +63,10 @@ public void setNextCorrelator() {
currentProcessingCorrelator++;
}

public boolean isEmptyCorrelatorsList() {
return CollectionUtils.isEmpty(correlators);
}

public void addCandidateOwners(CandidateOwnersMap map) {
candidateOwners.mergeWith(map);
}
Expand Down

0 comments on commit 0d7db7b

Please sign in to comment.