From 1a703af9cb9e81dd95959213cd317d840fbb49e3 Mon Sep 17 00:00:00 2001 From: Julius Gruber Date: Fri, 20 Sep 2019 13:36:58 +0200 Subject: [PATCH] Code cleanup --- src/app/+login-page/login-page.component.html | 1 - .../shibboleth-target-page.component.html | 7 +++---- .../shibboleth-target-page.component.scss | 2 -- src/app/core/auth/auth.interceptor.ts | 6 ------ .../shibboleth/log-in-shibboleth.component.ts | 21 ++----------------- 5 files changed, 5 insertions(+), 32 deletions(-) diff --git a/src/app/+login-page/login-page.component.html b/src/app/+login-page/login-page.component.html index 0e13e225a7..4ce29024e9 100644 --- a/src/app/+login-page/login-page.component.html +++ b/src/app/+login-page/login-page.component.html @@ -3,7 +3,6 @@

{{"login.form.header" | translate}}

-
diff --git a/src/app/+login-page/shibbolethTargetPage/shibboleth-target-page.component.html b/src/app/+login-page/shibbolethTargetPage/shibboleth-target-page.component.html index f8472e6c02..8ad0948136 100644 --- a/src/app/+login-page/shibbolethTargetPage/shibboleth-target-page.component.html +++ b/src/app/+login-page/shibbolethTargetPage/shibboleth-target-page.component.html @@ -1,5 +1,4 @@ + - - diff --git a/src/app/+login-page/shibbolethTargetPage/shibboleth-target-page.component.scss b/src/app/+login-page/shibbolethTargetPage/shibboleth-target-page.component.scss index 662e00d284..52c5af628b 100644 --- a/src/app/+login-page/shibbolethTargetPage/shibboleth-target-page.component.scss +++ b/src/app/+login-page/shibbolethTargetPage/shibboleth-target-page.component.scss @@ -1,5 +1,3 @@ -/* -This is a comment*/ .login-shibboleth { } diff --git a/src/app/core/auth/auth.interceptor.ts b/src/app/core/auth/auth.interceptor.ts index 6fab131fad..5d267743e6 100644 --- a/src/app/core/auth/auth.interceptor.ts +++ b/src/app/core/auth/auth.interceptor.ts @@ -97,17 +97,13 @@ export class AuthInterceptor implements HttpInterceptor { const completeWWWauthenticateHeader = headers.get('www-authenticate'); const regex = /(\w+ (\w+=((".*?")|[^,]*)(, )?)*)/g; const realms = completeWWWauthenticateHeader.match(regex); - // console.log('realms: ', realms) // tslint:disable-next-line:forin for (const j in realms) { - console.log('realm:', realms[j]); const splittedRealm = realms[j].split(', '); const methodName = splittedRealm[0].split(' ')[0].trim(); - // console.log('methodName: ', methodName); - // console.log('splittedRealm: ', splittedRealm); let authMethodModel: AuthMethodModel; if (splittedRealm.length === 1) { authMethodModel = new AuthMethodModel(methodName); @@ -155,8 +151,6 @@ export class AuthInterceptor implements HttpInterceptor { const token = authService.getToken(); let newReq; -// console.log('intercept() request: ', req); - if (authService.isTokenExpired()) { authService.setRedirectUrl(this.router.url); // The access token is expired diff --git a/src/app/shared/log-in/methods/shibboleth/log-in-shibboleth.component.ts b/src/app/shared/log-in/methods/shibboleth/log-in-shibboleth.component.ts index fa1f572615..197398a933 100644 --- a/src/app/shared/log-in/methods/shibboleth/log-in-shibboleth.component.ts +++ b/src/app/shared/log-in/methods/shibboleth/log-in-shibboleth.component.ts @@ -1,31 +1,21 @@ import { Component, - EventEmitter, Inject, Input, - OnDestroy, OnInit, - Output, - QueryList, - ViewChildren } from '@angular/core'; import { renderAuthMethodFor } from '../authMethods-decorator'; import { AuthMethodType } from '../authMethods-type'; import { AuthMethodModel } from '../../../../core/auth/models/auth-method.model'; -import { FormBuilder, FormControl, FormGroup } from '@angular/forms'; +import { FormBuilder } from '@angular/forms'; import { select, Store } from '@ngrx/store'; import { CoreState } from '../../../../core/core.reducers'; import { StartShibbolethAuthenticationAction } from '../../../../core/auth/auth.actions'; -import { Observable, of, Subscription } from 'rxjs'; +import { Observable } from 'rxjs'; import { - getAuthenticationMethods, isAuthenticated, isAuthenticationLoading } from '../../../../core/auth/selectors'; -import { HttpClient } from '@angular/common/http'; -import { GLOBAL_CONFIG, GlobalConfig } from '../../../../../config'; -import { ShibbConstants } from '../../../../+login-page/shibbolethTargetPage/const/shibbConstants'; -import { tap } from 'rxjs/operators'; @Component({ selector: 'ds-log-in-shibboleth', @@ -60,23 +50,16 @@ export class LogInShibbolethComponent implements OnInit { } ngOnInit(): void { - - // console.log('Injected authMethodModel', this.injectedAuthMethodModel); - // set isAuthenticated this.isAuthenticated = this.store.pipe(select(isAuthenticated)); // set loading this.loading = this.store.pipe(select(isAuthenticationLoading)); - } submit() { - console.log('submit() was called'); this.store.dispatch(new StartShibbolethAuthenticationAction(this.authMethodModel)); - // e.g. host = 'fis.tiss.tuwien.ac.at'; // https://host/Shibboleth.sso/Login?target=https://host/shibboleth - // https://fis.tiss.tuwien.ac.at/Shibboleth.sso/Login?target=https://fis.tiss.tuwien.ac.at/shibboleth'; window.location.href = this.injectedAuthMethodModel.location; }