Propagate PasswordCredentialAuth to AAAShiroProvider 28/89628/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 5 May 2020 10:17:54 +0000 (12:17 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 5 May 2020 10:17:54 +0000 (12:17 +0200)
This makes it a bit cleaner and more obvious what sort of injection
needs to happen.

Change-Id: I385179ff1fdc2aaea431f28b0a5697b08358bc3e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
aaa-shiro/impl/src/main/java/org/opendaylight/aaa/AAAShiroProvider.java

index 06b2e22e553ed5ada0b12f9a61ff25e7c7de3737..6728c57b43b3582f588be2be1a06b1aba1070b0d 100644 (file)
@@ -12,10 +12,9 @@ import static java.util.Objects.requireNonNull;
 import java.util.concurrent.CompletableFuture;
 import javax.servlet.ServletException;
 import org.opendaylight.aaa.api.AuthenticationService;
-import org.opendaylight.aaa.api.CredentialAuth;
 import org.opendaylight.aaa.api.IDMStoreException;
 import org.opendaylight.aaa.api.IIDMStore;
-import org.opendaylight.aaa.api.PasswordCredentials;
+import org.opendaylight.aaa.api.PasswordCredentialAuth;
 import org.opendaylight.aaa.api.StoreBuilder;
 import org.opendaylight.aaa.api.TokenStore;
 import org.opendaylight.aaa.api.password.service.PasswordHashService;
@@ -55,7 +54,7 @@ public final class AAAShiroProvider {
      */
     public AAAShiroProvider(final DataBroker dataBroker,
                             final ICertificateManager certificateManager,
-                            final CredentialAuth<PasswordCredentials> credentialAuth,
+                            final PasswordCredentialAuth credentialAuth,
                             final ShiroConfiguration shiroConfiguration,
                             final HttpService httpService,
                             final String moonEndpointPath,
@@ -84,7 +83,7 @@ public final class AAAShiroProvider {
 
         initializeIIDMStore(iidmStore);
 
-        tokenAuthenticators = buildTokenAuthenticators(credentialAuth);
+        tokenAuthenticators = new TokenAuthenticators(new HttpBasicAuth(credentialAuth));
 
         try {
             this.registerServletContexts();
@@ -95,11 +94,6 @@ public final class AAAShiroProvider {
         INSTANCE_FUTURE.complete(this);
     }
 
-    private static TokenAuthenticators buildTokenAuthenticators(
-            final CredentialAuth<PasswordCredentials> credentialAuth) {
-        return new TokenAuthenticators(new HttpBasicAuth(credentialAuth));
-    }
-
     private void registerServletContexts() throws ServletException, NamespaceException {
         LOG.info("attempting registration of AAA moon servlet");
         requireNonNull(httpService, "httpService cannot be null").registerServlet(moonEndpointPath,