Revert "Add PasswordCredentialAuth interface" 89/36489/1
authorTomas Cere <tcere@cisco.com>
Mon, 21 Mar 2016 09:57:30 +0000 (09:57 +0000)
committerTomas Cere <tcere@cisco.com>
Mon, 21 Mar 2016 09:57:30 +0000 (09:57 +0000)
This reverts commit 57bfaf2a0146d33a9a504b5a48c5525916a44b79.

Change-Id: I5516089a829fb9b76586289080f78c7343366f21
Signed-off-by: Tomas Cere <tcere@cisco.com>
netconf/aaa-authn-odl-plugin/src/main/java/org/opendaylight/aaa/odl/CredentialServiceAuthProvider.java
netconf/aaa-authn-odl-plugin/src/main/java/org/opendaylight/aaa/odl/PasswordCredentialAuth.java [deleted file]
netconf/aaa-authn-odl-plugin/src/test/java/org/opendaylight/aaa/odl/CredentialServiceAuthProviderTest.java

index 2fb22dbe56b9586aacfae67c007961514fa808eb..fe1f21c064e6cdc6a94463302cccb174ad072f7c 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.aaa.odl;
 import java.util.Map;
 import org.opendaylight.aaa.api.AuthenticationException;
 import org.opendaylight.aaa.api.Claim;
+import org.opendaylight.aaa.api.CredentialAuth;
 import org.opendaylight.aaa.api.PasswordCredentials;
 import org.opendaylight.netconf.auth.AuthProvider;
 import org.osgi.framework.BundleContext;
@@ -31,34 +32,36 @@ public final class CredentialServiceAuthProvider implements AuthProvider, AutoCl
      */
     public static volatile Map.Entry<BundleContext, CredentialServiceAuthProvider> INSTANCE;
 
-    private volatile PasswordCredentialAuth nullableCredService;
-    private final ServiceTracker<PasswordCredentialAuth, PasswordCredentialAuth> listenerTracker;
+    // FIXME CredentialAuth is generic and it causes warnings during compilation
+    // Maybe there should be a PasswordCredentialAuth implements CredentialAuth<PasswordCredentials>
+    private volatile CredentialAuth<PasswordCredentials> nullableCredService;
+    private final ServiceTracker<CredentialAuth, CredentialAuth> listenerTracker;
 
     public CredentialServiceAuthProvider(final BundleContext bundleContext) {
 
-        final ServiceTrackerCustomizer<PasswordCredentialAuth, PasswordCredentialAuth> customizer = new ServiceTrackerCustomizer<PasswordCredentialAuth, PasswordCredentialAuth>() {
+        final ServiceTrackerCustomizer<CredentialAuth, CredentialAuth> customizer = new ServiceTrackerCustomizer<CredentialAuth, CredentialAuth>() {
             @Override
-            public PasswordCredentialAuth addingService(final ServiceReference<PasswordCredentialAuth> reference) {
+            public CredentialAuth addingService(final ServiceReference<CredentialAuth> reference) {
                 logger.trace("Credential service {} added", reference);
-                nullableCredService =  bundleContext.getService(reference);
+                nullableCredService = bundleContext.getService(reference);
                 return nullableCredService;
             }
 
             @Override
-            public void modifiedService(final ServiceReference<PasswordCredentialAuth> reference, final PasswordCredentialAuth service) {
+            public void modifiedService(final ServiceReference<CredentialAuth> reference, final CredentialAuth service) {
                 logger.trace("Replacing modified Credential service {}", reference);
                 nullableCredService = service;
             }
 
             @Override
-            public void removedService(final ServiceReference<PasswordCredentialAuth> reference, final PasswordCredentialAuth service) {
+            public void removedService(final ServiceReference<CredentialAuth> reference, final CredentialAuth service) {
                 logger.trace("Removing Credential service {}. This AuthProvider will fail to authenticate every time", reference);
                 synchronized (CredentialServiceAuthProvider.this) {
                     nullableCredService = null;
                 }
             }
         };
-        listenerTracker = new ServiceTracker<>(bundleContext, PasswordCredentialAuth.class, customizer);
+        listenerTracker = new ServiceTracker<>(bundleContext, CredentialAuth.class, customizer);
         listenerTracker.open();
     }
 
diff --git a/netconf/aaa-authn-odl-plugin/src/main/java/org/opendaylight/aaa/odl/PasswordCredentialAuth.java b/netconf/aaa-authn-odl-plugin/src/main/java/org/opendaylight/aaa/odl/PasswordCredentialAuth.java
deleted file mode 100644 (file)
index 0fc2024..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright (c) 2016 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.aaa.odl;
-
-import org.opendaylight.aaa.api.CredentialAuth;
-import org.opendaylight.aaa.api.PasswordCredentials;
-
-public interface PasswordCredentialAuth extends CredentialAuth<PasswordCredentials> {
-}
index 0a025e32b17a0d095f97761f231ba6b774469e09..4962256717fb3bc0b7b59fb3a377a4051a465e5f 100644 (file)
@@ -26,6 +26,7 @@ import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
 import org.opendaylight.aaa.api.AuthenticationException;
 import org.opendaylight.aaa.api.Claim;
+import org.opendaylight.aaa.api.CredentialAuth;
 import org.opendaylight.aaa.api.PasswordCredentials;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Filter;
@@ -36,7 +37,7 @@ import org.osgi.framework.ServiceReference;
 public class CredentialServiceAuthProviderTest {
 
     @Mock
-    private PasswordCredentialAuth credAuth;
+    private CredentialAuth<PasswordCredentials> credAuth;
     @Mock
     private BundleContext ctx;