Code cleanup

This commit is contained in:
Julius Gruber
2019-09-20 13:36:58 +02:00
parent 9844e9eff7
commit 1a703af9cb
5 changed files with 5 additions and 32 deletions

View File

@@ -3,7 +3,6 @@
<div> <div>
<img class="mb-4 login-logo" src="assets/images/dspace-logo.png"> <img class="mb-4 login-logo" src="assets/images/dspace-logo.png">
<h1 class="h3 mb-0 font-weight-normal">{{"login.form.header" | translate}}</h1> <h1 class="h3 mb-0 font-weight-normal">{{"login.form.header" | translate}}</h1>
<!-- <ds-login-container></ds-login-container>-->
<ds-auth-methods></ds-auth-methods> <ds-auth-methods></ds-auth-methods>
</div> </div>
</div> </div>

View File

@@ -1,5 +1,4 @@
<ds-loading *ngIf="(loading | async)"
message="'Shibboleth log-in successfull. Please wait while we redirect you...'"
class="m-5"></ds-loading>
<ds-loading *ngIf="(loading | async)" message="'Shibboleth log-in successfull. Please wait while we redirect you...'" class="m-5"></ds-loading>
<!--<p>
Shibboleth login successfull! Please wait while we redirect you...
</p>-->

View File

@@ -1,5 +1,3 @@
/*
This is a comment*/
.login-shibboleth { .login-shibboleth {
} }

View File

@@ -97,17 +97,13 @@ export class AuthInterceptor implements HttpInterceptor {
const completeWWWauthenticateHeader = headers.get('www-authenticate'); const completeWWWauthenticateHeader = headers.get('www-authenticate');
const regex = /(\w+ (\w+=((".*?")|[^,]*)(, )?)*)/g; const regex = /(\w+ (\w+=((".*?")|[^,]*)(, )?)*)/g;
const realms = completeWWWauthenticateHeader.match(regex); const realms = completeWWWauthenticateHeader.match(regex);
// console.log('realms: ', realms)
// tslint:disable-next-line:forin // tslint:disable-next-line:forin
for (const j in realms) { for (const j in realms) {
console.log('realm:', realms[j]);
const splittedRealm = realms[j].split(', '); const splittedRealm = realms[j].split(', ');
const methodName = splittedRealm[0].split(' ')[0].trim(); const methodName = splittedRealm[0].split(' ')[0].trim();
// console.log('methodName: ', methodName);
// console.log('splittedRealm: ', splittedRealm);
let authMethodModel: AuthMethodModel; let authMethodModel: AuthMethodModel;
if (splittedRealm.length === 1) { if (splittedRealm.length === 1) {
authMethodModel = new AuthMethodModel(methodName); authMethodModel = new AuthMethodModel(methodName);
@@ -155,8 +151,6 @@ export class AuthInterceptor implements HttpInterceptor {
const token = authService.getToken(); const token = authService.getToken();
let newReq; let newReq;
// console.log('intercept() request: ', req);
if (authService.isTokenExpired()) { if (authService.isTokenExpired()) {
authService.setRedirectUrl(this.router.url); authService.setRedirectUrl(this.router.url);
// The access token is expired // The access token is expired

View File

@@ -1,31 +1,21 @@
import { import {
Component, Component,
EventEmitter,
Inject, Inject,
Input, Input,
OnDestroy,
OnInit, OnInit,
Output,
QueryList,
ViewChildren
} from '@angular/core'; } from '@angular/core';
import { renderAuthMethodFor } from '../authMethods-decorator'; import { renderAuthMethodFor } from '../authMethods-decorator';
import { AuthMethodType } from '../authMethods-type'; import { AuthMethodType } from '../authMethods-type';
import { AuthMethodModel } from '../../../../core/auth/models/auth-method.model'; 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 { select, Store } from '@ngrx/store';
import { CoreState } from '../../../../core/core.reducers'; import { CoreState } from '../../../../core/core.reducers';
import { StartShibbolethAuthenticationAction } from '../../../../core/auth/auth.actions'; import { StartShibbolethAuthenticationAction } from '../../../../core/auth/auth.actions';
import { Observable, of, Subscription } from 'rxjs'; import { Observable } from 'rxjs';
import { import {
getAuthenticationMethods,
isAuthenticated, isAuthenticated,
isAuthenticationLoading isAuthenticationLoading
} from '../../../../core/auth/selectors'; } 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({ @Component({
selector: 'ds-log-in-shibboleth', selector: 'ds-log-in-shibboleth',
@@ -60,23 +50,16 @@ export class LogInShibbolethComponent implements OnInit {
} }
ngOnInit(): void { ngOnInit(): void {
// console.log('Injected authMethodModel', this.injectedAuthMethodModel);
// set isAuthenticated // set isAuthenticated
this.isAuthenticated = this.store.pipe(select(isAuthenticated)); this.isAuthenticated = this.store.pipe(select(isAuthenticated));
// set loading // set loading
this.loading = this.store.pipe(select(isAuthenticationLoading)); this.loading = this.store.pipe(select(isAuthenticationLoading));
} }
submit() { submit() {
console.log('submit() was called');
this.store.dispatch(new StartShibbolethAuthenticationAction(this.authMethodModel)); 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://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; window.location.href = this.injectedAuthMethodModel.location;
} }