smolnar82 commented on a change in pull request #372:
URL: https://github.com/apache/knox/pull/372#discussion_r483424710
##########
File path: gateway-release/pom.xml
##########
@@ -451,7 +451,7 @@
</dependency>
<dependency>
<groupId>org.apache.knox</groupId>
- <artifactId>gateway-service-metadata</artifactId>
+ <artifactId>gateway-service-session</artifactId>
Review comment:
Why not add the new service as a separate dependency?
##########
File path:
gateway-service-knoxssout/src/main/java/org/apache/knox/gateway/service/knoxsso/WebSSOutResource.java
##########
@@ -44,7 +44,7 @@
private static final String SSO_COOKIE_NAME = "knoxsso.cookie.name";
private static final String DEFAULT_SSO_COOKIE_NAME = "hadoop-jwt";
- static final String RESOURCE_PATH = "/api/v1/webssout";
+ static final String RESOURCE_PATH = "knoxssout/api/v1/webssout";
Review comment:
I don't get why do we need the `knoxssout`. This change makes the SSOUT
API inconsistent with the rest of the APIs.
##########
File path:
gateway-service-session/src/main/java/org/apache/knox/gateway/service/session/SessionResource.java
##########
@@ -0,0 +1,65 @@
+/*
+ * 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.session;
+
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+import static javax.ws.rs.core.MediaType.APPLICATION_XML;
+
+import javax.inject.Singleton;
+import javax.servlet.ServletContext;
+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.i18n.messages.MessagesFactory;
+import org.apache.knox.gateway.security.SubjectUtils;
+
+@Singleton
+@Path("session/api/v1/")
Review comment:
Perhaps changing this to `api/v1/session` to be consistent with another
API endpoints?
##########
File path:
knox-homepage-ui/home/app/sessionInformation/session.information.component.ts
##########
@@ -0,0 +1,80 @@
+/*
+ * 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 {SessionInformation} from './session.information';
+
+@Component({
+ selector: 'app-session-information',
+ templateUrl: './session.information.component.html',
+ providers: [HomepageService]
+})
+
+export class SessionInformationComponent implements OnInit {
+
+ sessionInformation: SessionInformation;
+ logoutSupported = true;
+
+ constructor(private homepageService: HomepageService) {
+ this['showSessionInformation'] = true;
+ }
+
+ getUser() {
+ if (this.sessionInformation) {
+ console.debug('SessionInformationComponent --> getUser() --> ' +
this.sessionInformation.user);
+ return this.sessionInformation.user;
+ }
+ console.debug('SessionInformationComponent --> getUser() --> dr.who');
+ return 'dr.who';
+ }
+
+ getLogoutUrl() {
+ if (this.sessionInformation) {
+ console.debug('SessionInformationComponent --> getLogoutUrl() -->
' + this.sessionInformation.logoutUrl);
+ return this.sessionInformation.logoutUrl;
+ }
+ return null;
+ }
+
+ logout() {
+ // window.alert('Are you sure???');
+ console.debug('SessionInformationComponent --> attempting logout() -->
');
+ if (this.sessionInformation) {
+ if (this.getLogoutUrl() == null) {
+ window.alert('Logout for the configured is IDP not
supported.\nPlease close all browser windows to logout.');
Review comment:
There is a more elegant way of notifying the end-users: using a module
called `sweetalert` (https://www.npmjs.com/package/sweetalert). It's been used
both on the Admin UI and on the Home Page. See this usage for instance:
https://github.com/apache/knox/blob/master/knox-homepage-ui/home/app/homepage.service.ts#L81
##########
File path:
knox-homepage-ui/home/app/sessionInformation/session.information.component.ts
##########
@@ -0,0 +1,80 @@
+/*
+ * 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 {SessionInformation} from './session.information';
+
+@Component({
+ selector: 'app-session-information',
+ templateUrl: './session.information.component.html',
+ providers: [HomepageService]
+})
+
+export class SessionInformationComponent implements OnInit {
+
+ sessionInformation: SessionInformation;
+ logoutSupported = true;
+
+ constructor(private homepageService: HomepageService) {
+ this['showSessionInformation'] = true;
+ }
+
+ getUser() {
+ if (this.sessionInformation) {
+ console.debug('SessionInformationComponent --> getUser() --> ' +
this.sessionInformation.user);
+ return this.sessionInformation.user;
+ }
+ console.debug('SessionInformationComponent --> getUser() --> dr.who');
+ return 'dr.who';
+ }
+
+ getLogoutUrl() {
+ if (this.sessionInformation) {
+ console.debug('SessionInformationComponent --> getLogoutUrl() -->
' + this.sessionInformation.logoutUrl);
+ return this.sessionInformation.logoutUrl;
+ }
+ return null;
+ }
+
+ logout() {
+ // window.alert('Are you sure???');
+ console.debug('SessionInformationComponent --> attempting logout() -->
');
+ if (this.sessionInformation) {
+ if (this.getLogoutUrl() == null) {
Review comment:
I'd use `this.logoutSupported` so that the logic if logout is supported
happens in one place only (in `setSessionInformation`).
##########
File path:
knox-homepage-ui/home/app/sessionInformation/session.information.component.ts
##########
@@ -0,0 +1,80 @@
+/*
+ * 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 {SessionInformation} from './session.information';
+
+@Component({
+ selector: 'app-session-information',
+ templateUrl: './session.information.component.html',
+ providers: [HomepageService]
+})
+
+export class SessionInformationComponent implements OnInit {
+
+ sessionInformation: SessionInformation;
+ logoutSupported = true;
+
+ constructor(private homepageService: HomepageService) {
+ this['showSessionInformation'] = true;
+ }
+
+ getUser() {
+ if (this.sessionInformation) {
+ console.debug('SessionInformationComponent --> getUser() --> ' +
this.sessionInformation.user);
+ return this.sessionInformation.user;
+ }
+ console.debug('SessionInformationComponent --> getUser() --> dr.who');
+ return 'dr.who';
Review comment:
Why not returning `null`?
----------------------------------------------------------------
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:
[email protected]