BUG-3963 Remove netconf-usermanager 92/24092/2
authorMaros Marsalek <mmarsale@cisco.com>
Tue, 14 Jul 2015 08:56:59 +0000 (10:56 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 22 Jul 2015 07:47:34 +0000 (07:47 +0000)
This way of authentication relied on AD-SAL and thats deprecated/removed now
from ODL.

Change-Id: I0daeee09ff88b1c4677206c1b7216e972d34f01c
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
features/netconf-connector/pom.xml
features/netconf-connector/src/main/resources/features.xml
opendaylight/netconf/netconf-artifacts/pom.xml
opendaylight/netconf/netconf-usermanager/pom.xml [deleted file]
opendaylight/netconf/netconf-usermanager/src/main/java/org/opendaylight/controller/netconf/auth/usermanager/AuthProviderActivator.java [deleted file]
opendaylight/netconf/netconf-usermanager/src/main/java/org/opendaylight/controller/netconf/auth/usermanager/AuthProviderImpl.java [deleted file]
opendaylight/netconf/pom.xml

index ca95d74..8d4a5a8 100644 (file)
           <classifier>features</classifier>
           <type>xml</type>
         </dependency>
-        <!-- dependency>
+        <dependency>
           <groupId>org.opendaylight.aaa</groupId>
           <artifactId>features-aaa</artifactId>
           <version>${aaa.version}</version>
           <classifier>features</classifier>
           <type>xml</type>
-        </dependency -->
+        </dependency>
 
     <!--
       Necessary TODO: Put dependencies for bundles directly referenced
index ea44db9..d782555 100644 (file)
@@ -28,7 +28,7 @@
     <!-- FIXME: This introduces cycle between projects, which makes version updates
                 harder. Should be moved to different.
         -->
-    <!-- repository>mvn:org.opendaylight.aaa/features-aaa/${aaa.version}/xml/features</repository -->
+    <repository>mvn:org.opendaylight.aaa/features-aaa/${aaa.version}/xml/features</repository>
     <feature name='odl-netconf-connector-all' version='${project.version}' description='OpenDaylight :: Netconf Connector :: All'>
         <!--
             Necessary TODO:
         <!-- FIXME: This introduces cycle between projects, which makes version updates
                     harder. Should be moved to different.
         -->
-        <!-- feature version='${aaa.version}'>odl-aaa-netconf-plugin</feature -->
+        <feature version='${aaa.version}'>odl-aaa-netconf-plugin</feature>
         <bundle>mvn:org.opendaylight.controller/netconf-ssh/${netconf.version}</bundle>
       </feature>
     <feature name='odl-netconf-tcp' version='${netconf.version}' description="OpenDaylight :: Netconf Connector :: TCP">
index 4cf8b0a..1d9e23e 100644 (file)
                 <artifactId>netconf-testtool</artifactId>
                 <version>${project.version}</version>
             </dependency>
-            <dependency>
-                <groupId>${project.groupId}</groupId>
-                <artifactId>netconf-usermanager</artifactId>
-                <version>${project.version}</version>
-            </dependency>
             <dependency>
                 <groupId>${project.groupId}</groupId>
                 <artifactId>netconf-util</artifactId>
diff --git a/opendaylight/netconf/netconf-usermanager/pom.xml b/opendaylight/netconf/netconf-usermanager/pom.xml
deleted file mode 100644 (file)
index 8f8059a..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
-  ~
-  ~ This program and the accompanying materials are made available under the
-  ~ terms of the Eclipse Public License v1.0 which accompanies this distribution,
-  ~ and is available at http://www.eclipse.org/legal/epl-v10.html
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>netconf-subsystem</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
-        <relativePath>../</relativePath>
-    </parent>
-    <artifactId>netconf-usermanager</artifactId>
-    <packaging>bundle</packaging>
-    <name>${project.artifactId}</name>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.opendaylight.controller</groupId>
-            <artifactId>netconf-auth</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.opendaylight.controller</groupId>
-            <artifactId>usermanager</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.google.guava</groupId>
-            <artifactId>guava</artifactId>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <configuration>
-                    <instructions>
-                        <Bundle-Activator>org.opendaylight.controller.netconf.auth.usermanager.AuthProviderActivator</Bundle-Activator>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-
-</project>
diff --git a/opendaylight/netconf/netconf-usermanager/src/main/java/org/opendaylight/controller/netconf/auth/usermanager/AuthProviderActivator.java b/opendaylight/netconf/netconf-usermanager/src/main/java/org/opendaylight/controller/netconf/auth/usermanager/AuthProviderActivator.java
deleted file mode 100644 (file)
index 528d8ff..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.controller.netconf.auth.usermanager;
-
-import java.util.Hashtable;
-import org.opendaylight.controller.netconf.auth.AuthConstants;
-import org.opendaylight.controller.netconf.auth.AuthProvider;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-
-public class AuthProviderActivator implements BundleActivator {
-
-    public static final int PREFERENCE = 0;
-    private ServiceRegistration<AuthProvider> authProviderServiceRegistration;
-
-    @Override
-    public void start(final BundleContext context) throws Exception {
-        final AuthProvider authProvider = new AuthProviderImpl(context);
-        // Set preference of this service to 0
-        final Hashtable<String, Object> properties = new Hashtable<>(1);
-        properties.put(AuthConstants.SERVICE_PREFERENCE_KEY, PREFERENCE);
-
-        authProviderServiceRegistration = context.registerService(AuthProvider.class, authProvider, properties);
-    }
-
-    @Override
-    public void stop(final BundleContext context) throws Exception {
-        if(authProviderServiceRegistration != null) {
-            authProviderServiceRegistration.unregister();
-        }
-    }
-}
diff --git a/opendaylight/netconf/netconf-usermanager/src/main/java/org/opendaylight/controller/netconf/auth/usermanager/AuthProviderImpl.java b/opendaylight/netconf/netconf-usermanager/src/main/java/org/opendaylight/controller/netconf/auth/usermanager/AuthProviderImpl.java
deleted file mode 100644 (file)
index cb5874a..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.netconf.auth.usermanager;
-
-import com.google.common.annotations.VisibleForTesting;
-import org.opendaylight.controller.netconf.auth.AuthProvider;
-import org.opendaylight.controller.sal.authorization.AuthResultEnum;
-import org.opendaylight.controller.usermanager.IUserManager;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.util.tracker.ServiceTracker;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * AuthProvider implementation delegating to AD-SAL UserManager instance.
- */
-public class AuthProviderImpl implements AuthProvider {
-    private static final Logger LOG = LoggerFactory.getLogger(AuthProviderImpl.class);
-
-    private IUserManager nullableUserManager;
-
-    public AuthProviderImpl(final BundleContext bundleContext) {
-
-        final ServiceTrackerCustomizer<IUserManager, IUserManager> customizer = new ServiceTrackerCustomizer<IUserManager, IUserManager>() {
-            @Override
-            public IUserManager addingService(final ServiceReference<IUserManager> reference) {
-                LOG.trace("UerManager {} added", reference);
-                nullableUserManager = bundleContext.getService(reference);
-                return nullableUserManager;
-            }
-
-            @Override
-            public void modifiedService(final ServiceReference<IUserManager> reference, final IUserManager service) {
-                LOG.trace("Replacing modified UerManager {}", reference);
-                nullableUserManager = service;
-            }
-
-            @Override
-            public void removedService(final ServiceReference<IUserManager> reference, final IUserManager service) {
-                LOG.trace("Removing UerManager {}. This AuthProvider will fail to authenticate every time", reference);
-                synchronized (AuthProviderImpl.this) {
-                    nullableUserManager = null;
-                }
-            }
-        };
-        final ServiceTracker<IUserManager, IUserManager> listenerTracker = new ServiceTracker<>(bundleContext, IUserManager.class, customizer);
-        listenerTracker.open();
-    }
-
-    /**
-     * Authenticate user. This implementation tracks IUserManager and delegates the decision to it. If the service is not
-     * available, IllegalStateException is thrown.
-     */
-    @Override
-    public synchronized boolean authenticated(final String username, final String password) {
-        if (nullableUserManager == null) {
-            LOG.warn("Cannot authenticate user '{}', user manager service is missing", username);
-            throw new IllegalStateException("User manager service is not available");
-        }
-        final AuthResultEnum authResult = nullableUserManager.authenticate(username, password);
-        LOG.debug("Authentication result for user '{}' : {}", username, authResult);
-        return authResult.equals(AuthResultEnum.AUTH_ACCEPT) || authResult.equals(AuthResultEnum.AUTH_ACCEPT_LOC);
-    }
-
-    @VisibleForTesting
-    synchronized void setNullableUserManager(final IUserManager nullableUserManager) {
-        this.nullableUserManager = nullableUserManager;
-    }
-}
index e2d834f..c5ffc80 100644 (file)
@@ -37,7 +37,6 @@
     <module>netconf-connector-config</module>
     <module>netconf-mdsal-config</module>
     <module>netconf-auth</module>
-    <module>netconf-usermanager</module>
     <module>netconf-testtool</module>
     <module>netconf-notifications-impl</module>
     <module>netconf-notifications-api</module>