2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.aaa.odl;
11 import java.util.Hashtable;
13 import org.opendaylight.controller.netconf.auth.AuthConstants;
14 import org.opendaylight.controller.netconf.auth.AuthProvider;
15 import org.osgi.framework.BundleActivator;
16 import org.osgi.framework.BundleContext;
17 import org.osgi.framework.ServiceRegistration;
19 public class AuthProviderActivator implements BundleActivator {
21 public static final int PREFERENCE = 10;
22 private ServiceRegistration<AuthProvider> authProviderServiceRegistration;
25 public void start(final BundleContext context) throws Exception {
26 final AuthProvider authProvider = new CredentialServiceAuthProvider(context);
27 // Set preference of this service to 0
28 final Hashtable<String, Object> properties = new Hashtable<>(1);
29 properties.put(AuthConstants.SERVICE_PREFERENCE_KEY, PREFERENCE);
31 authProviderServiceRegistration = context.registerService(AuthProvider.class, authProvider, properties);
35 public void stop(final BundleContext context) throws Exception {
36 if(authProviderServiceRegistration != null) {
37 authProviderServiceRegistration.unregister();