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 2021/08/27 23:15:43 UTC

[GitHub] [knox] moresandeep commented on a change in pull request #476: KNOX-2625 - initial commit

moresandeep commented on a change in pull request #476:
URL: https://github.com/apache/knox/pull/476#discussion_r697761248



##########
File path: knox-homepage-ui/home/app/sessionInformation/session.information.component.ts
##########
@@ -35,10 +35,11 @@ export class SessionInformationComponent implements OnInit {
 
     getUser() {
         if (this.sessionInformation) {
-            console.debug('SessionInformationComponent --> getUser() --> ' + this.sessionInformation.user);
-            return this.sessionInformation.user;
+          console.debug('SessionInformationComponent --> getUser() --> ' + this.sessionInformation.user);

Review comment:
       Same as above.

##########
File path: gateway-applications/src/main/resources/applications/knoxauth/app/logout.jsp
##########
@@ -0,0 +1,164 @@
+<!--
+  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.
+-->
+<%@ page import="java.util.Collection" %>
+<%@ page import="java.util.Map" %>
+<%@ page import="org.apache.knox.gateway.topology.Topology" %>
+<%@ page import="org.apache.knox.gateway.topology.Service" %>
+<%@ page import="org.apache.knox.gateway.util.RegExUtils" %>
+<%@ page import="org.apache.knox.gateway.util.WhitelistUtils" %>
+<%@ page import="org.apache.knox.gateway.config.GatewayConfig" %>
+<%@ page import="java.net.MalformedURLException" %>
+<%@ page import="org.apache.knox.gateway.util.Urls" %>
+
+<!DOCTYPE html>
+<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7"><![endif]-->
+<!--[if IE 7]><html class="no-js lt-ie9 lt-ie8"><![endif]-->
+<!--[if IE 8]><html class="no-js lt-ie9"><![endif]-->
+<!--[if gt IE 8]><!-->
+<html class="no-js">
+    <!--<![endif]-->
+    <head>
+        <meta charset="utf-8">
+        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+        <meta name="description" content="">
+        <meta name="viewport" content="width=device-width">
+        <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
+        <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
+        <meta http-equiv="Pragma" content="no-cache">
+        <meta http-equiv="Expires" content="0">
+
+        <link rel="shortcut icon" href="images/favicon.ico">
+        <link href="styles/bootstrap.min.css" media="all" rel="stylesheet" type="text/css" id="bootstrap-css">
+        <link href="styles/knox.css" media="all" rel="stylesheet" type="text/css" >
+
+        <script src="libs/bower/jquery/js/jquery-3.5.1.min.js" ></script>

Review comment:
       looks like this might break after we upgrade jquery

##########
File path: knox-homepage-ui/home/app/homepage.service.ts
##########
@@ -128,6 +129,20 @@ export class HomepageService {
     }
 
     private handleError(error: HttpErrorResponse): Promise<any> {
+        //location.reload();
+        let refresh;
+        this.route.queryParams.subscribe(params => {
+          refresh = params['refresh'];
+          console.debug('refresh = ' + refresh)
+          if (refresh) {
+            console.debug('Refreshing page...', window.location.href);

Review comment:
       console statements can be removed.

##########
File path: gateway-applications/src/main/resources/applications/knoxauth/app/logout.jsp
##########
@@ -0,0 +1,164 @@
+<!--
+  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.
+-->
+<%@ page import="java.util.Collection" %>
+<%@ page import="java.util.Map" %>
+<%@ page import="org.apache.knox.gateway.topology.Topology" %>
+<%@ page import="org.apache.knox.gateway.topology.Service" %>
+<%@ page import="org.apache.knox.gateway.util.RegExUtils" %>
+<%@ page import="org.apache.knox.gateway.util.WhitelistUtils" %>
+<%@ page import="org.apache.knox.gateway.config.GatewayConfig" %>
+<%@ page import="java.net.MalformedURLException" %>
+<%@ page import="org.apache.knox.gateway.util.Urls" %>
+
+<!DOCTYPE html>
+<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7"><![endif]-->
+<!--[if IE 7]><html class="no-js lt-ie9 lt-ie8"><![endif]-->
+<!--[if IE 8]><html class="no-js lt-ie9"><![endif]-->
+<!--[if gt IE 8]><!-->
+<html class="no-js">
+    <!--<![endif]-->
+    <head>
+        <meta charset="utf-8">
+        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+        <meta name="description" content="">
+        <meta name="viewport" content="width=device-width">
+        <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
+        <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
+        <meta http-equiv="Pragma" content="no-cache">
+        <meta http-equiv="Expires" content="0">
+
+        <link rel="shortcut icon" href="images/favicon.ico">
+        <link href="styles/bootstrap.min.css" media="all" rel="stylesheet" type="text/css" id="bootstrap-css">
+        <link href="styles/knox.css" media="all" rel="stylesheet" type="text/css" >
+
+        <script src="libs/bower/jquery/js/jquery-3.5.1.min.js" ></script>
+
+        <script type="text/javascript" src="js/knoxauth.js"></script>
+    <%
+        String originalUrl = request.getParameter("originalUrl");
+        Topology topology = (Topology)request.getSession().getServletContext().getAttribute("org.apache.knox.gateway.topology");
+        String whitelist = null;
+        String cookieName = null;
+        GatewayConfig gatewayConfig =
+                (GatewayConfig) request.getServletContext().
+                getAttribute(GatewayConfig.GATEWAY_CONFIG_ATTRIBUTE);
+        String globalLogoutPageURL = gatewayConfig.getGlobalLogoutPageUrl();
+        Collection<Service> services = topology.getServices();
+        for (Object service : services) {
+          Service svc = (Service)service;
+          if (svc.getRole().equals("KNOXSSO")) {
+            Map<String, String> params = svc.getParams();
+            whitelist = params.get("knoxsso.redirect.whitelist.regex");
+            // LJM TODO: get cookie name and possibly domain prefix info for use in logout
+            cookieName = params.get("knoxsso.cookie.name");
+            if (cookieName == null) {
+                cookieName = "hadoop-jwt";

Review comment:
       This might break in case someone changes the cookie name.




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

To unsubscribe, e-mail: dev-unsubscribe@knox.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org