Github user revans2 commented on a diff in the pull request:

    https://github.com/apache/storm/pull/2752#discussion_r206235453
  
    --- Diff: 
storm-webapp/src/main/java/org/apache/storm/daemon/ui/UIServer.java ---
    @@ -0,0 +1,154 @@
    +/*
    + * 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.storm.daemon.ui;
    +
    +import java.nio.file.Files;
    +import java.nio.file.Paths;
    +import java.util.EnumSet;
    +import java.util.Map;
    +import javax.servlet.DispatcherType;
    +import org.apache.storm.DaemonConfig;
    +import org.apache.storm.daemon.drpc.webapp.ReqContextFilter;
    +import 
org.apache.storm.daemon.ui.exceptionmappers.AuthorizationExceptionMapper;
    +import org.apache.storm.daemon.ui.exceptionmappers.NotAliveExceptionMapper;
    +import org.apache.storm.daemon.ui.exceptionmappers.TExceptionMapper;
    +import org.apache.storm.daemon.ui.filters.AuthorizedUserFilter;
    +import org.apache.storm.daemon.ui.filters.HeaderResponseFilter;
    +import org.apache.storm.daemon.ui.filters.HeaderResponseServletFilter;
    +import org.apache.storm.metric.StormMetricsRegistry;
    +import org.apache.storm.security.auth.IHttpCredentialsPlugin;
    +import org.apache.storm.security.auth.ServerAuthUtils;
    +import org.apache.storm.utils.Utils;
    +import org.eclipse.jetty.server.Server;
    +import org.eclipse.jetty.server.ServerConnector;
    +import org.eclipse.jetty.servlet.DefaultServlet;
    +import org.eclipse.jetty.servlet.FilterHolder;
    +import org.eclipse.jetty.servlet.ServletContextHandler;
    +import org.eclipse.jetty.servlet.ServletHolder;
    +
    +import org.glassfish.jersey.server.ResourceConfig;
    +import org.glassfish.jersey.servlet.ServletContainer;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +
    +
    +import static org.apache.storm.utils.ConfigUtils.FILE_SEPARATOR;
    +import static org.apache.storm.utils.ConfigUtils.STORM_HOME;
    +
    +/**
    + * Main class.
    + *
    + */
    +public class UIServer {
    +
    +    public static final Logger LOG = 
LoggerFactory.getLogger(UIServer.class);
    +
    +    public static final String STORM_API_URL_PREFIX = "/api/v1/";
    +
    +    /**
    +     * addRequestContextFilter.
    +     * @param context context
    +     * @param configName configName
    +     * @param conf conf
    +     */
    +    public static void addRequestContextFilter(ServletContextHandler 
context,
    +                                               String configName, 
Map<String, Object> conf) {
    +        IHttpCredentialsPlugin auth = 
ServerAuthUtils.getHttpCredentialsPlugin(conf, (String) conf.get(configName));
    +        ReqContextFilter filter = new ReqContextFilter(auth);
    +        context.addFilter(new FilterHolder(filter), "/*", 
EnumSet.allOf(DispatcherType.class));
    +    }
    +
    +    /**
    +     * main.
    +     * @param args args
    +     */
    +    public static void main(String[] args) {
    +
    +        Server jettyServer = new Server();
    +        ServerConnector connector = new ServerConnector(jettyServer);
    +        // connector.setPort((Integer) conf.get(DaemonConfig.UI_PORT));
    +        connector.setPort(4443);
    --- End diff --
    
    Need to remove the hard coded port number


---

Reply via email to