From 868f3cfad5de246ee35673b1ee20ef357c60afa0 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 8 Feb 2023 22:59:53 +0100 Subject: [PATCH] Remove AAAWebEnvironment.create() There is really no need to go through a factory method, just perform all the initialization in constructor. JIRA: AAA-205 Change-Id: I09fdef159ddd8f5437ac652bfe65f0ad48d7aa12 Signed-off-by: Robert Varga --- .../aaa/shiro/web/env/AAAWebEnvironment.java | 13 ++++--------- .../resources/OSGI-INF/blueprint/impl-blueprint.xml | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/aaa-shiro/impl/src/main/java/org/opendaylight/aaa/shiro/web/env/AAAWebEnvironment.java b/aaa-shiro/impl/src/main/java/org/opendaylight/aaa/shiro/web/env/AAAWebEnvironment.java index ed853f1dc..b113e9bdc 100644 --- a/aaa-shiro/impl/src/main/java/org/opendaylight/aaa/shiro/web/env/AAAWebEnvironment.java +++ b/aaa-shiro/impl/src/main/java/org/opendaylight/aaa/shiro/web/env/AAAWebEnvironment.java @@ -35,11 +35,7 @@ import org.slf4j.LoggerFactory; public final class AAAWebEnvironment extends IniWebEnvironment implements AAAShiroWebEnvironment { private static final Logger LOG = LoggerFactory.getLogger(AAAWebEnvironment.class); - private AAAWebEnvironment(final Ini ini) { - setIni(ini); - } - - public static AAAWebEnvironment create(final ShiroIni shiroConfiguration, final DataBroker dataBroker, + public AAAWebEnvironment(final ShiroIni shiroConfiguration, final DataBroker dataBroker, final ICertificateManager certificateManager, final AuthenticationService authenticationService, final TokenAuthenticators tokenAuthenticators, final TokenStore tokenStore, final PasswordHashService passwordHashService, final ServletSupport servletSupport) { @@ -56,8 +52,8 @@ public final class AAAWebEnvironment extends IniWebEnvironment implements AAAShi urlsSection.put(url.getPairKey(), url.getPairValue()); } - // Create an instance - final var ret = new AAAWebEnvironment(ini); + // Set the configuration + setIni(ini); // Configure the instance with all known custom components prepared for loading via their thread locals and // clean up afterwards. This needs to happen on our class loader so Shiro's ReflectionBuilder use of @@ -69,11 +65,10 @@ public final class AAAWebEnvironment extends IniWebEnvironment implements AAAShi var moonLoad = MoonRealm.prepareForLoad(servletSupport); var tokenAuthLoad = TokenAuthRealm.prepareForLoad(authenticationService, tokenAuthenticators, tokenStore)) { - ret.configure(); + configure(); } }); LOG.debug("AAAWebEnvironment created"); - return ret; } } diff --git a/aaa-shiro/impl/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml b/aaa-shiro/impl/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml index 0c6e0d7b4..0140ec490 100644 --- a/aaa-shiro/impl/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml +++ b/aaa-shiro/impl/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml @@ -33,7 +33,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html - + -- 2.36.6