You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eagle.apache.org by anyway1021 <gi...@git.apache.org> on 2016/10/16 13:43:51 UTC

[GitHub] incubator-eagle pull request #514: [EAGLE-621] set authentication disabled b...

GitHub user anyway1021 opened a pull request:

    https://github.com/apache/incubator-eagle/pull/514

    [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.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/anyway1021/incubator-eagle EAGLE-621

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-eagle/pull/514.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #514
    
----
commit 377aaff0c2a70013427553fbab27153cf6b80afb
Author: anyway1021 <mw...@apache.org>
Date:   2016-10-16T13:32:05Z

    set authentication disabled by default when no 'auth' is configured in configuration.yml

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-eagle pull request #514: [EAGLE-621] set authentication disabled b...

Posted by haoch <gi...@git.apache.org>.
Github user haoch commented on a diff in the pull request:

    https://github.com/apache/incubator-eagle/pull/514#discussion_r83551893
  
    --- Diff: eagle-server/src/main/java/org/apache/eagle/server/authentication/BasicAuthProviderBuilder.java ---
    @@ -0,0 +1,61 @@
    +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();
    --- End diff --
    
    Better to register static object in static scope instead of in instance constructor, and move check `needsCaching` to `build` method.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-eagle pull request #514: [EAGLE-621] set authentication disabled b...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-eagle/pull/514


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-eagle issue #514: [EAGLE-621] set authentication disabled by defau...

Posted by haoch <gi...@git.apache.org>.
Github user haoch commented on the issue:

    https://github.com/apache/incubator-eagle/pull/514
  
    Very clear refactoring, LGTM.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---