eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m.@apache.org
Subject incubator-eagle git commit: [EAGLE-621] set authentication disabled by default when no 'auth' is configured
Date Mon, 17 Oct 2016 02:44:48 GMT
Repository: incubator-eagle
Updated Branches:
  refs/heads/master 33b972065 -> b103e201e


[EAGLE-621] set authentication disabled by default when no 'auth' is configured

Authentication settings are configured in configuration.yml file, starting with "auth" syntax.
Now make the system see authentication as disabled when no auth related syntax is set.

Also, do some refactoring to make the code clearer.

Author: anyway1021 <mw@apache.org>

Closes #514 from anyway1021/EAGLE-621.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/b103e201
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/b103e201
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/b103e201

Branch: refs/heads/master
Commit: b103e201ebe7b1500ba3d0297bb7aa88e7aa811a
Parents: 33b9720
Author: anyway1021 <mw@apache.org>
Authored: Mon Oct 17 10:44:36 2016 +0800
Committer: anyway1021 <mw@apache.org>
Committed: Mon Oct 17 10:44:36 2016 +0800

----------------------------------------------------------------------
 .../apache/eagle/server/ServerApplication.java  |   8 +-
 .../authentication/AuthenticationMode.java      |  51 ---------
 .../AuthenticationModeIdentifier.java           | 105 -------------------
 .../authentication/AuthenticationRegister.java  |  41 --------
 .../BasicAuthProviderBuilder.java               |  66 ++++++++++++
 .../SwitchableBasicAuthProvider.java            |  50 ---------
 .../AbstractSwitchableAuthenticator.java        |  48 ---------
 .../authenticator/LdapBasicAuthenticator.java   |  11 +-
 .../authenticator/SimpleBasicAuthenticator.java |  12 +--
 9 files changed, 82 insertions(+), 310 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/b103e201/eagle-server/src/main/java/org/apache/eagle/server/ServerApplication.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/ServerApplication.java b/eagle-server/src/main/java/org/apache/eagle/server/ServerApplication.java
index 2ae95a6..df1d7e7 100644
--- a/eagle-server/src/main/java/org/apache/eagle/server/ServerApplication.java
+++ b/eagle-server/src/main/java/org/apache/eagle/server/ServerApplication.java
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 package org.apache.eagle.server;
+
 import com.google.inject.Injector;
 import com.hubspot.dropwizard.guice.GuiceBundle;
 import com.sun.jersey.api.core.PackagesResourceConfig;
@@ -27,11 +28,10 @@ import io.swagger.jaxrs.config.BeanConfig;
 import io.swagger.jaxrs.listing.ApiListingResource;
 import org.apache.eagle.alert.coordinator.CoordinatorListener;
 import org.apache.eagle.alert.resource.SimpleCORSFiler;
-import org.apache.eagle.common.authentication.User;
 import org.apache.eagle.log.base.taggedlog.EntityJsonModule;
 import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
 import org.apache.eagle.metadata.service.ApplicationStatusUpdateService;
-import org.apache.eagle.server.authentication.AuthenticationRegister;
+import org.apache.eagle.server.authentication.BasicAuthProviderBuilder;
 import org.apache.eagle.server.managedtask.ApplicationTask;
 import org.apache.eagle.server.module.GuiceBundleLoader;
 
@@ -80,8 +80,8 @@ class ServerApplication extends Application<ServerConfig> {
         environment.servlets().addFilter(SimpleCORSFiler.class.getName(), new SimpleCORSFiler())
             .addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "/*");
 
-        // add authentication filters
-        new AuthenticationRegister<>(configuration, environment, User.class).register();
+        // register authentication provider
+        environment.jersey().register(new BasicAuthProviderBuilder(configuration.getAuth(),
environment).build());
 
         // context listener
         environment.servlets().addServletListeners(new CoordinatorListener());

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/b103e201/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationMode.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationMode.java
b/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationMode.java
deleted file mode 100644
index 8a7208f..0000000
--- a/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationMode.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.server.authentication;
-
-import io.dropwizard.auth.Authenticator;
-import io.dropwizard.auth.CachingAuthenticator;
-import io.dropwizard.auth.basic.BasicCredentials;
-
-public abstract class AuthenticationMode<P> {
-    private static final String PREFIX_VALUE = "Basic";
-
-    protected AuthenticationModeIdentifier identifier = null;
-
-    private Authenticator<BasicCredentials, P> authenticator = null;
-
-    public AuthenticationMode(AuthenticationModeIdentifier identifier) {
-        this.identifier = identifier;
-        this.authenticator = createAuthenticator();
-    }
-
-    abstract Authenticator<BasicCredentials, P> createAuthenticator();
-
-    abstract String getRealm();
-
-    Authenticator<BasicCredentials, P> getAuthenticator() {
-        return identifier.cacheRequired() ? cache(authenticator) : authenticator;
-    }
-
-    private Authenticator<BasicCredentials, P> cache(Authenticator<BasicCredentials,
P> authenticator) {
-        return new CachingAuthenticator<BasicCredentials, P>(identifier.getMetricRegistry(),
authenticator, identifier.getCacheBuilderSpec());
-    }
-
-    AuthenticationModeIdentifier getIdentifier() {
-        return identifier;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/b103e201/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationModeIdentifier.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationModeIdentifier.java
b/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationModeIdentifier.java
deleted file mode 100644
index 979bcbf..0000000
--- a/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationModeIdentifier.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.server.authentication;
-
-import com.codahale.metrics.MetricRegistry;
-import com.google.common.cache.CacheBuilderSpec;
-import io.dropwizard.auth.Authenticator;
-import io.dropwizard.auth.basic.BasicCredentials;
-import io.dropwizard.setup.Environment;
-import org.apache.eagle.common.authentication.User;
-import org.apache.eagle.server.authentication.authenticator.LdapBasicAuthenticator;
-import org.apache.eagle.server.authentication.authenticator.SimpleBasicAuthenticator;
-import org.apache.eagle.server.authentication.config.AuthenticationSettings;
-
-public class AuthenticationModeIdentifier {
-    private static final String SIMPLE_MODE_KEYWORD = "simple";
-    private static final String SIMPLE_MODE_REALM = "SIMPLE_AUTHENTICATION";
-    private static final String LDAP_MODE_KEYWORD = "ldap";
-    private static final String LDAP_MODE_REALM = "LDAP_AUTHENTICATION";
-
-    private AuthenticationSettings settings = null;
-    private Environment environment = null;
-
-    private AuthenticationModeIdentifier(AuthenticationSettings settings, Environment environment)
{
-        this.settings = settings;
-        this.environment = environment;
-    }
-
-    static AuthenticationModeIdentifier initiate(AuthenticationSettings config, Environment
environment) {
-        return new AuthenticationModeIdentifier(config, environment);
-    }
-
-    AuthenticationMode<User> identify() {
-        String modeKeyword = getModeKeyword();
-        if (SIMPLE_MODE_KEYWORD.equalsIgnoreCase(modeKeyword)) {
-            return new AuthenticationMode<User>(this) {
-                public Authenticator<BasicCredentials, User> createAuthenticator()
{
-                    return new SimpleBasicAuthenticator(getIdentifier().getSettings());
-                }
-
-                public String getRealm() {
-                    return AuthenticationModeIdentifier.SIMPLE_MODE_REALM;
-                }
-            };
-        }
-        if (LDAP_MODE_KEYWORD.equalsIgnoreCase(modeKeyword)) {
-            return new AuthenticationMode<User>(this) {
-                public Authenticator<BasicCredentials, User> createAuthenticator()
{
-                    return new LdapBasicAuthenticator(getIdentifier().getSettings());
-                }
-
-                public String getRealm() {
-                    return AuthenticationModeIdentifier.LDAP_MODE_REALM;
-                }
-            };
-        }
-        throw new RuntimeException(String.format("No matching mode can be found: %s", modeKeyword));
-    }
-
-    MetricRegistry getMetricRegistry() {
-        return environment.metrics();
-    }
-
-    boolean cacheRequired() {
-        return settings.needsCaching();
-    }
-
-    boolean authorizationRequired() {
-        return settings.needsAuthorization();
-    }
-
-    boolean parameterAnnotationEnabled() {
-        return settings.byAnnotated();
-    }
-
-    CacheBuilderSpec getCacheBuilderSpec() {
-        return CacheBuilderSpec.parse(settings.getCachePolicy());
-    }
-
-    AuthenticationSettings getSettings() {
-        return settings;
-    }
-
-    private Environment getEnvironment() {
-        return environment;
-    }
-
-    private String getModeKeyword() {
-        return settings.getMode();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/b103e201/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationRegister.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationRegister.java
b/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationRegister.java
deleted file mode 100644
index 65d2171..0000000
--- a/eagle-server/src/main/java/org/apache/eagle/server/authentication/AuthenticationRegister.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.server.authentication;
-
-import io.dropwizard.setup.Environment;
-import org.apache.eagle.common.authentication.User;
-import org.apache.eagle.server.ServerConfig;
-
-import java.security.Principal;
-
-public class AuthenticationRegister<P extends Principal> {
-    private ServerConfig serverConfig = null;
-    private Environment environment = null;
-    private Class<P> principalClass = null;
-
-    public AuthenticationRegister(ServerConfig serverConfig, Environment environment, Class<P>
principalClass) {
-        this.serverConfig = serverConfig;
-        this.environment = environment;
-        this.principalClass = principalClass;
-    }
-
-    public void register() {
-        AuthenticationMode<User> mode = AuthenticationModeIdentifier.initiate(serverConfig.getAuth(),
environment).identify();
-
-        environment.jersey().register(new SwitchableBasicAuthProvider(mode.getAuthenticator(),
mode.getRealm()));
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/b103e201/eagle-server/src/main/java/org/apache/eagle/server/authentication/BasicAuthProviderBuilder.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/BasicAuthProviderBuilder.java
b/eagle-server/src/main/java/org/apache/eagle/server/authentication/BasicAuthProviderBuilder.java
new file mode 100644
index 0000000..e0bb4c1
--- /dev/null
+++ b/eagle-server/src/main/java/org/apache/eagle/server/authentication/BasicAuthProviderBuilder.java
@@ -0,0 +1,66 @@
+package org.apache.eagle.server.authentication;
+
+import com.google.common.cache.CacheBuilderSpec;
+import com.sun.jersey.api.core.HttpContext;
+import com.sun.jersey.api.model.Parameter;
+import com.sun.jersey.core.spi.component.ComponentContext;
+import com.sun.jersey.server.impl.inject.AbstractHttpContextInjectable;
+import com.sun.jersey.spi.inject.Injectable;
+import io.dropwizard.auth.Auth;
+import io.dropwizard.auth.Authenticator;
+import io.dropwizard.auth.CachingAuthenticator;
+import io.dropwizard.auth.basic.BasicAuthProvider;
+import io.dropwizard.auth.basic.BasicCredentials;
+import io.dropwizard.setup.Environment;
+import org.apache.eagle.common.authentication.User;
+import org.apache.eagle.server.authentication.authenticator.LdapBasicAuthenticator;
+import org.apache.eagle.server.authentication.authenticator.SimpleBasicAuthenticator;
+import org.apache.eagle.server.authentication.config.AuthenticationSettings;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class BasicAuthProviderBuilder {
+    private static final String SIMPLE_MODE_REALM = "SIMPLE_AUTHENTICATION";
+    private static final String LDAP_MODE_REALM = "LDAP_AUTHENTICATION";
+    private static final Map<String, BasicAuthProvider<User>> MAPPING = new HashMap<>();
+    private AuthenticationSettings authSettings;
+    private Environment environment;
+
+    public BasicAuthProviderBuilder(AuthenticationSettings authSettings, Environment environment)
{
+        this.authSettings = authSettings;
+        this.environment = environment;
+        Authenticator<BasicCredentials, User> simpleAuthenticator = new SimpleBasicAuthenticator(authSettings.getSimple());
+        Authenticator<BasicCredentials, User> ldapAuthenticator = new LdapBasicAuthenticator(authSettings.getLdap());
+        boolean needsCaching = authSettings.needsCaching();
+        MAPPING.put("simple",
+                new BasicAuthProvider<>(needsCaching ? cache(simpleAuthenticator) :
simpleAuthenticator, SIMPLE_MODE_REALM));
+        MAPPING.put("ldap",
+                new BasicAuthProvider<>(needsCaching ? cache(ldapAuthenticator) : ldapAuthenticator,
LDAP_MODE_REALM));
+    }
+
+    public BasicAuthProvider build() {
+        if (authSettings.isEnabled()) {
+            String mode = authSettings.getMode();
+            if (MAPPING.containsKey(mode)) {
+                return MAPPING.get(mode);
+            } else {
+                throw new RuntimeException(String.format("No matching mode found: %s", mode));
+            }
+        } else {
+            return new BasicAuthProvider<User>(null, "") {
+                public Injectable<?> getInjectable(ComponentContext ic, Auth a, Parameter
c) {
+                    return new AbstractHttpContextInjectable<User>() {
+                        public User getValue(HttpContext c) {
+                            return new User("non-auth");
+                        }
+                    };
+                }
+            };
+        }
+    }
+
+    private Authenticator<BasicCredentials, User> cache(Authenticator<BasicCredentials,
User> authenticator) {
+        return new CachingAuthenticator<>(environment.metrics(), authenticator, CacheBuilderSpec.parse(authSettings.getCachePolicy()));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/b103e201/eagle-server/src/main/java/org/apache/eagle/server/authentication/SwitchableBasicAuthProvider.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/SwitchableBasicAuthProvider.java
b/eagle-server/src/main/java/org/apache/eagle/server/authentication/SwitchableBasicAuthProvider.java
deleted file mode 100644
index 74f286d..0000000
--- a/eagle-server/src/main/java/org/apache/eagle/server/authentication/SwitchableBasicAuthProvider.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.server.authentication;
-
-import com.sun.jersey.api.core.HttpContext;
-import com.sun.jersey.api.model.Parameter;
-import com.sun.jersey.core.spi.component.ComponentContext;
-import com.sun.jersey.server.impl.inject.AbstractHttpContextInjectable;
-import com.sun.jersey.spi.inject.Injectable;
-import io.dropwizard.auth.Auth;
-import io.dropwizard.auth.Authenticator;
-import io.dropwizard.auth.basic.BasicAuthProvider;
-import io.dropwizard.auth.basic.BasicCredentials;
-import org.apache.eagle.server.authentication.authenticator.AbstractSwitchableAuthenticator;
-
-public class SwitchableBasicAuthProvider<P> extends BasicAuthProvider<P> {
-    private AbstractSwitchableAuthenticator<BasicCredentials, P> switchableAuthenticator
= null;
-
-    public SwitchableBasicAuthProvider(Authenticator<BasicCredentials, P> authenticator,
String realm) {
-        super(authenticator, realm);
-        if (authenticator instanceof AbstractSwitchableAuthenticator) {
-            switchableAuthenticator = (AbstractSwitchableAuthenticator<BasicCredentials,
P>) authenticator;
-        }
-    }
-
-    public Injectable<?> getInjectable(ComponentContext ic, Auth a, Parameter c) {
-        if (switchableAuthenticator != null && !switchableAuthenticator.getSettings().isEnabled())
{
-            return new AbstractHttpContextInjectable<P>() {
-                public P getValue(HttpContext c) {
-                    return switchableAuthenticator.getUnauthenticatedPrincipal();
-                }
-            };
-        }
-        return super.getInjectable(ic, a, c);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/b103e201/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/AbstractSwitchableAuthenticator.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/AbstractSwitchableAuthenticator.java
b/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/AbstractSwitchableAuthenticator.java
deleted file mode 100644
index 5ca12fb..0000000
--- a/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/AbstractSwitchableAuthenticator.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.server.authentication.authenticator;
-
-import io.dropwizard.auth.Authenticator;
-import org.apache.eagle.server.authentication.config.AuthenticationSettings;
-
-public abstract class AbstractSwitchableAuthenticator<C, P> implements Authenticator<C,
P> {
-    private AuthenticationSettings settings;
-    private Class<P> principalClass;
-    private P unauthenticatedPrincipal;
-
-    public AbstractSwitchableAuthenticator(AuthenticationSettings settings, Class<P>
principalClass) {
-        this.settings = settings;
-        this.principalClass = principalClass;
-    }
-
-    public AuthenticationSettings getSettings() {
-        return settings;
-    }
-
-    public P getUnauthenticatedPrincipal() {
-        try {
-            if (unauthenticatedPrincipal == null) {
-                unauthenticatedPrincipal = principalClass.newInstance();
-            }
-            return unauthenticatedPrincipal;
-        } catch (InstantiationException e) {
-            throw new RuntimeException(String.format("Filed to instantiate %s", principalClass.getName()),
e);
-        } catch (IllegalAccessException e) {
-            throw new RuntimeException(String.format("Illegal access to %s", principalClass.getName()),
e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/b103e201/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/LdapBasicAuthenticator.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/LdapBasicAuthenticator.java
b/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/LdapBasicAuthenticator.java
index 59abc52..87ebb34 100644
--- a/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/LdapBasicAuthenticator.java
+++ b/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/LdapBasicAuthenticator.java
@@ -18,15 +18,16 @@ package org.apache.eagle.server.authentication.authenticator;
 
 import com.google.common.base.Optional;
 import io.dropwizard.auth.AuthenticationException;
+import io.dropwizard.auth.Authenticator;
 import io.dropwizard.auth.basic.BasicCredentials;
 import org.apache.eagle.common.authentication.User;
-import org.apache.eagle.server.authentication.config.AuthenticationSettings;
+import org.apache.eagle.server.authentication.config.LdapSettings;
 
-public class LdapBasicAuthenticator extends AbstractSwitchableAuthenticator<BasicCredentials,
User> {
-    private AuthenticationSettings config = null;
+public class LdapBasicAuthenticator implements Authenticator<BasicCredentials, User>
{
+    private LdapSettings settings = null;
 
-    public LdapBasicAuthenticator(AuthenticationSettings settings) {
-        super(settings, User.class);
+    public LdapBasicAuthenticator(LdapSettings settings) {
+        this.settings = settings;
     }
 
     public Optional<User> authenticate(BasicCredentials credentials) throws AuthenticationException
{

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/b103e201/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/SimpleBasicAuthenticator.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/SimpleBasicAuthenticator.java
b/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/SimpleBasicAuthenticator.java
index 910bc92..ede3b06 100644
--- a/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/SimpleBasicAuthenticator.java
+++ b/eagle-server/src/main/java/org/apache/eagle/server/authentication/authenticator/SimpleBasicAuthenticator.java
@@ -18,18 +18,18 @@ package org.apache.eagle.server.authentication.authenticator;
 
 import com.google.common.base.Optional;
 import io.dropwizard.auth.AuthenticationException;
+import io.dropwizard.auth.Authenticator;
 import io.dropwizard.auth.basic.BasicCredentials;
 import org.apache.eagle.common.authentication.User;
-import org.apache.eagle.server.authentication.config.AuthenticationSettings;
+import org.apache.eagle.server.authentication.config.SimpleSettings;
 
-public class SimpleBasicAuthenticator extends AbstractSwitchableAuthenticator<BasicCredentials,
User> {
+public class SimpleBasicAuthenticator implements Authenticator<BasicCredentials, User>
{
     private String acceptedUsername = null;
     private String acceptedPassword = null;
 
-    public SimpleBasicAuthenticator(AuthenticationSettings settings) {
-        super(settings, User.class);
-        acceptedUsername = settings.getSimple().getUsername();
-        acceptedPassword = settings.getSimple().getPassword();
+    public SimpleBasicAuthenticator(SimpleSettings settings) {
+        acceptedUsername = settings.getUsername();
+        acceptedPassword = settings.getPassword();
     }
 
     public Optional<User> authenticate(BasicCredentials credentials) throws AuthenticationException
{


Mime
View raw message