Skip to content

Commit

Permalink
[SHIRO-778] onInit method on AuthenticatingRealm is called twice
Browse files Browse the repository at this point in the history
  • Loading branch information
fpapon committed Jun 15, 2020
1 parent 2e29785 commit 54fe26e
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ private String parseBeanId(String lhs) {
public Map<String, ?> buildObjects(Map<String, String> kvPairs) {

if (kvPairs != null && !kvPairs.isEmpty()) {

BeanConfigurationProcessor processor = new BeanConfigurationProcessor();

for (Map.Entry<String, String> entry : kvPairs.entrySet()) {
Expand All @@ -287,10 +286,15 @@ private String parseBeanId(String lhs) {
}

processor.execute();
}

//SHIRO-413: init method must be called for constructed objects that are Initializable
LifecycleUtils.init(objects.values());
//SHIRO-778: onInit method on AuthenticatingRealm is called twice
objects.keySet().stream()
.filter(key -> !kvPairs.keySet().contains(key))
.forEach(key -> LifecycleUtils.init(objects.get(key)));
} else {
//SHIRO-413: init method must be called for constructed objects that are Initializable
LifecycleUtils.init(objects.values());
}

return objects;
}
Expand Down

0 comments on commit 54fe26e

Please sign in to comment.