Partially revert "Convert ODLAuthenticator into a component" 84/102184/1
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 20 Aug 2022 14:28:42 +0000 (16:28 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Sat, 20 Aug 2022 14:30:50 +0000 (16:30 +0200)
This reverts commit f76949418fb149c1c29b08eb0283ca0351098308, and
re-establishes instantiation of ODLAuthenticator from blueprint, as
it is using static wiring provided by Blueprint.

JIRA: AAA-215
Change-Id: Ie35f556a0d5292f2dd9ee243c68abaa0ac6cc10d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
aaa-shiro/impl/src/main/java/org/opendaylight/aaa/authenticator/ODLAuthenticator.java
aaa-shiro/impl/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml

index a9466e6e5565590951b5bc556d5b34a98ce176c0..144530a4ec672d68efa50bd3ba9b1d62ebbcbd49 100644 (file)
@@ -9,8 +9,6 @@ package org.opendaylight.aaa.authenticator;
 
 import java.nio.charset.StandardCharsets;
 import java.util.Base64;
-import javax.inject.Inject;
-import javax.inject.Singleton;
 import javax.servlet.http.HttpServletRequest;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.ShiroException;
@@ -20,23 +18,15 @@ import org.apache.shiro.session.Session;
 import org.apache.shiro.session.UnknownSessionException;
 import org.apache.shiro.subject.Subject;
 import org.jolokia.osgi.security.Authenticator;
-import org.osgi.service.component.annotations.Component;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * AAA hook for <code>odl-jolokia</code> configured w/ <code>org.jolokia.authMode=service-all</code>.
  */
-@Singleton
-@Component(immediate = true)
 public class ODLAuthenticator implements Authenticator {
     private static final Logger LOG = LoggerFactory.getLogger(ODLAuthenticator.class);
 
-    @Inject
-    public ODLAuthenticator() {
-        // Exposed for DI
-    }
-
     @Override
     public boolean authenticate(final HttpServletRequest httpServletRequest) {
         final String authorization = httpServletRequest.getHeader("Authorization");
index 2742eb73dc00a54cdf53d64396751c5d592f0bf7..6d8a78935cab979b0720d8720a97b16a05f5dfbe 100644 (file)
@@ -53,6 +53,9 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
     <argument ref="passwordService" />
   </bean>
 
+  <bean id="authenticator" class="org.opendaylight.aaa.authenticator.ODLAuthenticator" />
+  <service ref="authenticator" interface="org.jolokia.osgi.security.Authenticator" />
+
   <bean id="shiroWebEnvLoader" class="org.opendaylight.aaa.shiro.web.env.ShiroWebEnvironmentLoaderListener">
     <argument ref="shiroConfiguration"/>
     <argument ref="dataBroker"/>