From bb3b0710efe7fb3477d8117a8bd525e15e08b047 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Mon, 9 Nov 2020 18:30:34 +0100 Subject: [PATCH] Convert aaa-authn-odl-plugin to OSGi DS There is no point in keeping blueprint here, remove it. Change-Id: I3819739d7042cd3d2fdee06b3457dc8bd3cd7ce5 Signed-off-by: Robert Varga --- netconf/aaa-authn-odl-plugin/pom.xml | 2 +- .../OSGiCredentialServiceAuthProvider.java | 39 +++++++++++++++++++ .../OSGI-INF/blueprint/aaa-authn-netconf.xml | 21 ---------- 3 files changed, 40 insertions(+), 22 deletions(-) create mode 100644 netconf/aaa-authn-odl-plugin/src/main/java/org/opendaylight/netconf/authprovider/OSGiCredentialServiceAuthProvider.java delete mode 100644 netconf/aaa-authn-odl-plugin/src/main/resources/OSGI-INF/blueprint/aaa-authn-netconf.xml diff --git a/netconf/aaa-authn-odl-plugin/pom.xml b/netconf/aaa-authn-odl-plugin/pom.xml index d28c069f1e..48cdd62d2a 100644 --- a/netconf/aaa-authn-odl-plugin/pom.xml +++ b/netconf/aaa-authn-odl-plugin/pom.xml @@ -36,7 +36,7 @@ org.osgi - org.osgi.core + osgi.cmpn javax.inject diff --git a/netconf/aaa-authn-odl-plugin/src/main/java/org/opendaylight/netconf/authprovider/OSGiCredentialServiceAuthProvider.java b/netconf/aaa-authn-odl-plugin/src/main/java/org/opendaylight/netconf/authprovider/OSGiCredentialServiceAuthProvider.java new file mode 100644 index 0000000000..8d44faf96b --- /dev/null +++ b/netconf/aaa-authn-odl-plugin/src/main/java/org/opendaylight/netconf/authprovider/OSGiCredentialServiceAuthProvider.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2020 PANTHEON.tech, s.r.o. 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.netconf.authprovider; + +import org.opendaylight.aaa.api.PasswordCredentialAuth; +import org.opendaylight.netconf.auth.AuthProvider; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; + +@Component(immediate = true, property = "type=netconf-auth-provider") +// FIXME: merge with CredentialServiceAuthProvider once we have OSGi R7 +public final class OSGiCredentialServiceAuthProvider implements AuthProvider { + @Reference + PasswordCredentialAuth credService; + + private CredentialServiceAuthProvider delegate = null; + + @Override + public boolean authenticated(final String username, final String password) { + return delegate.authenticated(username, password); + } + + @Activate + void activate() { + delegate = new CredentialServiceAuthProvider(credService); + } + + @Deactivate + void deactivate() { + delegate = null; + } +} diff --git a/netconf/aaa-authn-odl-plugin/src/main/resources/OSGI-INF/blueprint/aaa-authn-netconf.xml b/netconf/aaa-authn-odl-plugin/src/main/resources/OSGI-INF/blueprint/aaa-authn-netconf.xml deleted file mode 100644 index e04462b6f3..0000000000 --- a/netconf/aaa-authn-odl-plugin/src/main/resources/OSGI-INF/blueprint/aaa-authn-netconf.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - -- 2.36.6