<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
<!-- 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">
<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>
+++ /dev/null
-<?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>
+++ /dev/null
-/*
- * 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();
- }
- }
-}
+++ /dev/null
-/*
- * 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;
- }
-}
<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>