You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by Lewuathe <gi...@git.apache.org> on 2015/12/12 04:30:06 UTC

[GitHub] spark pull request: [SPARK-12302] Example for basic authentication...

GitHub user Lewuathe opened a pull request:

    https://github.com/apache/spark/pull/10273

    [SPARK-12302] Example for basic authentication filter used by spark.u…

    …i.filters
    
    Although `spark.ui.filters` configuration uses simple servlet filter, it is often difficult to understand how to write filter code and how to integrate actual spark applications for a developer who are not familiar with servlet and spark itself.
    It can be help to write examples for trying secure Spark cluster.

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

    $ git pull https://github.com/Lewuathe/spark SPARK-12302

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

    https://github.com/apache/spark/pull/10273.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 #10273
    
----
commit d93c55a18c357c100e60dabb0bb2a535ea10b476
Author: Lewuathe <le...@me.com>
Date:   2015-12-12T03:28:53Z

    [SPARK-12302] Example for basic authentication filter used by spark.ui.filters

----


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12302][EXAMPLES] Example for basic auth...

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

    https://github.com/apache/spark/pull/10273#discussion_r47430070
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/BasicAuthFilter.java ---
    @@ -0,0 +1,108 @@
    +/*
    + * 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.spark.examples;
    +
    +import com.sun.jersey.core.util.Base64;
    +
    +import java.io.IOException;
    +import java.io.UnsupportedEncodingException;
    +import java.util.StringTokenizer;
    +import javax.servlet.FilterConfig;
    +import javax.servlet.ServletException;
    +import javax.servlet.ServletRequest;
    +import javax.servlet.ServletResponse;
    +import javax.servlet.http.HttpServletRequest;
    +import javax.servlet.http.HttpServletResponse;
    +import javax.servlet.Filter;
    +import javax.servlet.FilterChain;
    +
    +/**
    + *  Servlet filter example for Spark web UI.
    + *  BasicAuthFilter provides a functionality of basic authentication.
    + *  The credentials of the filter are "spark-user:spark-password".
    + *
    + *  Usage:
    + *
    + *  $ $SPARK_HOME/bin/spark-submit \
    + *      --jars examples/target/spark-examples_2.10-1.6.0-SNAPSHOT.jar \
    + *      --master <Master URL of your Spark cluster> \
    + *      --conf spark.ui.filters=org.apache.spark.examples.BasicAuthFilter
    + *
    + *  The web UI of your application will ask you username and password.
    + *  Required credentials information is
    + *    username: "spark-user"
    + *    password: "spark-password"
    + */
    +public class BasicAuthFilter implements Filter {
    --- End diff --
    
    You're reimplementing what other libraries and app servers can do for you already though. I don't think this belongs in Spark, especially as we'd have to clean up this code anyway.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12302][EXAMPLES] Example for basic auth...

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

    https://github.com/apache/spark/pull/10273#discussion_r47426522
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/BasicAuthFilter.java ---
    @@ -0,0 +1,108 @@
    +/*
    + * 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.spark.examples;
    +
    +import com.sun.jersey.core.util.Base64;
    +
    +import java.io.IOException;
    +import java.io.UnsupportedEncodingException;
    +import java.util.StringTokenizer;
    +import javax.servlet.FilterConfig;
    +import javax.servlet.ServletException;
    +import javax.servlet.ServletRequest;
    +import javax.servlet.ServletResponse;
    +import javax.servlet.http.HttpServletRequest;
    +import javax.servlet.http.HttpServletResponse;
    +import javax.servlet.Filter;
    +import javax.servlet.FilterChain;
    +
    +/**
    + *  Servlet filter example for Spark web UI.
    + *  BasisAuthFilter provides a functionality of basic authentication.
    --- End diff --
    
    A typo - s/Basis/Basic


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12302][EXAMPLES] Example for basic auth...

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

    https://github.com/apache/spark/pull/10273#discussion_r47426529
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/BasicAuthFilter.java ---
    @@ -0,0 +1,108 @@
    +/*
    + * 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.spark.examples;
    +
    +import com.sun.jersey.core.util.Base64;
    +
    +import java.io.IOException;
    +import java.io.UnsupportedEncodingException;
    +import java.util.StringTokenizer;
    +import javax.servlet.FilterConfig;
    +import javax.servlet.ServletException;
    +import javax.servlet.ServletRequest;
    +import javax.servlet.ServletResponse;
    +import javax.servlet.http.HttpServletRequest;
    +import javax.servlet.http.HttpServletResponse;
    +import javax.servlet.Filter;
    +import javax.servlet.FilterChain;
    +
    +/**
    + *  Servlet filter example for Spark web UI.
    + *  BasisAuthFilter provides a functionality of basic authentication.
    + *  The credential of this filter is for "spark-user:spark-password".
    --- End diff --
    
    The credentials of the filter are...


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12302][EXAMPLES] Example for basic auth...

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

    https://github.com/apache/spark/pull/10273#discussion_r47429417
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/BasicAuthFilter.java ---
    @@ -0,0 +1,108 @@
    +/*
    + * 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.spark.examples;
    +
    +import com.sun.jersey.core.util.Base64;
    +
    +import java.io.IOException;
    +import java.io.UnsupportedEncodingException;
    +import java.util.StringTokenizer;
    +import javax.servlet.FilterConfig;
    +import javax.servlet.ServletException;
    +import javax.servlet.ServletRequest;
    +import javax.servlet.ServletResponse;
    +import javax.servlet.http.HttpServletRequest;
    +import javax.servlet.http.HttpServletResponse;
    +import javax.servlet.Filter;
    +import javax.servlet.FilterChain;
    +
    +/**
    + *  Servlet filter example for Spark web UI.
    + *  BasicAuthFilter provides a functionality of basic authentication.
    + *  The credentials of the filter are "spark-user:spark-password".
    + *
    + *  Usage:
    + *
    + *  $ $SPARK_HOME/bin/spark-submit \
    + *      --jars examples/target/spark-examples_2.10-1.6.0-SNAPSHOT.jar \
    + *      --master <Master URL of your Spark cluster> \
    + *      --conf spark.ui.filters=org.apache.spark.examples.BasicAuthFilter
    + *
    + *  The web UI of your application will ask you username and password.
    + *  Required credentials information is
    + *    username: "spark-user"
    + *    password: "spark-password"
    + */
    +public class BasicAuthFilter implements Filter {
    --- End diff --
    
    This seems excessively complex as an example of a filter. I don't think it's a great example either since it doesn't show authenticating against an actual domain. There are a lot of style problems in this code to. I would not merge this.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12302][EXAMPLES] Example for basic auth...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/10273#issuecomment-164112268
  
    **[Test build #47609 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/47609/consoleFull)** for PR 10273 at commit [`9320bf8`](https://github.com/apache/spark/commit/9320bf8b5371672c8688b80abc530aa920cb82b7).


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12302][EXAMPLES] Example for basic auth...

Posted by Lewuathe <gi...@git.apache.org>.
Github user Lewuathe commented on the pull request:

    https://github.com/apache/spark/pull/10273#issuecomment-166557625
  
    @srowen Sorry for late. Sure I close the PR. Thanks.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12302][EXAMPLES] Example for basic auth...

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

    https://github.com/apache/spark/pull/10273


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12302][EXAMPLES] Example for basic auth...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/10273#issuecomment-164113472
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/47609/
    Test PASSed.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12302][EXAMPLES] Example for basic auth...

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the pull request:

    https://github.com/apache/spark/pull/10273#issuecomment-165988026
  
    OK, I'd like to resolve this as wont-fix. The example here stays around in any event. Do you mind closing this PR?


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12302][EXAMPLES] Example for basic auth...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/10273#issuecomment-164113471
  
    Merged build finished. Test PASSed.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12302][EXAMPLES] Example for basic auth...

Posted by tgravescs <gi...@git.apache.org>.
Github user tgravescs commented on the pull request:

    https://github.com/apache/spark/pull/10273#issuecomment-164582372
  
    I kind of agree with @srowen on this.  I wrote the security docs and left out the specifics for writing a filter as I figured either your company would already have one to use with common auth services or you could find better documentation and examples then what I could provide in a short doc about Spark.  There is nothing Spark specific about the filter so it feels like it would be better to point to something rather then us having to maintain the filter itself.
    
    is there perhaps something we could add to the documentation to make it more clear or give the user?
    
    Doing a quick search on the web returns multiple examples of writing a filter with auth.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12302][EXAMPLES] Example for basic auth...

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

    https://github.com/apache/spark/pull/10273#discussion_r47430035
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/BasicAuthFilter.java ---
    @@ -0,0 +1,108 @@
    +/*
    + * 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.spark.examples;
    +
    +import com.sun.jersey.core.util.Base64;
    +
    +import java.io.IOException;
    +import java.io.UnsupportedEncodingException;
    +import java.util.StringTokenizer;
    +import javax.servlet.FilterConfig;
    +import javax.servlet.ServletException;
    +import javax.servlet.ServletRequest;
    +import javax.servlet.ServletResponse;
    +import javax.servlet.http.HttpServletRequest;
    +import javax.servlet.http.HttpServletResponse;
    +import javax.servlet.Filter;
    +import javax.servlet.FilterChain;
    +
    +/**
    + *  Servlet filter example for Spark web UI.
    + *  BasicAuthFilter provides a functionality of basic authentication.
    + *  The credentials of the filter are "spark-user:spark-password".
    + *
    + *  Usage:
    + *
    + *  $ $SPARK_HOME/bin/spark-submit \
    + *      --jars examples/target/spark-examples_2.10-1.6.0-SNAPSHOT.jar \
    + *      --master <Master URL of your Spark cluster> \
    + *      --conf spark.ui.filters=org.apache.spark.examples.BasicAuthFilter
    + *
    + *  The web UI of your application will ask you username and password.
    + *  Required credentials information is
    + *    username: "spark-user"
    + *    password: "spark-password"
    + */
    +public class BasicAuthFilter implements Filter {
    --- End diff --
    
    We can make this filter simpler to removing overkill validations and tokenizers. 
    
    Although this filter is not against an actual domain (yet only hard-coded credentials), it was difficult to integrate servlet filter with our Spark environment with only [security documentation](https://spark.apache.org/docs/latest/security.html) for us. 
    Therefore I think some type of filter example is helpful anyway. So could you give us an idea, if possible, what kind of scenario can be sufficient as an example for developers who are trying to integrate servlet filter with Spark cluster?
    Or writing sample code into documentation might be somewhat helpful.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12302][EXAMPLES] Example for basic auth...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/10273#issuecomment-164107812
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/47607/
    Test PASSed.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12302][EXAMPLES] Example for basic auth...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/10273#issuecomment-164107811
  
    Merged build finished. Test PASSed.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12302][EXAMPLES] Example for basic auth...

Posted by andrewor14 <gi...@git.apache.org>.
Github user andrewor14 commented on the pull request:

    https://github.com/apache/spark/pull/10273#issuecomment-164579508
  
    @tgravescs


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12302][EXAMPLES] Example for basic auth...

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

    https://github.com/apache/spark/pull/10273#discussion_r47430092
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/BasicAuthFilter.java ---
    @@ -0,0 +1,108 @@
    +/*
    + * 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.spark.examples;
    +
    +import com.sun.jersey.core.util.Base64;
    +
    +import java.io.IOException;
    +import java.io.UnsupportedEncodingException;
    +import java.util.StringTokenizer;
    +import javax.servlet.FilterConfig;
    +import javax.servlet.ServletException;
    +import javax.servlet.ServletRequest;
    +import javax.servlet.ServletResponse;
    +import javax.servlet.http.HttpServletRequest;
    +import javax.servlet.http.HttpServletResponse;
    +import javax.servlet.Filter;
    +import javax.servlet.FilterChain;
    +
    +/**
    + *  Servlet filter example for Spark web UI.
    + *  BasicAuthFilter provides a functionality of basic authentication.
    + *  The credentials of the filter are "spark-user:spark-password".
    + *
    + *  Usage:
    + *
    + *  $ $SPARK_HOME/bin/spark-submit \
    + *      --jars examples/target/spark-examples_2.10-1.6.0-SNAPSHOT.jar \
    + *      --master <Master URL of your Spark cluster> \
    + *      --conf spark.ui.filters=org.apache.spark.examples.BasicAuthFilter
    + *
    + *  The web UI of your application will ask you username and password.
    + *  Required credentials information is
    + *    username: "spark-user"
    + *    password: "spark-password"
    + */
    +public class BasicAuthFilter implements Filter {
    --- End diff --
    
    Okay, thanks for comments.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12302][EXAMPLES] Example for basic auth...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/10273#issuecomment-164113454
  
    **[Test build #47609 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/47609/consoleFull)** for PR 10273 at commit [`9320bf8`](https://github.com/apache/spark/commit/9320bf8b5371672c8688b80abc530aa920cb82b7).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:\n  * `public class BasicAuthFilter implements Filter `\n


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12302][EXAMPLES] Example for basic auth...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/10273#issuecomment-164105914
  
    **[Test build #47607 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/47607/consoleFull)** for PR 10273 at commit [`d93c55a`](https://github.com/apache/spark/commit/d93c55a18c357c100e60dabb0bb2a535ea10b476).


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-12302][EXAMPLES] Example for basic auth...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/10273#issuecomment-164107677
  
    **[Test build #47607 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/47607/consoleFull)** for PR 10273 at commit [`d93c55a`](https://github.com/apache/spark/commit/d93c55a18c357c100e60dabb0bb2a535ea10b476).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:\n  * `public class BasicAuthFilter implements Filter `\n


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org