From 5efcca57e031e954fe9a9b9c8610b0f27f4d1900 Mon Sep 17 00:00:00 2001 From: Francois Papon Date: Sun, 14 Jun 2020 21:51:06 +0200 Subject: [PATCH] =?UTF-8?q?[SHIRO-778]=C2=A0onInit=20method=20on=20Authent?= =?UTF-8?q?icatingRealm=20is=20called=20twice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apache/shiro/config/ogdl/ReflectionBuilder.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/config/ogdl/src/main/java/org/apache/shiro/config/ogdl/ReflectionBuilder.java b/config/ogdl/src/main/java/org/apache/shiro/config/ogdl/ReflectionBuilder.java index 77a1db629..8ff214d56 100644 --- a/config/ogdl/src/main/java/org/apache/shiro/config/ogdl/ReflectionBuilder.java +++ b/config/ogdl/src/main/java/org/apache/shiro/config/ogdl/ReflectionBuilder.java @@ -287,10 +287,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.containsKey(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; }