spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lewuathe <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-12302][EXAMPLES] Example for basic auth...
Date Sat, 12 Dec 2015 10:04:26 GMT
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


Mime
View raw message