lmccay commented on a change in pull request #372: URL: https://github.com/apache/knox/pull/372#discussion_r483634252
########## 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: This isn't being used now since it doesn't render the button at all for now. I'm not sure which is better which is why I left it here for now. A missing logout button may seem like a bug but a logout button that doesn't log you out may be bad as well. At least it is known to be intentional and provides some insights though. Planned to follow up with discussion on this. If we go that route we can use sweetalert instead for sure. ---------------------------------------------------------------- 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]
