You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by GitBox <gi...@apache.org> on 2020/02/12 13:26:38 UTC

[GitHub] [knox] smolnar82 opened a new pull request #263: [WIP] KNOX-2226 - Add home page to Knox

smolnar82 opened a new pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263
 
 
   ## What changes were proposed in this pull request?
   
   New landing page for Apache Knox
   
   TODO: more detailed description
   
   ## How was this patch tested?
   
   JUnit:
   ```
   [INFO] ------------------------------------------------------------------------
   [INFO] BUILD SUCCESS
   [INFO] ------------------------------------------------------------------------
   [INFO] Total time: 23:03 min (Wall Clock)
   [INFO] Finished at: 2020-02-12T14:16:43+01:00
   [INFO] Final Memory: 429M/2247M
   [INFO] ------------------------------------------------------------------------
   ```
   
   TODO: detailed manual test (GUI + API)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r379150050
 
 

 ##########
 File path: gateway-service-definitions/src/main/resources/services/hdfsui/3.0.0/service.xml
 ##########
 @@ -16,6 +16,12 @@
    limitations under the License.
 -->
 <service role="HDFSUI" name="hdfs" version="3.0.0">
+    <metadata>
+        <type>UI</type>
+        <context>/hdfs?host=%BACKEND_HOST</context>
 
 Review comment:
   Done.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] moresandeep commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
moresandeep commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r384065726
 
 

 ##########
 File path: gateway-service-definitions/src/main/resources/services/cm-ui/1.0.0/rewrite.xml
 ##########
 @@ -0,0 +1,33 @@
+<!--
+   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.
+-->
+<rules>
+  <rule dir="IN" name="CM-UI/cm-ui/ui/inbound" pattern="*://*:*/**/cmf/{xxx_unique_path=**}?{**}">
+    <rewrite template="{$serviceUrl[CM-UI]}/cmf/{xxx_unique_path=**}?{**}"/>
+  </rule>
+  <rule dir="IN" name="CM-UI/cm-ui/ui/root" pattern="*://*:*/**/cmf/">
+    <rewrite template="{$serviceUrl[CM-UI]}/cmf/"/>
+  </rule>
+  <rule dir="IN" name="CM-UI/cm-ui/static/inbound" pattern="*://*:*/**/static/{xxx_unique_path=**}?{**}">
+    <rewrite template="{$serviceUrl[CM-UI]}/static/{xxx_unique_path=**}?{**}"/>
+  </rule>
+  <rule dir="IN" name="CM-UI/cm-ui/rest" pattern="*://*:*/**/api/{xxx_unique_path=**}?{**}">
 
 Review comment:
   Same as above.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r384022768
 
 

 ##########
 File path: gateway-release/home/conf/topologies/metadata.xml
 ##########
 @@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
 
 Review comment:
   https://issues.apache.org/jira/browse/KNOX-2251

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r385312763
 
 

 ##########
 File path: gateway-service-metadata/src/main/java/org/apache/knox/gateway/service/metadata/ServiceModel.java
 ##########
 @@ -0,0 +1,121 @@
+/*
+ * 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.knox.gateway.service.metadata;
+
+import java.util.Locale;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.knox.gateway.service.definition.Metadata;
+import org.apache.knox.gateway.topology.Service;
+
+@XmlRootElement(name = "service")
+@XmlAccessorType(XmlAccessType.NONE)
+public class ServiceModel {
+
+  public enum Type {
+    API, UI, UNKNOWN
+  };
+
+  protected HttpServletRequest request;
+  protected String topologyName;
+  protected String gatewayPath;
+  protected Service service;
+  protected Metadata serviceMetadata;
+
+  public void setRequest(HttpServletRequest request) {
+    this.request = request;
+  }
+
+  public void setTopologyName(String topologyName) {
+    this.topologyName = topologyName;
+  }
+
+  public void setGatewayPath(String gatewayPath) {
+    this.gatewayPath = gatewayPath;
+  }
+
+  public void setService(Service service) {
+    this.service = service;
+  }
+
+  public void setServiceMetadata(Metadata serviceMetadata) {
+    this.serviceMetadata = serviceMetadata;
+  }
+
+  @XmlElement
+  public String getServiceName() {
+    return this.service == null ? "" : service.getRole();
+  }
+
+  @XmlElement
+  public String getVersion() {
+    return this.service == null ? "" : this.service.getVersion() == null ? "" : this.service.getVersion().toString();
+  }
+
+  @XmlElement(name = "shortDesc")
+  public String getShortDescription() {
+    if (serviceMetadata == null) {
+      return getServiceName().substring(0, 1).toUpperCase(Locale.ROOT) + getServiceName().substring(1).toLowerCase(Locale.ROOT);
+    } else {
+      return serviceMetadata.getShortDesc();
+    }
+  }
+
+  @XmlElement
+  public String getDescription() {
+    if (serviceMetadata == null) {
+      return getShortDescription() + (Type.API == getType() ? " REST API" : Type.UI == getType() ? " Web User Interface" : "");
+    } else {
+      return serviceMetadata.getDescription();
+    }
+  }
+
+  @XmlElement
+  public Type getType() {
+    return serviceMetadata == null ? Type.UNKNOWN : Type.valueOf(serviceMetadata.getType());
+  }
+
+  @XmlElement
+  public String getContext() {
+    return (serviceMetadata == null ? "/" + getServiceName().toLowerCase(Locale.ROOT) : serviceMetadata.getContext()) + "/";
+  }
+
+  @XmlElement
+  public String getServiceUrl() {
+    String context = getContext();
+    if ("HIVE".equals(getServiceName())) {
+      return String.format(Locale.ROOT, "jdbc:hive2://%s:%d/;?hive.server2.transport.mode=http;hive.server2.thrift.http.path=/%s/%s%s", request.getServerName(),
+          request.getServerPort(), gatewayPath, topologyName, context);
+    } else {
+      if (context.indexOf("{{BACKEND_HOST}}") > -1) {
+        context = context.replaceAll("\\{\\{BACKEND_HOST\\}\\}", getBackendServiceUrl());
 
 Review comment:
   I don't think you need `replaceAll` here just `replace` since `replaceAll` is for regex.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378491530
 
 

 ##########
 File path: gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
 ##########
 @@ -923,6 +925,40 @@ private synchronized void internalActivateArchive( Topology topology, File warDi
     }
   }
 
+  private synchronized void activateHomeApp() {
+    try {
+      // UI
+      activateHomepageContext("/home", "homepage/%2Fhome");
 
 Review comment:
   why the weird `%2F` - which is a url encoded forward slash...

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] moresandeep commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
moresandeep commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378351786
 
 

 ##########
 File path: gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
 ##########
 @@ -923,6 +925,40 @@ private synchronized void internalActivateArchive( Topology topology, File warDi
     }
   }
 
+  private synchronized void activateHomeApp() {
+    try {
+      // UI
+      activateHomepageContext("/home", "homepage/%2Fhome");
+
+      // API
+      activateHomepageContext("/home/api", "homepage/%2F");
+    } catch (Throwable e) {
+      e.printStackTrace();
 
 Review comment:
   This might be due to WIP, but we should not be throwing stack traces.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r384082682
 
 

 ##########
 File path: knox-homepage-backend/src/main/java/org/apache/knox/homepage/service/model/ServiceModel.java
 ##########
 @@ -0,0 +1,89 @@
+/*
+ * 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.knox.homepage.service.model;
+
+import java.util.Locale;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.knox.gateway.topology.Service;
+
+@XmlRootElement(name = "service")
+@XmlAccessorType(XmlAccessType.NONE)
+public class ServiceModel {
+
+  public enum Type {
+    API, UI, UNKNOWN
+  };
+
+  protected HttpServletRequest request;
+  protected String topologyName;
+  protected String gatewayPath;
+  protected Service service;
+
+  public void setRequest(HttpServletRequest request) {
+    this.request = request;
+  }
+
+  public void setTopologyName(String topologyName) {
+    this.topologyName = topologyName;
+  }
+
+  public void setGatewayPath(String gatewayPath) {
+    this.gatewayPath = gatewayPath;
+  }
+
+  public void setService(Service service) {
+    this.service = service;
+  }
+
 
 Review comment:
   +1

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r379194833
 
 

 ##########
 File path: gateway-service-definitions/src/main/resources/services/hdfsui/3.0.0/service.xml
 ##########
 @@ -16,6 +16,12 @@
    limitations under the License.
 -->
 <service role="HDFSUI" name="hdfs" version="3.0.0">
+    <metadata>
+        <type>UI</type>
+        <context>/hdfs?host={{BACKEND_HOST}}</context>
 
 Review comment:
   should be `/hdfs/?host=` notice the trailing slash after `/hdfs`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r379299589
 
 

 ##########
 File path: gateway-service-definitions/src/main/resources/services/hdfsui/2.7.0/service.xml
 ##########
 @@ -16,6 +16,12 @@
    limitations under the License.
 -->
 <service role="HDFSUI" name="hdfs" version="2.7.0">
+    <metadata>
+        <type>UI</type>
+        <context>/hdfs?host={{BACKEND_HOST}}</context>
 
 Review comment:
   Fixed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378901874
 
 

 ##########
 File path: knox-homepage-backend/src/main/java/org/apache/knox/homepage/GeneralProxyInformationMarshaller.java
 ##########
 @@ -0,0 +1,89 @@
+/*
+ * 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.knox.homepage;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.ext.Provider;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+
+import org.eclipse.persistence.jaxb.JAXBContextFactory;
+import org.eclipse.persistence.jaxb.JAXBContextProperties;
+
+@Provider
+@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+public class GeneralProxyInformationMarshaller implements MessageBodyWriter<GeneralProxyInformation>{
+  private static Marshaller xmlMarshaller;
+  private static Marshaller jsonMarshaller;
+
+  @Override
+  public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
+    return GeneralProxyInformation.class == type;
+  }
+
+  @Override
+  public long getSize(GeneralProxyInformation t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
+    return -1;
+  }
+
+  @Override
+  public void writeTo(GeneralProxyInformation instance, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType,
+      MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
+    try {
+      getMarshaller(mediaType).marshal(instance, entityStream);
+    } catch (JAXBException e) {
+      throw new IOException(e);
+    }
+  }
+
+  private Marshaller getMarshaller(MediaType mediaType) throws JAXBException {
+    return MediaType.APPLICATION_JSON_TYPE.getSubtype().equals(mediaType.getSubtype()) ? getJsonMarshaller() : getXmlMarshaller();
+  }
+
+  private synchronized Marshaller getXmlMarshaller() throws JAXBException {
 
 Review comment:
   This is the same pattern we have in `gateway-admin-ui`. I agree this should be enhanced but I believe it's out of the scope of this JIRA.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r383929083
 
 

 ##########
 File path: gateway-release/home/conf/topologies/metadata.xml
 ##########
 @@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
 
 Review comment:
   No, it's not. Without this topology, clients (CM, Ambari, etc...) can not query metadata (general proxy info and topology information).
   Please note this can not be added into Admin API because there is no need to authorize the incoming requests.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r385312439
 
 

 ##########
 File path: knox-homepage-ui/homepage/app/generalProxyInformation/general.proxy.information.component.ts
 ##########
 @@ -0,0 +1,113 @@
+/*
+ * 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.
+ */
+import {Component, OnInit} from '@angular/core';
+import {HomepageService} from '../homepage.service';
+import {GeneralProxyInformation} from './general.proxy.information';
+
+@Component({
+    selector: 'app-general-proxy-information',
+    template: `
+            <h4>General Proxy Information</h4>
+            <div class="table-responsive">
+                <table class="table table-striped table-hover">
+                    <tbody>
+                        <tr>
+                            <td>Knox Version</td>
+                            <td>{{ getVersion() }}</td>
+                        </tr>
+                        <tr>
+                            <td>TLS Public Certificate</td>
+                            <td>
+                                <a href="{{ getMetadataAPIUrl('publicCert?type=pem') }}">PEM</a>
+                                &nbsp;&nbsp;|&nbsp;&nbsp;
+                                <a href="{{ getMetadataAPIUrl('publicCert?type=jks') }}">JKS</a>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td>Admin UI URL</td>
+                            <td><a href="{{ getAdminUiUrl() }}" target="_blank">{{ getAdminUiUrl() }}</a></td>
+                        </tr>
+                        <tr>
+                            <td>
+                                Admin API Details
+                                <span class="inline-glyph glyphicon glyphicon-info-sign btn btn-xs"
+                                title="{{ getAdminApiDescription() }}" data-toggle="tooltip"></span>
+                            </td>
+                            <td>
+                                <a href="{{ getAdminApiBookUrl() }}" target="_blank">{{ getAdminApiBookUrl() }}</a>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td>
+                                Metadata API
+                            </td>
+                            <td>
+                                <a href="{{ getMetadataAPIUrl('info') }}" target="_blank">General Proxy Information</a>
+                                &nbsp;&nbsp;|&nbsp;&nbsp;
+                                <a href="{{ getMetadataAPIUrl('topologies') }}" target="_blank">Topologies</a>
+                            </td>
 
 Review comment:
   nit: I think in theory this can be in a separate file? 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r384078781
 
 

 ##########
 File path: gateway-service-definitions/src/main/resources/services/cm-ui/1.0.0/rewrite.xml
 ##########
 @@ -0,0 +1,33 @@
+<!--
+   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.
+-->
+<rules>
+  <rule dir="IN" name="CM-UI/cm-ui/ui/inbound" pattern="*://*:*/**/cmf/{xxx_unique_path=**}?{**}">
+    <rewrite template="{$serviceUrl[CM-UI]}/cmf/{xxx_unique_path=**}?{**}"/>
+  </rule>
+  <rule dir="IN" name="CM-UI/cm-ui/ui/root" pattern="*://*:*/**/cmf/">
+    <rewrite template="{$serviceUrl[CM-UI]}/cmf/"/>
+  </rule>
+  <rule dir="IN" name="CM-UI/cm-ui/static/inbound" pattern="*://*:*/**/static/{xxx_unique_path=**}?{**}">
 
 Review comment:
   As discussed this is OK.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378905051
 
 

 ##########
 File path: knox-homepage-ui/angular-cli.json
 ##########
 @@ -0,0 +1,56 @@
+{
+  "project": {
+    "version": "1.0.0-beta.22-1",
+    "name": "ng-knox-homepage"
+  },
+  "apps": [
+    {
+      "root": "homepage",
+      "outDir": "target/classes/homepage/app",
+      "assets": [
+        "assets",
+        "favicon.ico"
+      ],
+      "index": "index.html",
+      "main": "main.ts",
+      "test": "test.ts",
+      "tsconfig": "tsconfig.json",
+      "prefix": "app",
+      "mobile": false,
+      "styles": [
+        "../node_modules/bootstrap/dist/css/bootstrap.min.css",
+        "styles.css"
+      ],
+      "scripts": [
+        "../node_modules/jquery/dist/jquery.min.js",
+        "../node_modules/bootstrap/dist/js/bootstrap.js",
+        "../node_modules/ace-builds/src-min/ace.js",
 
 Review comment:
   Removed all that not needed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r383944969
 
 

 ##########
 File path: knox-homepage-backend/pom.xml
 ##########
 @@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.knox</groupId>
+        <artifactId>gateway</artifactId>
+        <version>1.4.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>knox-homepage-backend</artifactId>
 
 Review comment:
   The idea is to add `KnoxShell/Client Downloads and docs` later on into the `General Proxy Information` block, but it's been scoped out for now.
   I gave a second thought about the module names and I think the UI should be kept as-is (`knox-homepage-ui`) because of the `General Proxy Information` block. However, the back-end module can - and should - be renamed like `gateway-service-metadata`.
   What do you think?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378900910
 
 

 ##########
 File path: gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
 ##########
 @@ -923,6 +925,40 @@ private synchronized void internalActivateArchive( Topology topology, File warDi
     }
   }
 
+  private synchronized void activateHomeApp() {
+    try {
+      // UI
+      activateHomepageContext("/home", "homepage/%2Fhome");
 
 Review comment:
   I've just followed the process which is already in place for dynamic topology deployment. That process also creates `%2F` and `%2Fadmin-ui` folders where necessary. When tested, it was not even working w/o these prefixes.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378901987
 
 

 ##########
 File path: knox-homepage-backend/src/main/java/org/apache/knox/homepage/TopologyInformationWrapperMarshaller.java
 ##########
 @@ -0,0 +1,89 @@
+/*
+ * 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.knox.homepage;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.ext.Provider;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+
+import org.eclipse.persistence.jaxb.JAXBContextFactory;
+import org.eclipse.persistence.jaxb.JAXBContextProperties;
+
+@Provider
+@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+public class TopologyInformationWrapperMarshaller implements MessageBodyWriter<TopologyInformationWrapper> {
+  private static Marshaller xmlMarshaller;
+  private static Marshaller jsonMarshaller;
+
+  @Override
+  public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
+    return TopologyInformationWrapper.class == type;
+  }
+
+  @Override
+  public long getSize(TopologyInformationWrapper t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
+    return -1;
+  }
+
+  @Override
+  public void writeTo(TopologyInformationWrapper instance, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType,
+      MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
+    try {
+      getMarshaller(mediaType).marshal(instance, entityStream);
+    } catch (JAXBException e) {
+      throw new IOException(e);
+    }
+  }
+
+  private Marshaller getMarshaller(MediaType mediaType) throws JAXBException {
+    return MediaType.APPLICATION_JSON_TYPE.getSubtype().equals(mediaType.getSubtype()) ? getJsonMarshaller() : getXmlMarshaller();
+  }
+
+  private synchronized Marshaller getXmlMarshaller() throws JAXBException {
 
 Review comment:
   This is the same pattern we have in `gateway-admin-ui`. I agree this should be enhanced but I believe it's out of the scope of this JIRA.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378496197
 
 

 ##########
 File path: knox-homepage-ui/homepage/app/generalProxyInformation/general.proxy.information.component.ts
 ##########
 @@ -0,0 +1,111 @@
+/*
+ * 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.
+ */
+import {Component, OnInit} from '@angular/core';
+import {HomepageService} from '../homepage.service';
+import {GeneralProxyInformation} from './general.proxy.information';
+
+@Component({
+    selector: 'app-general-proxy-information',
+    template: `
+            <div class="table-responsive">
+                <table class="table table-striped table-hover">
+                    <thead>
+                        <tr><th colspan="2" align="center">General Proxy Information</th></tr>
+                    </thead>
+                    <tbody>
+                        <tr>
+                            <td>Knox Version</td>
+                            <td>{{ getVersion() }}</td>
+                        </tr>
+                        <tr>
+                            <td>TLS Public Certificate PEM file</td>
+                            <td><a href="{{ getPublicCertPemPath() }}" target="_blank">Click here to download</a></td>
+                        </tr>
+                        <tr>
+                            <td>TLS Public Certificate JKS file</td>
+                            <td><a href="{{ getPublicCertJksPath() }}" target="_blank">Click here to download</a></td>
+                        </tr>
+                        <tr>
+                            <td>Admin UI URL</td>
+                            <td><a href="{{ getAdminUiUrl() }}" target="_blank">{{ getAdminUiUrl() }}</a></td>
+                        </tr>
+                        <tr>
+                            <td>
+                                Admin API
+                                <span class="inline-glyph glyphicon glyphicon-info-sign btn btn-xs"
+                                title="{{ getAdminApiDescription() }}" data-toggle="tooltip"></span>
+                            </td>
+                            <td>
+                                <a href="{{ getAdminApiUrl() }}" target="_blank">{{ getAdminApiUrl() }}</a>
+                            </td>
+                        </tr>
+                    </tbody>
+                </table>
+            </div>
+    `,
+    providers: [HomepageService]
+})
+
+export class GeneralProxyInformationComponent implements OnInit {
+
+    generalProxyInformation: GeneralProxyInformation;
+
+    constructor(private homepageService: HomepageService) {}
+
+    getVersion() {
+        if (this.generalProxyInformation) {
+            return this.generalProxyInformation.version;
+          }
+          return '';
+    }
+    getPublicCertPemPath() {
+      if (this.generalProxyInformation) {
+        return this.generalProxyInformation.publicCertPemPath;
+      }
+      return '';
+    }
+
+    getPublicCertJksPath() {
+        if (this.generalProxyInformation) {
+          return this.generalProxyInformation.publicCertJksPath;
+        }
+        return '';
+    }
+
+    getAdminUiUrl() {
+        if (this.generalProxyInformation) {
+            return this.generalProxyInformation.adminUiUrl;
+          }
+          return '';
+    }
+
+    getAdminApiDescription() {
+       return 'Knox provides a REST API which allows end-users executing CRUD operations on topologies/shared-porviders/descriptors/'
+              + 'service definitions as well as fetching the Knox version.';
+    }
+
+    getAdminApiUrl() {
+        return 'https://knox.apache.org/books/knox-1-4-0/user-guide.html#Admin+API';
 
 Review comment:
   should just be `https://knox.apache.org/books/knox-1-4-0/user-guide.html#Admin+API` Looks like smart dashes in the line.
   
   In either case since we are printing the version of Knox - it should be possible to dynamically created this url based on `this.generalProxyInformation.version`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on issue #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on issue #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#issuecomment-592445217
 
 
   Follow-up JIRA: https://issues.apache.org/jira/browse/KNOX-2254

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378899703
 
 

 ##########
 File path: gateway-release/src/assembly.xml
 ##########
 @@ -90,6 +90,13 @@
                 <exclude>**/*.bundle.map</exclude>
             </excludes>
         </fileSet>
+        <fileSet>
+            <directory>${project.build.directory}/deployments</directory>
+            <outputDirectory>data/deployments</outputDirectory>
+            <includes>
+                <include>**/%2F*/**/*</include>
 
 Review comment:
   There are two additional folders here (`META-INF` and the war-plugin generated empty `WEB-INF` which should not be placed in the final `deployments` folder.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378496757
 
 

 ##########
 File path: knox-homepage-ui/angular-cli.json
 ##########
 @@ -0,0 +1,56 @@
+{
+  "project": {
+    "version": "1.0.0-beta.22-1",
+    "name": "ng-knox-homepage"
+  },
+  "apps": [
+    {
+      "root": "homepage",
+      "outDir": "target/classes/homepage/app",
+      "assets": [
+        "assets",
+        "favicon.ico"
+      ],
+      "index": "index.html",
+      "main": "main.ts",
+      "test": "test.ts",
+      "tsconfig": "tsconfig.json",
+      "prefix": "app",
+      "mobile": false,
+      "styles": [
+        "../node_modules/bootstrap/dist/css/bootstrap.min.css",
+        "styles.css"
+      ],
+      "scripts": [
+        "../node_modules/jquery/dist/jquery.min.js",
+        "../node_modules/bootstrap/dist/js/bootstrap.js",
+        "../node_modules/ace-builds/src-min/ace.js",
 
 Review comment:
   Do we need `ace` since I think thats the editor.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r385566807
 
 

 ##########
 File path: knox-homepage-ui/homepage/app/generalProxyInformation/general.proxy.information.component.ts
 ##########
 @@ -0,0 +1,113 @@
+/*
+ * 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.
+ */
+import {Component, OnInit} from '@angular/core';
+import {HomepageService} from '../homepage.service';
+import {GeneralProxyInformation} from './general.proxy.information';
+
+@Component({
+    selector: 'app-general-proxy-information',
+    template: `
+            <h4>General Proxy Information</h4>
+            <div class="table-responsive">
+                <table class="table table-striped table-hover">
+                    <tbody>
+                        <tr>
+                            <td>Knox Version</td>
+                            <td>{{ getVersion() }}</td>
+                        </tr>
+                        <tr>
+                            <td>TLS Public Certificate</td>
+                            <td>
+                                <a href="{{ getMetadataAPIUrl('publicCert?type=pem') }}">PEM</a>
+                                &nbsp;&nbsp;|&nbsp;&nbsp;
+                                <a href="{{ getMetadataAPIUrl('publicCert?type=jks') }}">JKS</a>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td>Admin UI URL</td>
+                            <td><a href="{{ getAdminUiUrl() }}" target="_blank">{{ getAdminUiUrl() }}</a></td>
+                        </tr>
+                        <tr>
+                            <td>
+                                Admin API Details
+                                <span class="inline-glyph glyphicon glyphicon-info-sign btn btn-xs"
+                                title="{{ getAdminApiDescription() }}" data-toggle="tooltip"></span>
+                            </td>
+                            <td>
+                                <a href="{{ getAdminApiBookUrl() }}" target="_blank">{{ getAdminApiBookUrl() }}</a>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td>
+                                Metadata API
+                            </td>
+                            <td>
+                                <a href="{{ getMetadataAPIUrl('info') }}" target="_blank">General Proxy Information</a>
+                                &nbsp;&nbsp;|&nbsp;&nbsp;
+                                <a href="{{ getMetadataAPIUrl('topologies') }}" target="_blank">Topologies</a>
+                            </td>
 
 Review comment:
   Done

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r383927089
 
 

 ##########
 File path: gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/SSOCookieFederationFilter.java
 ##########
 @@ -93,6 +95,13 @@ public void init( FilterConfig filterConfig ) throws ServletException {
 
     // gateway path for deriving an idp url when missing
     gatewayPath = filterConfig.getInitParameter(GATEWAY_PATH);
+    if (StringUtils.isBlank(gatewayPath)) {
+      final GatewayConfig gatewayConfig = filterConfig.getServletContext() == null ? null
+          : (GatewayConfig) filterConfig.getServletContext().getAttribute(GatewayConfig.GATEWAY_CONFIG_ATTRIBUTE);
+      if (gatewayConfig != null) {
+        gatewayPath = gatewayConfig.getGatewayPath();
+      }
+    }
 
 Review comment:
   I know you are not fan of adding new dependencies but the `commons-lang` dependency is in our project anyway. If you are insisting on removing it I'll do...

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] pzampino commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
pzampino commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r383940886
 
 

 ##########
 File path: knox-homepage-backend/pom.xml
 ##########
 @@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.knox</groupId>
+        <artifactId>gateway</artifactId>
+        <version>1.4.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>knox-homepage-backend</artifactId>
 
 Review comment:
   While some of the information supports the client pieces, I still feel that the information is all about the gateway. I could be persuaded otherwise, but this is my feeling at this point.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r379299748
 
 

 ##########
 File path: knox-homepage-backend/pom.xml
 ##########
 @@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.knox</groupId>
+        <artifactId>gateway</artifactId>
+        <version>1.4.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>knox-homepage-backend</artifactId>
+    <name>knox-homepage-backend</name>
+    <description>The Knox Home Page BE</description>
 
 Review comment:
   Fixed :) 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] moresandeep commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
moresandeep commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r384086345
 
 

 ##########
 File path: gateway-service-definitions/src/main/resources/services/ambari/0.2.2.0/service.xml
 ##########
 @@ -15,6 +15,12 @@
    limitations under the License.
 -->
 <service role="AMBARI" name="ambari" version="0.2.2.0">
+    <metadata>
+        <type>API</type>
+        <context>/ambari/api</context>
 
 Review comment:
   Created a JIRA so we can use `context` in routes 
   https://issues.apache.org/jira/browse/KNOX-2252
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r379150005
 
 

 ##########
 File path: gateway-service-definitions/src/main/resources/services/cm-ui/service.xml
 ##########
 @@ -0,0 +1,62 @@
+<!--
 
 Review comment:
   Nice catch; fixed!

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378904254
 
 

 ##########
 File path: knox-homepage-ui/angular-cli.json
 ##########
 @@ -0,0 +1,56 @@
+{
+  "project": {
+    "version": "1.0.0-beta.22-1",
 
 Review comment:
   Changed

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378492765
 
 

 ##########
 File path: gateway-release/pom.xml
 ##########
 @@ -144,6 +144,14 @@
                                             <outputDirectory>${project.build.directory}</outputDirectory>
                                             <includes>applications/**/*</includes>
                                         </artifactItem>
+                                        <artifactItem>
 
 Review comment:
   Need to see what this looks like in the final tar.gz to make sure this is valid packaging since `gateway-release` basically builds the final apache builds.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378912270
 
 

 ##########
 File path: gateway-service-definitions/src/main/resources/services/cm-ui/service.xml
 ##########
 @@ -0,0 +1,62 @@
+<!--
 
 Review comment:
   Looks like this was added by mistake? The service.xml isn't in a versioned folder?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 merged pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 merged pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r384072895
 
 

 ##########
 File path: knox-homepage-backend/pom.xml
 ##########
 @@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.knox</groupId>
+        <artifactId>gateway</artifactId>
+        <version>1.4.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>knox-homepage-backend</artifactId>
 
 Review comment:
   Renamed the module as discussed above.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378903249
 
 

 ##########
 File path: knox-homepage-ui/homepage/assets/vkbeautify.js
 ##########
 @@ -0,0 +1,392 @@
+/*
 
 Review comment:
   Done in both projects (pulled in by installing with npm)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378902339
 
 

 ##########
 File path: gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
 ##########
 @@ -923,6 +925,40 @@ private synchronized void internalActivateArchive( Topology topology, File warDi
     }
   }
 
+  private synchronized void activateHomeApp() {
+    try {
+      // UI
+      activateHomepageContext("/home", "homepage/%2Fhome");
+
+      // API
+      activateHomepageContext("/home/api", "homepage/%2F");
+    } catch (Throwable e) {
+      e.printStackTrace();
 
 Review comment:
   Deleted.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] lmccay commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
lmccay commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r383981952
 
 

 ##########
 File path: gateway-release/home/conf/topologies/metadata.xml
 ##########
 @@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
 
 Review comment:
   I see that the metadata.xml topology is aligned with other existing topologies like admin.xml for instance. I think that we need to consider moving these to descriptors that point to the default-providers.json shared provider config. This way the authentication can be changed in one place. Admin will require an authorization provider but since it is for the admin service and not others that should be okay. Let's not block this PR and follow up with another to move to descriptors. Just wanted to mention it here.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378492211
 
 

 ##########
 File path: knox-homepage-backend/src/main/java/org/apache/knox/homepage/TopologyInformationWrapperMarshaller.java
 ##########
 @@ -0,0 +1,89 @@
+/*
+ * 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.knox.homepage;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.ext.Provider;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+
+import org.eclipse.persistence.jaxb.JAXBContextFactory;
+import org.eclipse.persistence.jaxb.JAXBContextProperties;
+
+@Provider
+@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+public class TopologyInformationWrapperMarshaller implements MessageBodyWriter<TopologyInformationWrapper> {
+  private static Marshaller xmlMarshaller;
+  private static Marshaller jsonMarshaller;
+
+  @Override
+  public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
+    return TopologyInformationWrapper.class == type;
+  }
+
+  @Override
+  public long getSize(TopologyInformationWrapper t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
+    return -1;
+  }
+
+  @Override
+  public void writeTo(TopologyInformationWrapper instance, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType,
+      MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
+    try {
+      getMarshaller(mediaType).marshal(instance, entityStream);
+    } catch (JAXBException e) {
+      throw new IOException(e);
+    }
+  }
+
+  private Marshaller getMarshaller(MediaType mediaType) throws JAXBException {
+    return MediaType.APPLICATION_JSON_TYPE.getSubtype().equals(mediaType.getSubtype()) ? getJsonMarshaller() : getXmlMarshaller();
+  }
+
+  private synchronized Marshaller getXmlMarshaller() throws JAXBException {
 
 Review comment:
   Need to make sure this is a safe marshaller and we aren't open to XML issues. I thought we had a class to handle a lot of this complexity.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378902827
 
 

 ##########
 File path: knox-homepage-ui/pom.xml
 ##########
 @@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.knox</groupId>
+        <artifactId>gateway</artifactId>
+        <version>1.4.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>knox-homepage-ui</artifactId>
+    <name>knox-homepage-ui</name>
+    <packaging>war</packaging>
+    <description>The Knox Home Page UI</description>
+
+    <properties>
+        <frontend-maven-plugin.version>1.9.1</frontend-maven-plugin.version>
 
 Review comment:
   Done.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r379299791
 
 

 ##########
 File path: knox-homepage-backend/src/main/java/org/apache/knox/homepage/HomePageResource.java
 ##########
 @@ -0,0 +1,197 @@
+/*
+ * 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.knox.homepage;
+
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+import static javax.ws.rs.core.MediaType.APPLICATION_XML;
+
+import java.io.IOException;
+import java.nio.file.Paths;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateEncodingException;
+import java.security.cert.CertificateException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Optional;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+
+import org.apache.knox.gateway.config.GatewayConfig;
+import org.apache.knox.gateway.i18n.messages.MessagesFactory;
+import org.apache.knox.gateway.service.definition.Metadata;
+import org.apache.knox.gateway.service.definition.ServiceDefinitionPair;
+import org.apache.knox.gateway.services.GatewayServices;
+import org.apache.knox.gateway.services.ServerInfoService;
+import org.apache.knox.gateway.services.ServiceType;
+import org.apache.knox.gateway.services.registry.ServiceDefinitionRegistry;
+import org.apache.knox.gateway.services.security.KeystoreService;
+import org.apache.knox.gateway.services.security.KeystoreServiceException;
+import org.apache.knox.gateway.services.topology.TopologyService;
+import org.apache.knox.gateway.topology.Service;
+import org.apache.knox.gateway.topology.Topology;
+import org.apache.knox.gateway.util.X509CertificateUtil;
+
+@Path("/v1")
+public class HomePageResource {
+  private static final KnoxHomepageMessages LOG = MessagesFactory.get(KnoxHomepageMessages.class);
+  private static final String SNAPSHOT_VERSION_POSTFIX = "-SNAPSHOT";
+
+  private java.nio.file.Path pemFilePath;
+  private java.nio.file.Path jksFilePath;
+
+  @Context
+  private HttpServletRequest request;
+
+  @GET
+  @Produces({ APPLICATION_JSON, APPLICATION_XML })
+  @Path("generalProxyInformation")
 
 Review comment:
   Done.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r379149978
 
 

 ##########
 File path: gateway-service-definitions/src/main/resources/services/cm-ui/rewrite.xml
 ##########
 @@ -0,0 +1,33 @@
+<!--
 
 Review comment:
   Nice catch; fixed!

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378491849
 
 

 ##########
 File path: knox-homepage-backend/src/main/java/org/apache/knox/homepage/GeneralProxyInformationMarshaller.java
 ##########
 @@ -0,0 +1,89 @@
+/*
+ * 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.knox.homepage;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.ext.Provider;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+
+import org.eclipse.persistence.jaxb.JAXBContextFactory;
+import org.eclipse.persistence.jaxb.JAXBContextProperties;
+
+@Provider
+@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+public class GeneralProxyInformationMarshaller implements MessageBodyWriter<GeneralProxyInformation>{
+  private static Marshaller xmlMarshaller;
+  private static Marshaller jsonMarshaller;
+
+  @Override
+  public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
+    return GeneralProxyInformation.class == type;
+  }
+
+  @Override
+  public long getSize(GeneralProxyInformation t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
+    return -1;
+  }
+
+  @Override
+  public void writeTo(GeneralProxyInformation instance, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType,
+      MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
+    try {
+      getMarshaller(mediaType).marshal(instance, entityStream);
+    } catch (JAXBException e) {
+      throw new IOException(e);
+    }
+  }
+
+  private Marshaller getMarshaller(MediaType mediaType) throws JAXBException {
+    return MediaType.APPLICATION_JSON_TYPE.getSubtype().equals(mediaType.getSubtype()) ? getJsonMarshaller() : getXmlMarshaller();
+  }
+
+  private synchronized Marshaller getXmlMarshaller() throws JAXBException {
 
 Review comment:
   Need to make sure this is a safe marshaller and we aren't open to XML issues. I thought we had a class to handle a lot of this complexity.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] moresandeep commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
moresandeep commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r384066536
 
 

 ##########
 File path: gateway-service-definitions/src/main/resources/services/cm-ui/1.0.0/rewrite.xml
 ##########
 @@ -0,0 +1,33 @@
+<!--
+   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.
+-->
+<rules>
+  <rule dir="IN" name="CM-UI/cm-ui/ui/inbound" pattern="*://*:*/**/cmf/{xxx_unique_path=**}?{**}">
+    <rewrite template="{$serviceUrl[CM-UI]}/cmf/{xxx_unique_path=**}?{**}"/>
+  </rule>
+  <rule dir="IN" name="CM-UI/cm-ui/ui/root" pattern="*://*:*/**/cmf/">
+    <rewrite template="{$serviceUrl[CM-UI]}/cmf/"/>
+  </rule>
+  <rule dir="IN" name="CM-UI/cm-ui/static/inbound" pattern="*://*:*/**/static/{xxx_unique_path=**}?{**}">
+    <rewrite template="{$serviceUrl[CM-UI]}/static/{xxx_unique_path=**}?{**}"/>
+  </rule>
+  <rule dir="IN" name="CM-UI/cm-ui/rest" pattern="*://*:*/**/api/{xxx_unique_path=**}?{**}">
+    <rewrite template="{$serviceUrl[CM-UI]}/api/{xxx_unique_path=**}?{**}"/>
+  </rule>
+  <rule dir="IN" name="CM-UI/cm-ui/root" pattern="*://*:*/*/*/{xxx_unique_path=*}?{**}">
 
 Review comment:
   same as above

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378495666
 
 

 ##########
 File path: knox-homepage-ui/homepage/assets/vkbeautify.js
 ##########
 @@ -0,0 +1,392 @@
+/*
 
 Review comment:
   I'd personally love to get rid of this file both here and in gateway-admin-ui. Either its something we can pull in via npm or we should have it minified. Right now its weird we straight copy this around.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378496609
 
 

 ##########
 File path: knox-homepage-ui/angular-cli.json
 ##########
 @@ -0,0 +1,56 @@
+{
+  "project": {
+    "version": "1.0.0-beta.22-1",
 
 Review comment:
   where is this version from? :D

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r383927754
 
 

 ##########
 File path: gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/SSOCookieFederationFilter.java
 ##########
 @@ -93,6 +95,13 @@ public void init( FilterConfig filterConfig ) throws ServletException {
 
     // gateway path for deriving an idp url when missing
     gatewayPath = filterConfig.getInitParameter(GATEWAY_PATH);
+    if (StringUtils.isBlank(gatewayPath)) {
+      final GatewayConfig gatewayConfig = filterConfig.getServletContext() == null ? null
+          : (GatewayConfig) filterConfig.getServletContext().getAttribute(GatewayConfig.GATEWAY_CONFIG_ATTRIBUTE);
+      if (gatewayConfig != null) {
+        gatewayPath = gatewayConfig.getGatewayPath();
+      }
+    }
 
 Review comment:
   > This should be its own method
   
   +1 (let me wait a bit for other review comments before submitting a new patchset)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r379299666
 
 

 ##########
 File path: gateway-service-definitions/src/main/resources/services/hdfsui/3.0.0/service.xml
 ##########
 @@ -16,6 +16,12 @@
    limitations under the License.
 -->
 <service role="HDFSUI" name="hdfs" version="3.0.0">
+    <metadata>
+        <type>UI</type>
+        <context>/hdfs?host={{BACKEND_HOST}}</context>
 
 Review comment:
   Fixed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378903950
 
 

 ##########
 File path: knox-homepage-ui/homepage/app/generalProxyInformation/general.proxy.information.component.ts
 ##########
 @@ -0,0 +1,111 @@
+/*
+ * 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.
+ */
+import {Component, OnInit} from '@angular/core';
+import {HomepageService} from '../homepage.service';
+import {GeneralProxyInformation} from './general.proxy.information';
+
+@Component({
+    selector: 'app-general-proxy-information',
+    template: `
+            <div class="table-responsive">
+                <table class="table table-striped table-hover">
+                    <thead>
+                        <tr><th colspan="2" align="center">General Proxy Information</th></tr>
+                    </thead>
+                    <tbody>
+                        <tr>
+                            <td>Knox Version</td>
+                            <td>{{ getVersion() }}</td>
+                        </tr>
+                        <tr>
+                            <td>TLS Public Certificate PEM file</td>
+                            <td><a href="{{ getPublicCertPemPath() }}" target="_blank">Click here to download</a></td>
+                        </tr>
+                        <tr>
+                            <td>TLS Public Certificate JKS file</td>
+                            <td><a href="{{ getPublicCertJksPath() }}" target="_blank">Click here to download</a></td>
+                        </tr>
+                        <tr>
+                            <td>Admin UI URL</td>
+                            <td><a href="{{ getAdminUiUrl() }}" target="_blank">{{ getAdminUiUrl() }}</a></td>
+                        </tr>
+                        <tr>
+                            <td>
+                                Admin API
+                                <span class="inline-glyph glyphicon glyphicon-info-sign btn btn-xs"
+                                title="{{ getAdminApiDescription() }}" data-toggle="tooltip"></span>
+                            </td>
+                            <td>
+                                <a href="{{ getAdminApiUrl() }}" target="_blank">{{ getAdminApiUrl() }}</a>
+                            </td>
+                        </tr>
+                    </tbody>
+                </table>
+            </div>
+    `,
+    providers: [HomepageService]
+})
+
+export class GeneralProxyInformationComponent implements OnInit {
+
+    generalProxyInformation: GeneralProxyInformation;
+
+    constructor(private homepageService: HomepageService) {}
+
+    getVersion() {
+        if (this.generalProxyInformation) {
+            return this.generalProxyInformation.version;
+          }
+          return '';
+    }
+    getPublicCertPemPath() {
+      if (this.generalProxyInformation) {
+        return this.generalProxyInformation.publicCertPemPath;
+      }
+      return '';
+    }
+
+    getPublicCertJksPath() {
+        if (this.generalProxyInformation) {
+          return this.generalProxyInformation.publicCertJksPath;
+        }
+        return '';
+    }
+
+    getAdminUiUrl() {
+        if (this.generalProxyInformation) {
+            return this.generalProxyInformation.adminUiUrl;
+          }
+          return '';
+    }
+
+    getAdminApiDescription() {
+       return 'Knox provides a REST API which allows end-users executing CRUD operations on topologies/shared-porviders/descriptors/'
+              + 'service definitions as well as fetching the Knox version.';
+    }
+
+    getAdminApiUrl() {
+        return 'https://knox.apache.org/books/knox-1-4-0/user-guide.html#Admin+API';
 
 Review comment:
   Done: admin API book URL is calculated on the back-end - based on the build version - and being sent as part of the general proxy information payload.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r384075719
 
 

 ##########
 File path: gateway-service-definitions/src/main/resources/services/ambari/0.2.2.0/service.xml
 ##########
 @@ -15,6 +15,12 @@
    limitations under the License.
 -->
 <service role="AMBARI" name="ambari" version="0.2.2.0">
+    <metadata>
+        <type>API</type>
+        <context>/ambari/api</context>
 
 Review comment:
   I know it's redundant but it's easier to add it in the metadata than parsing the `route` elements.
   It's useful to know what comes after `$KNOX_URL/$GATEWAY_PATH/`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on issue #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on issue #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#issuecomment-586404040
 
 
   Thanks for the explanation of the XML vs JSON thing. Super confusing but see how it ends up that way. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r383936897
 
 

 ##########
 File path: knox-homepage-backend/pom.xml
 ##########
 @@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.knox</groupId>
+        <artifactId>gateway</artifactId>
+        <version>1.4.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>knox-homepage-backend</artifactId>
 
 Review comment:
   I think it expresses more that they belong to Knox as a product, including the gateway, the CLI, the KnoxShell rather than referring only the gateway part.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r379195031
 
 

 ##########
 File path: knox-homepage-backend/pom.xml
 ##########
 @@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.knox</groupId>
+        <artifactId>gateway</artifactId>
+        <version>1.4.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>knox-homepage-backend</artifactId>
+    <name>knox-homepage-backend</name>
+    <description>The Knox Home Page BE</description>
 
 Review comment:
   `BE`?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r385566764
 
 

 ##########
 File path: gateway-service-metadata/src/main/java/org/apache/knox/gateway/service/metadata/ServiceModel.java
 ##########
 @@ -0,0 +1,121 @@
+/*
+ * 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.knox.gateway.service.metadata;
+
+import java.util.Locale;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.knox.gateway.service.definition.Metadata;
+import org.apache.knox.gateway.topology.Service;
+
+@XmlRootElement(name = "service")
+@XmlAccessorType(XmlAccessType.NONE)
+public class ServiceModel {
+
+  public enum Type {
+    API, UI, UNKNOWN
+  };
+
+  protected HttpServletRequest request;
+  protected String topologyName;
+  protected String gatewayPath;
+  protected Service service;
+  protected Metadata serviceMetadata;
+
+  public void setRequest(HttpServletRequest request) {
+    this.request = request;
+  }
+
+  public void setTopologyName(String topologyName) {
+    this.topologyName = topologyName;
+  }
+
+  public void setGatewayPath(String gatewayPath) {
+    this.gatewayPath = gatewayPath;
+  }
+
+  public void setService(Service service) {
+    this.service = service;
+  }
+
+  public void setServiceMetadata(Metadata serviceMetadata) {
+    this.serviceMetadata = serviceMetadata;
+  }
+
+  @XmlElement
+  public String getServiceName() {
+    return this.service == null ? "" : service.getRole();
+  }
+
+  @XmlElement
+  public String getVersion() {
+    return this.service == null ? "" : this.service.getVersion() == null ? "" : this.service.getVersion().toString();
+  }
+
+  @XmlElement(name = "shortDesc")
+  public String getShortDescription() {
+    if (serviceMetadata == null) {
+      return getServiceName().substring(0, 1).toUpperCase(Locale.ROOT) + getServiceName().substring(1).toLowerCase(Locale.ROOT);
+    } else {
+      return serviceMetadata.getShortDesc();
+    }
+  }
+
+  @XmlElement
+  public String getDescription() {
+    if (serviceMetadata == null) {
+      return getShortDescription() + (Type.API == getType() ? " REST API" : Type.UI == getType() ? " Web User Interface" : "");
+    } else {
+      return serviceMetadata.getDescription();
+    }
+  }
+
+  @XmlElement
+  public Type getType() {
+    return serviceMetadata == null ? Type.UNKNOWN : Type.valueOf(serviceMetadata.getType());
+  }
+
+  @XmlElement
+  public String getContext() {
+    return (serviceMetadata == null ? "/" + getServiceName().toLowerCase(Locale.ROOT) : serviceMetadata.getContext()) + "/";
+  }
+
+  @XmlElement
+  public String getServiceUrl() {
+    String context = getContext();
+    if ("HIVE".equals(getServiceName())) {
+      return String.format(Locale.ROOT, "jdbc:hive2://%s:%d/;?hive.server2.transport.mode=http;hive.server2.thrift.http.path=/%s/%s%s", request.getServerName(),
+          request.getServerPort(), gatewayPath, topologyName, context);
+    } else {
+      if (context.indexOf("{{BACKEND_HOST}}") > -1) {
+        context = context.replaceAll("\\{\\{BACKEND_HOST\\}\\}", getBackendServiceUrl());
 
 Review comment:
   Fixed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r384078930
 
 

 ##########
 File path: gateway-service-definitions/src/main/resources/services/cm-ui/1.0.0/rewrite.xml
 ##########
 @@ -0,0 +1,33 @@
+<!--
+   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.
+-->
+<rules>
+  <rule dir="IN" name="CM-UI/cm-ui/ui/inbound" pattern="*://*:*/**/cmf/{xxx_unique_path=**}?{**}">
+    <rewrite template="{$serviceUrl[CM-UI]}/cmf/{xxx_unique_path=**}?{**}"/>
+  </rule>
+  <rule dir="IN" name="CM-UI/cm-ui/ui/root" pattern="*://*:*/**/cmf/">
+    <rewrite template="{$serviceUrl[CM-UI]}/cmf/"/>
+  </rule>
+  <rule dir="IN" name="CM-UI/cm-ui/static/inbound" pattern="*://*:*/**/static/{xxx_unique_path=**}?{**}">
+    <rewrite template="{$serviceUrl[CM-UI]}/static/{xxx_unique_path=**}?{**}"/>
+  </rule>
+  <rule dir="IN" name="CM-UI/cm-ui/rest" pattern="*://*:*/**/api/{xxx_unique_path=**}?{**}">
+    <rewrite template="{$serviceUrl[CM-UI]}/api/{xxx_unique_path=**}?{**}"/>
+  </rule>
+  <rule dir="IN" name="CM-UI/cm-ui/root" pattern="*://*:*/*/*/{xxx_unique_path=*}?{**}">
 
 Review comment:
   As discussed this is OK.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378494901
 
 

 ##########
 File path: knox-homepage-ui/pom.xml
 ##########
 @@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.knox</groupId>
+        <artifactId>gateway</artifactId>
+        <version>1.4.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>knox-homepage-ui</artifactId>
+    <name>knox-homepage-ui</name>
+    <packaging>war</packaging>
+    <description>The Knox Home Page UI</description>
+
+    <properties>
+        <frontend-maven-plugin.version>1.9.1</frontend-maven-plugin.version>
 
 Review comment:
   Would be good to move these 2 properties to top level pom since now its duplicated w/ `gateway-admin-ui/pom.xml`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378898174
 
 

 ##########
 File path: gateway-release/pom.xml
 ##########
 @@ -144,6 +144,14 @@
                                             <outputDirectory>${project.build.directory}</outputDirectory>
                                             <includes>applications/**/*</includes>
                                         </artifactItem>
+                                        <artifactItem>
 
 Review comment:
   I'll add this info to the PR description later today.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] moresandeep commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
moresandeep commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r384065569
 
 

 ##########
 File path: gateway-service-definitions/src/main/resources/services/cm-ui/1.0.0/rewrite.xml
 ##########
 @@ -0,0 +1,33 @@
+<!--
+   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.
+-->
+<rules>
+  <rule dir="IN" name="CM-UI/cm-ui/ui/inbound" pattern="*://*:*/**/cmf/{xxx_unique_path=**}?{**}">
+    <rewrite template="{$serviceUrl[CM-UI]}/cmf/{xxx_unique_path=**}?{**}"/>
+  </rule>
+  <rule dir="IN" name="CM-UI/cm-ui/ui/root" pattern="*://*:*/**/cmf/">
+    <rewrite template="{$serviceUrl[CM-UI]}/cmf/"/>
+  </rule>
+  <rule dir="IN" name="CM-UI/cm-ui/static/inbound" pattern="*://*:*/**/static/{xxx_unique_path=**}?{**}">
 
 Review comment:
   why is the context path /static here shouldn't it be /cmf/static ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r379194812
 
 

 ##########
 File path: gateway-service-definitions/src/main/resources/services/hdfsui/2.7.0/service.xml
 ##########
 @@ -16,6 +16,12 @@
    limitations under the License.
 -->
 <service role="HDFSUI" name="hdfs" version="2.7.0">
+    <metadata>
+        <type>UI</type>
+        <context>/hdfs?host={{BACKEND_HOST}}</context>
 
 Review comment:
   There is no `?host=` parameter on the 2.7.0 version of the HDFS UI service definition.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378902605
 
 

 ##########
 File path: knox-homepage-backend/src/main/java/org/apache/knox/homepage/HomePageResource.java
 ##########
 @@ -0,0 +1,126 @@
+/*
+ * 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.knox.homepage;
+
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+
+import java.io.IOException;
+import java.nio.file.Paths;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateEncodingException;
+import java.security.cert.CertificateException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+
+import org.apache.knox.gateway.config.GatewayConfig;
+import org.apache.knox.gateway.services.GatewayServices;
+import org.apache.knox.gateway.services.ServerInfoService;
+import org.apache.knox.gateway.services.ServiceType;
+import org.apache.knox.gateway.services.security.KeystoreService;
+import org.apache.knox.gateway.services.topology.TopologyService;
+import org.apache.knox.gateway.topology.Service;
+import org.apache.knox.gateway.topology.Topology;
+import org.apache.knox.gateway.util.X509CertificateUtil;
+import org.apache.knox.homepage.service.model.ServiceModel;
+import org.apache.knox.homepage.service.model.ServiceModelFactory;
+
+@Path("/v1")
+public class HomePageResource {
+  private java.nio.file.Path pemFilePath;
+  private java.nio.file.Path jksFilePath;
+
+  @Context
+  private HttpServletRequest request;
+
+  @GET
+  @Produces({ APPLICATION_JSON })
+  @Path("generalProxyInformation")
+  public GeneralProxyInformation getGeneralProxyInformation() {
+    final GeneralProxyInformation proxyInfo = new GeneralProxyInformation();
+    try {
+      final GatewayServices gatewayServices = (GatewayServices) request.getServletContext().getAttribute(GatewayServices.GATEWAY_SERVICES_ATTRIBUTE);
+      if (gatewayServices != null) {
+        final ServerInfoService serviceInfoService = gatewayServices.getService(ServiceType.SERVER_INFO_SERVICE);
+        final String versionInfo = serviceInfoService.getBuildVersion() + " (hash=" + serviceInfoService.getBuildHash() +")";
+        proxyInfo.setVersion(versionInfo);
+        final KeystoreService keystoreService = gatewayServices.getService(ServiceType.KEYSTORE_SERVICE);
+        final GatewayConfig config = (GatewayConfig) request.getServletContext().getAttribute(GatewayConfig.GATEWAY_CONFIG_ATTRIBUTE);
+        final Certificate certificate = keystoreService.getKeystoreForGateway().getCertificate(config.getIdentityKeyAlias());
+        generateCertificatePem(certificate, config);
+        proxyInfo.setPublicCertPemPath("assets/gateway-client-trust.pem");
+        generateCertificateJks(certificate, config);
+        proxyInfo.setPublicCertJksPath("assets/gateway-client-trust.jks");
+        proxyInfo.setAdminUiUrl(getBaseGatewayUrl(config) + "/manager/admin-ui/");
+      }
+    } catch (Exception e) {
 
 Review comment:
   Fixed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378909322
 
 

 ##########
 File path: gateway-service-definitions/src/main/resources/services/hdfsui/3.0.0/service.xml
 ##########
 @@ -16,6 +16,12 @@
    limitations under the License.
 -->
 <service role="HDFSUI" name="hdfs" version="3.0.0">
+    <metadata>
+        <type>UI</type>
+        <context>/hdfs?host=%BACKEND_HOST</context>
 
 Review comment:
   Might want to use `{{BACKEND_HOST}}` or however other places in Knox do replacements like in the rewrite rules. `%VARIABLE` seems to be new.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on issue #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on issue #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#issuecomment-592078393
 
 
   My latest changes include:
   - appropriate bordering on homepage
   - homepage is bound to `/` (i.e. is available on https://localhost:8443)
   - new metadata API endpoint to download public certificate in PEM/JKS format
   - changed Hive's service URL to a sample JDBC URL
   - re-ordered API/UI services on homepage
   - renamed `Topology Browsing` to `Topologies`
   - `General Proxy Information` font size is the same as `Topologies`
   - new `Metadata API` links are added into `General Proxy Information`
   
   @risdenk, the (i) buttons are tooltips; they show a meaningful description of the service
   
   I'm going to file a follow-up JIRA to enhance the homepage based on @lmccay 's recommendations

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r383917425
 
 

 ##########
 File path: gateway-release/home/conf/topologies/metadata.xml
 ##########
 @@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
 
 Review comment:
   Is this topology just an example? Does it need to be exposed by default? If its an example `gateway-release/home/templates/` would be a better place.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r383916303
 
 

 ##########
 File path: gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/SSOCookieFederationFilter.java
 ##########
 @@ -93,6 +95,13 @@ public void init( FilterConfig filterConfig ) throws ServletException {
 
     // gateway path for deriving an idp url when missing
     gatewayPath = filterConfig.getInitParameter(GATEWAY_PATH);
+    if (StringUtils.isBlank(gatewayPath)) {
+      final GatewayConfig gatewayConfig = filterConfig.getServletContext() == null ? null
+          : (GatewayConfig) filterConfig.getServletContext().getAttribute(GatewayConfig.GATEWAY_CONFIG_ATTRIBUTE);
+      if (gatewayConfig != null) {
+        gatewayPath = gatewayConfig.getGatewayPath();
+      }
+    }
 
 Review comment:
   This should be its own method

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r383916666
 
 

 ##########
 File path: gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/SSOCookieFederationFilter.java
 ##########
 @@ -93,6 +95,13 @@ public void init( FilterConfig filterConfig ) throws ServletException {
 
     // gateway path for deriving an idp url when missing
     gatewayPath = filterConfig.getInitParameter(GATEWAY_PATH);
+    if (StringUtils.isBlank(gatewayPath)) {
+      final GatewayConfig gatewayConfig = filterConfig.getServletContext() == null ? null
+          : (GatewayConfig) filterConfig.getServletContext().getAttribute(GatewayConfig.GATEWAY_CONFIG_ATTRIBUTE);
+      if (gatewayConfig != null) {
+        gatewayPath = gatewayConfig.getGatewayPath();
+      }
+    }
 
 Review comment:
   Do we need `StringUtils.isBlank`? Check is not null and is not empty? That would remove the commons-lang3 dependency

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on issue #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on issue #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#issuecomment-591669176
 
 
   So some feedback after spinning this up and looking at it:
   * why is it at /home instead of just at /? ie: https://localhost:8443 instead of requiring a path?
   * There is some weird spacing going on - there should be a reasonable border around the page?
   
   ![Screen Shot 2020-02-26 at 5 02 22 PM](https://user-images.githubusercontent.com/3384157/75392359-de4cf180-58b9-11ea-95ea-bd8407701b9d.png)
   
   * Expanding the services there is an "i" button that does nothing?
   
   * Hitting https://localhost:8443/gateway/metadata/api/v1/metadata/info doesn't return a way to download the pem/jks certs. 
   ** Can't the full paths be exposed?
   ** Can't the cert be on its own API endpoint to download?
   ```
   <publicCertPemPath>assets/gateway-client-trust.pem</publicCertPemPath>
   <publicCertJksPath>assets/gateway-client-trust.jks</publicCertJksPath>
   ```
   
   * Hive has a `<serviceUrl>https://localhost:8443/gateway/sandbox/hive/</serviceUrl>` url instead of a proper JDBC url?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] pzampino commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
pzampino commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r383922240
 
 

 ##########
 File path: knox-homepage-backend/pom.xml
 ##########
 @@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.knox</groupId>
+        <artifactId>gateway</artifactId>
+        <version>1.4.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>knox-homepage-backend</artifactId>
 
 Review comment:
   Why are these new modules prefixed with "knox" rather than "gateway"?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] moresandeep commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
moresandeep commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r383988278
 
 

 ##########
 File path: gateway-service-definitions/src/main/resources/services/ambari/0.2.2.0/service.xml
 ##########
 @@ -15,6 +15,12 @@
    limitations under the License.
 -->
 <service role="AMBARI" name="ambari" version="0.2.2.0">
+    <metadata>
+        <type>API</type>
+        <context>/ambari/api</context>
 
 Review comment:
   What is the use of context ? Looks like we are duplicating context here and in the routes elements. 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r383927754
 
 

 ##########
 File path: gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/SSOCookieFederationFilter.java
 ##########
 @@ -93,6 +95,13 @@ public void init( FilterConfig filterConfig ) throws ServletException {
 
     // gateway path for deriving an idp url when missing
     gatewayPath = filterConfig.getInitParameter(GATEWAY_PATH);
+    if (StringUtils.isBlank(gatewayPath)) {
+      final GatewayConfig gatewayConfig = filterConfig.getServletContext() == null ? null
+          : (GatewayConfig) filterConfig.getServletContext().getAttribute(GatewayConfig.GATEWAY_CONFIG_ATTRIBUTE);
+      if (gatewayConfig != null) {
+        gatewayPath = gatewayConfig.getGatewayPath();
+      }
+    }
 
 Review comment:
   > This should be its own method
   
   +1 (let me wait a bit until for review comments before submitting a new patchset)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378491084
 
 

 ##########
 File path: gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
 ##########
 @@ -923,6 +925,40 @@ private synchronized void internalActivateArchive( Topology topology, File warDi
     }
   }
 
+  private synchronized void activateHomeApp() {
+    try {
+      // UI
+      activateHomepageContext("/home", "homepage/%2Fhome");
+
+      // API
+      activateHomepageContext("/home/api", "homepage/%2F");
+    } catch (Throwable e) {
+      e.printStackTrace();
 
 Review comment:
   remove `e.printStackTrace()`
   
   why are we catching `Throwable` that seems bad

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on issue #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on issue #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#issuecomment-590515922
 
 
   So I added another commit to clear out the authentication stuff:
   - the homepage UI uses `knoxsso` and deploys the new API under `/homepage/` the same way `manager` deploys the admin API under `/manager`. This way there is no need to login twice and `knoxsso` is configurable easily.
   - the new API is deployed through a new topology called `metadata`. This topology is configured to use LDAP authentication (to be consistent with Admin API). I'm going to modify the PR description accordingly.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r384022628
 
 

 ##########
 File path: gateway-release/home/conf/topologies/metadata.xml
 ##########
 @@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
 
 Review comment:
   https://issues.apache.org/jira/browse/KNOX-2251

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] pzampino commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
pzampino commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r383980572
 
 

 ##########
 File path: knox-homepage-backend/pom.xml
 ##########
 @@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.knox</groupId>
+        <artifactId>gateway</artifactId>
+        <version>1.4.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>knox-homepage-backend</artifactId>
 
 Review comment:
   Sounds good to me. I was unaware of the client downloads bit.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378912464
 
 

 ##########
 File path: gateway-service-definitions/src/main/resources/services/cm-ui/rewrite.xml
 ##########
 @@ -0,0 +1,33 @@
+<!--
 
 Review comment:
   Looks like this was added by mistake? The rewrite.xml isn't in a versioned folder?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r379160241
 
 

 ##########
 File path: gateway-release/pom.xml
 ##########
 @@ -144,6 +144,14 @@
                                             <outputDirectory>${project.build.directory}</outputDirectory>
                                             <includes>applications/**/*</includes>
                                         </artifactItem>
+                                        <artifactItem>
 
 Review comment:
   Done

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r385313226
 
 

 ##########
 File path: gateway-service-metadata/src/main/java/org/apache/knox/gateway/service/metadata/ServiceModel.java
 ##########
 @@ -0,0 +1,121 @@
+/*
+ * 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.knox.gateway.service.metadata;
+
+import java.util.Locale;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.knox.gateway.service.definition.Metadata;
+import org.apache.knox.gateway.topology.Service;
+
+@XmlRootElement(name = "service")
+@XmlAccessorType(XmlAccessType.NONE)
+public class ServiceModel {
+
+  public enum Type {
+    API, UI, UNKNOWN
+  };
+
+  protected HttpServletRequest request;
+  protected String topologyName;
+  protected String gatewayPath;
+  protected Service service;
+  protected Metadata serviceMetadata;
+
+  public void setRequest(HttpServletRequest request) {
+    this.request = request;
+  }
+
+  public void setTopologyName(String topologyName) {
+    this.topologyName = topologyName;
+  }
+
+  public void setGatewayPath(String gatewayPath) {
+    this.gatewayPath = gatewayPath;
+  }
+
+  public void setService(Service service) {
+    this.service = service;
+  }
+
+  public void setServiceMetadata(Metadata serviceMetadata) {
+    this.serviceMetadata = serviceMetadata;
+  }
+
+  @XmlElement
+  public String getServiceName() {
+    return this.service == null ? "" : service.getRole();
+  }
+
+  @XmlElement
+  public String getVersion() {
+    return this.service == null ? "" : this.service.getVersion() == null ? "" : this.service.getVersion().toString();
+  }
+
+  @XmlElement(name = "shortDesc")
+  public String getShortDescription() {
+    if (serviceMetadata == null) {
+      return getServiceName().substring(0, 1).toUpperCase(Locale.ROOT) + getServiceName().substring(1).toLowerCase(Locale.ROOT);
+    } else {
+      return serviceMetadata.getShortDesc();
+    }
+  }
+
+  @XmlElement
+  public String getDescription() {
+    if (serviceMetadata == null) {
+      return getShortDescription() + (Type.API == getType() ? " REST API" : Type.UI == getType() ? " Web User Interface" : "");
+    } else {
+      return serviceMetadata.getDescription();
+    }
+  }
+
+  @XmlElement
+  public Type getType() {
+    return serviceMetadata == null ? Type.UNKNOWN : Type.valueOf(serviceMetadata.getType());
+  }
+
+  @XmlElement
+  public String getContext() {
+    return (serviceMetadata == null ? "/" + getServiceName().toLowerCase(Locale.ROOT) : serviceMetadata.getContext()) + "/";
+  }
+
+  @XmlElement
+  public String getServiceUrl() {
+    String context = getContext();
+    if ("HIVE".equals(getServiceName())) {
 
 Review comment:
   Long term I hope we don't have to do this in the ServiceModel? It would be better to have this captured in the service metadata.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r384383203
 
 

 ##########
 File path: knox-homepage-backend/src/main/java/org/apache/knox/homepage/service/model/ServiceModel.java
 ##########
 @@ -0,0 +1,89 @@
+/*
+ * 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.knox.homepage.service.model;
+
+import java.util.Locale;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.knox.gateway.topology.Service;
+
+@XmlRootElement(name = "service")
+@XmlAccessorType(XmlAccessType.NONE)
+public class ServiceModel {
+
+  public enum Type {
+    API, UI, UNKNOWN
+  };
+
+  protected HttpServletRequest request;
+  protected String topologyName;
+  protected String gatewayPath;
+  protected Service service;
+
+  public void setRequest(HttpServletRequest request) {
+    this.request = request;
+  }
+
+  public void setTopologyName(String topologyName) {
+    this.topologyName = topologyName;
+  }
+
+  public void setGatewayPath(String gatewayPath) {
+    this.gatewayPath = gatewayPath;
+  }
+
+  public void setService(Service service) {
+    this.service = service;
+  }
+
 
 Review comment:
   Done.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378492033
 
 

 ##########
 File path: knox-homepage-backend/src/main/java/org/apache/knox/homepage/HomePageResource.java
 ##########
 @@ -0,0 +1,126 @@
+/*
+ * 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.knox.homepage;
+
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+
+import java.io.IOException;
+import java.nio.file.Paths;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateEncodingException;
+import java.security.cert.CertificateException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+
+import org.apache.knox.gateway.config.GatewayConfig;
+import org.apache.knox.gateway.services.GatewayServices;
+import org.apache.knox.gateway.services.ServerInfoService;
+import org.apache.knox.gateway.services.ServiceType;
+import org.apache.knox.gateway.services.security.KeystoreService;
+import org.apache.knox.gateway.services.topology.TopologyService;
+import org.apache.knox.gateway.topology.Service;
+import org.apache.knox.gateway.topology.Topology;
+import org.apache.knox.gateway.util.X509CertificateUtil;
+import org.apache.knox.homepage.service.model.ServiceModel;
+import org.apache.knox.homepage.service.model.ServiceModelFactory;
+
+@Path("/v1")
+public class HomePageResource {
+  private java.nio.file.Path pemFilePath;
+  private java.nio.file.Path jksFilePath;
+
+  @Context
+  private HttpServletRequest request;
+
+  @GET
+  @Produces({ APPLICATION_JSON })
+  @Path("generalProxyInformation")
+  public GeneralProxyInformation getGeneralProxyInformation() {
+    final GeneralProxyInformation proxyInfo = new GeneralProxyInformation();
+    try {
+      final GatewayServices gatewayServices = (GatewayServices) request.getServletContext().getAttribute(GatewayServices.GATEWAY_SERVICES_ATTRIBUTE);
+      if (gatewayServices != null) {
+        final ServerInfoService serviceInfoService = gatewayServices.getService(ServiceType.SERVER_INFO_SERVICE);
+        final String versionInfo = serviceInfoService.getBuildVersion() + " (hash=" + serviceInfoService.getBuildHash() +")";
+        proxyInfo.setVersion(versionInfo);
+        final KeystoreService keystoreService = gatewayServices.getService(ServiceType.KEYSTORE_SERVICE);
+        final GatewayConfig config = (GatewayConfig) request.getServletContext().getAttribute(GatewayConfig.GATEWAY_CONFIG_ATTRIBUTE);
+        final Certificate certificate = keystoreService.getKeystoreForGateway().getCertificate(config.getIdentityKeyAlias());
+        generateCertificatePem(certificate, config);
+        proxyInfo.setPublicCertPemPath("assets/gateway-client-trust.pem");
+        generateCertificateJks(certificate, config);
+        proxyInfo.setPublicCertJksPath("assets/gateway-client-trust.jks");
+        proxyInfo.setAdminUiUrl(getBaseGatewayUrl(config) + "/manager/admin-ui/");
+      }
+    } catch (Exception e) {
 
 Review comment:
   Ummm should do something here...

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r384072700
 
 

 ##########
 File path: gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/SSOCookieFederationFilter.java
 ##########
 @@ -93,6 +95,13 @@ public void init( FilterConfig filterConfig ) throws ServletException {
 
     // gateway path for deriving an idp url when missing
     gatewayPath = filterConfig.getInitParameter(GATEWAY_PATH);
+    if (StringUtils.isBlank(gatewayPath)) {
+      final GatewayConfig gatewayConfig = filterConfig.getServletContext() == null ? null
+          : (GatewayConfig) filterConfig.getServletContext().getAttribute(GatewayConfig.GATEWAY_CONFIG_ATTRIBUTE);
+      if (gatewayConfig != null) {
+        gatewayPath = gatewayConfig.getGatewayPath();
+      }
+    }
 
 Review comment:
   Fixed:
   - setting `gatewayPath` in its own method
   - removed the `commons-lang3` dependency

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r379195205
 
 

 ##########
 File path: knox-homepage-backend/src/main/java/org/apache/knox/homepage/HomePageResource.java
 ##########
 @@ -0,0 +1,197 @@
+/*
+ * 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.knox.homepage;
+
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+import static javax.ws.rs.core.MediaType.APPLICATION_XML;
+
+import java.io.IOException;
+import java.nio.file.Paths;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateEncodingException;
+import java.security.cert.CertificateException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Optional;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+
+import org.apache.knox.gateway.config.GatewayConfig;
+import org.apache.knox.gateway.i18n.messages.MessagesFactory;
+import org.apache.knox.gateway.service.definition.Metadata;
+import org.apache.knox.gateway.service.definition.ServiceDefinitionPair;
+import org.apache.knox.gateway.services.GatewayServices;
+import org.apache.knox.gateway.services.ServerInfoService;
+import org.apache.knox.gateway.services.ServiceType;
+import org.apache.knox.gateway.services.registry.ServiceDefinitionRegistry;
+import org.apache.knox.gateway.services.security.KeystoreService;
+import org.apache.knox.gateway.services.security.KeystoreServiceException;
+import org.apache.knox.gateway.services.topology.TopologyService;
+import org.apache.knox.gateway.topology.Service;
+import org.apache.knox.gateway.topology.Topology;
+import org.apache.knox.gateway.util.X509CertificateUtil;
+
+@Path("/v1")
+public class HomePageResource {
+  private static final KnoxHomepageMessages LOG = MessagesFactory.get(KnoxHomepageMessages.class);
+  private static final String SNAPSHOT_VERSION_POSTFIX = "-SNAPSHOT";
+
+  private java.nio.file.Path pemFilePath;
+  private java.nio.file.Path jksFilePath;
+
+  @Context
+  private HttpServletRequest request;
+
+  @GET
+  @Produces({ APPLICATION_JSON, APPLICATION_XML })
+  @Path("generalProxyInformation")
 
 Review comment:
   How about just `info` instead of `generalProxyInformation`? Something simpler.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on issue #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on issue #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#issuecomment-586040997
 
 
   One other thing to maybe think about is how easy it is to change the homepage authentication/authorization. Right now we end up with separate Shiro and configs. This is a bit clunky especially when demo ldap won't exist for most users when they deploy for real.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #263: [WIP] KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378492500
 
 

 ##########
 File path: gateway-release/src/assembly.xml
 ##########
 @@ -90,6 +90,13 @@
                 <exclude>**/*.bundle.map</exclude>
             </excludes>
         </fileSet>
+        <fileSet>
+            <directory>${project.build.directory}/deployments</directory>
+            <outputDirectory>data/deployments</outputDirectory>
+            <includes>
+                <include>**/%2F*/**/*</include>
 
 Review comment:
   weird `%2F`??

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] moresandeep commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
moresandeep commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r378357573
 
 

 ##########
 File path: knox-homepage-backend/src/main/java/org/apache/knox/homepage/service/model/ServiceModel.java
 ##########
 @@ -0,0 +1,89 @@
+/*
+ * 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.knox.homepage.service.model;
+
+import java.util.Locale;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.knox.gateway.topology.Service;
+
+@XmlRootElement(name = "service")
+@XmlAccessorType(XmlAccessType.NONE)
+public class ServiceModel {
+
+  public enum Type {
+    API, UI, UNKNOWN
+  };
+
+  protected HttpServletRequest request;
+  protected String topologyName;
+  protected String gatewayPath;
+  protected Service service;
+
+  public void setRequest(HttpServletRequest request) {
+    this.request = request;
+  }
+
+  public void setTopologyName(String topologyName) {
+    this.topologyName = topologyName;
+  }
+
+  public void setGatewayPath(String gatewayPath) {
+    this.gatewayPath = gatewayPath;
+  }
+
+  public void setService(Service service) {
+    this.service = service;
+  }
+
 
 Review comment:
   We should also get display service version

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#discussion_r384078859
 
 

 ##########
 File path: gateway-service-definitions/src/main/resources/services/cm-ui/1.0.0/rewrite.xml
 ##########
 @@ -0,0 +1,33 @@
+<!--
+   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.
+-->
+<rules>
+  <rule dir="IN" name="CM-UI/cm-ui/ui/inbound" pattern="*://*:*/**/cmf/{xxx_unique_path=**}?{**}">
+    <rewrite template="{$serviceUrl[CM-UI]}/cmf/{xxx_unique_path=**}?{**}"/>
+  </rule>
+  <rule dir="IN" name="CM-UI/cm-ui/ui/root" pattern="*://*:*/**/cmf/">
+    <rewrite template="{$serviceUrl[CM-UI]}/cmf/"/>
+  </rule>
+  <rule dir="IN" name="CM-UI/cm-ui/static/inbound" pattern="*://*:*/**/static/{xxx_unique_path=**}?{**}">
+    <rewrite template="{$serviceUrl[CM-UI]}/static/{xxx_unique_path=**}?{**}"/>
+  </rule>
+  <rule dir="IN" name="CM-UI/cm-ui/rest" pattern="*://*:*/**/api/{xxx_unique_path=**}?{**}">
 
 Review comment:
   As discussed this is OK.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on issue #263: KNOX-2226 - Add home page to Knox

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on issue #263: KNOX-2226 - Add home page to Knox
URL: https://github.com/apache/knox/pull/263#issuecomment-586152593
 
 
   @risdenk ,
   
   WRT your JSON question: on one hand, you are right, it'd be cleaner when reading the JSON as you recommended. On the other hand, this API generates XML output too, and in that case, the current structure is cleaner IMO:
   ```
         <uiServices>
            <service>
               <context>/druid-coordinator-ui/</context>
               <description>The Druid Coordinator exposes a web GUI for displaying cluster information and rule configuration.</description>
               <serviceName>DRUID-COORDINATOR-UI</serviceName>
               <serviceUrl>https://localhost:8443/gateway/sandbox/druid-coordinator-ui/</serviceUrl>
               <shortDesc>Druid Coordinator Console</shortDesc>
               <type>UI</type>
            </service>
            <service>
               <context>/druid-overlord-ui/</context>
               <description>The Overlord provides a UI for managing tasks and workers.</description>
               <serviceName>DRUID-OVERLORD-UI</serviceName>
               <serviceUrl>https://localhost:8443/gateway/sandbox/druid-overlord-ui/</serviceUrl>
               <shortDesc>Druid Overlord Console</shortDesc>
               <type>UI</type>
            </service>
            <service>
               <context>/hue/</context>
               <description>Hue UI is a Web interface for analyzing data with Apache Hadoop</description>
               <serviceName>HUE</serviceName>
               <serviceUrl>https://localhost:8443/gateway/sandbox/hue/</serviceUrl>
               <shortDesc>Hue UI</shortDesc>
               <type>UI</type>
            </service>
         </uiServices>
   ```
   
   Moreover, the current solution is consistent with Admin API outputs:
   ```
   $ curl -iku admin:admin-password -H "Accept: application/json" 'https://localhost:8443/gateway/admin/api/v1/topologies/'
   HTTP/1.1 200 OK
   Date: Fri, 14 Feb 2020 08:26:44 GMT
   Set-Cookie: KNOXSESSIONID=node01wffn263vit5nemdc9021f45z3.node0; Path=/gateway/admin; Secure; HttpOnly
   Expires: Thu, 01 Jan 1970 00:00:00 GMT
   Set-Cookie: rememberMe=deleteMe; Path=/gateway/admin; Max-Age=0; Expires=Thu, 13-Feb-2020 08:26:44 GMT
   Content-Type: application/json
   Content-Length: 1160
   Server: Jetty(9.4.26.v20200117)
   
   {
      "topologies" : {
         "topology" : [ {
            "name" : "admin",
            "timestamp" : "1581667994000",
            "uri" : "https://localhost:8443/gateway/admin",
            "href" : "https://localhost:8443/gateway/admin/api/v1/topologies/admin"
         }, {
            "name" : "cdp-proxy",
            "timestamp" : "1581625805000",
            "uri" : "https://localhost:8443/gateway/cdp-proxy",
            "href" : "https://localhost:8443/gateway/admin/api/v1/topologies/cdp-proxy"
         }, {
            "name" : "knoxsso",
            "timestamp" : "1581625577000",
            "uri" : "https://localhost:8443/gateway/knoxsso",
            "href" : "https://localhost:8443/gateway/admin/api/v1/topologies/knoxsso"
         }, {
            "name" : "manager",
            "timestamp" : "1581667994000",
            "uri" : "https://localhost:8443/gateway/manager",
            "href" : "https://localhost:8443/gateway/admin/api/v1/topologies/manager"
         }, {
            "name" : "sandbox",
            "timestamp" : "1581625577000",
            "uri" : "https://localhost:8443/gateway/sandbox",
            "href" : "https://localhost:8443/gateway/admin/api/v1/topologies/sandbox"
         } ]
      }
   }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services