From: Maros Marsalek Date: Tue, 14 Jul 2015 08:56:59 +0000 (+0200) Subject: BUG-3963 Remove netconf-usermanager X-Git-Tag: release/beryllium~411 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=d063f1bf6d9f23a3f0abac4e125870587c2741f8 BUG-3963 Remove netconf-usermanager This way of authentication relied on AD-SAL and thats deprecated/removed now from ODL. Change-Id: I0daeee09ff88b1c4677206c1b7216e972d34f01c Signed-off-by: Maros Marsalek --- diff --git a/features/netconf-connector/pom.xml b/features/netconf-connector/pom.xml index ca95d7451d..8d4a5a81d3 100644 --- a/features/netconf-connector/pom.xml +++ b/features/netconf-connector/pom.xml @@ -82,13 +82,13 @@ features xml - + - + mvn:org.opendaylight.aaa/features-aaa/${aaa.version}/xml/features - + odl-aaa-netconf-plugin mvn:org.opendaylight.controller/netconf-ssh/${netconf.version} diff --git a/opendaylight/netconf/netconf-artifacts/pom.xml b/opendaylight/netconf/netconf-artifacts/pom.xml index 4cf8b0a550..1d9e23edea 100644 --- a/opendaylight/netconf/netconf-artifacts/pom.xml +++ b/opendaylight/netconf/netconf-artifacts/pom.xml @@ -112,11 +112,6 @@ netconf-testtool ${project.version} - - ${project.groupId} - netconf-usermanager - ${project.version} - ${project.groupId} netconf-util diff --git a/opendaylight/netconf/netconf-usermanager/pom.xml b/opendaylight/netconf/netconf-usermanager/pom.xml deleted file mode 100644 index 8f8059ae19..0000000000 --- a/opendaylight/netconf/netconf-usermanager/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - 4.0.0 - - org.opendaylight.controller - netconf-subsystem - 0.4.0-SNAPSHOT - ../ - - netconf-usermanager - bundle - ${project.artifactId} - - - - org.opendaylight.controller - netconf-auth - - - org.opendaylight.controller - usermanager - - - com.google.guava - guava - - - - - - - org.apache.felix - maven-bundle-plugin - - - org.opendaylight.controller.netconf.auth.usermanager.AuthProviderActivator - - - - - - - - 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 index 528d8ff828..0000000000 --- a/opendaylight/netconf/netconf-usermanager/src/main/java/org/opendaylight/controller/netconf/auth/usermanager/AuthProviderActivator.java +++ /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 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 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 index cb5874ab24..0000000000 --- a/opendaylight/netconf/netconf-usermanager/src/main/java/org/opendaylight/controller/netconf/auth/usermanager/AuthProviderImpl.java +++ /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 customizer = new ServiceTrackerCustomizer() { - @Override - public IUserManager addingService(final ServiceReference reference) { - LOG.trace("UerManager {} added", reference); - nullableUserManager = bundleContext.getService(reference); - return nullableUserManager; - } - - @Override - public void modifiedService(final ServiceReference reference, final IUserManager service) { - LOG.trace("Replacing modified UerManager {}", reference); - nullableUserManager = service; - } - - @Override - public void removedService(final ServiceReference reference, final IUserManager service) { - LOG.trace("Removing UerManager {}. This AuthProvider will fail to authenticate every time", reference); - synchronized (AuthProviderImpl.this) { - nullableUserManager = null; - } - } - }; - final ServiceTracker 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; - } -} diff --git a/opendaylight/netconf/pom.xml b/opendaylight/netconf/pom.xml index e2d834fee8..c5ffc80205 100644 --- a/opendaylight/netconf/pom.xml +++ b/opendaylight/netconf/pom.xml @@ -37,7 +37,6 @@ netconf-connector-config netconf-mdsal-config netconf-auth - netconf-usermanager netconf-testtool netconf-notifications-impl netconf-notifications-api