Remove shibboleth target page

This commit is contained in:
Giuseppe Digilio
2019-10-24 21:47:11 +02:00
parent e4bcf3d4b0
commit ab117105b3
9 changed files with 42 additions and 104 deletions

View File

@@ -1,3 +0,0 @@
export class ShibbConstants {
public static readonly SHIBBOLETH_REDIRECT_ROUTE = 'shibboleth';
}

View File

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

View File

@@ -1,3 +0,0 @@
.login-shibboleth {
}

View File

@@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ShibbolethTargetPageComponent } from './shibboleth-target-page.component';
describe('ShibbolethComponent', () => {
let component: ShibbolethTargetPageComponent;
let fixture: ComponentFixture<ShibbolethTargetPageComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ShibbolethTargetPageComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ShibbolethTargetPageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -1,28 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { GetJWTafterShibbLoginAction } from '../../core/auth/auth.actions';
import { Store } from '@ngrx/store';
import { CoreState } from '../../core/core.reducers';
import { Observable, of } from 'rxjs';
@Component({
selector: 'ds-shibboleth-page',
templateUrl: './shibboleth-target-page.component.html',
styleUrls: ['./shibboleth-target-page.component.scss']
})
export class ShibbolethTargetPageComponent implements OnInit {
/**
* True if the shibboleth authentication is loading.
* @type {boolean}
*/
public loading: Observable<boolean>;
ngOnInit() {
this.loading = of(true);
this.store.dispatch(new GetJWTafterShibbLoginAction());
}
constructor(private store: Store<CoreState>,) {
}
}

View File

@@ -3,23 +3,27 @@ import { RouterModule } from '@angular/router';
import { PageNotFoundComponent } from './pagenotfound/pagenotfound.component';
import { AuthenticatedGuard } from './core/auth/authenticated.guard';
import { ShibbolethTargetPageComponent } from './+login-page/shibbolethTargetPage/shibboleth-target-page.component';
import { ShibbConstants } from './+login-page/shibbolethTargetPage/const/shibbConstants';
const ITEM_MODULE_PATH = 'items';
export function getItemModulePath() {
return `/${ITEM_MODULE_PATH}`;
}
const COLLECTION_MODULE_PATH = 'collections';
export function getCollectionModulePath() {
return `/${COLLECTION_MODULE_PATH}`;
}
const COMMUNITY_MODULE_PATH = 'communities';
export function getCommunityModulePath() {
return `/${COMMUNITY_MODULE_PATH}`;
}
const ADMIN_MODULE_PATH = 'admin';
const ADMIN_MODULE_PATH = 'admin';
export function getAdminModulePath() {
return `/${ADMIN_MODULE_PATH}`;
}
@@ -32,16 +36,25 @@ export function getAdminModulePath() {
{ path: COMMUNITY_MODULE_PATH, loadChildren: './+community-page/community-page.module#CommunityPageModule' },
{ path: COLLECTION_MODULE_PATH, loadChildren: './+collection-page/collection-page.module#CollectionPageModule' },
{ path: ITEM_MODULE_PATH, loadChildren: './+item-page/item-page.module#ItemPageModule' },
{ path: 'mydspace', loadChildren: './+my-dspace-page/my-dspace-page.module#MyDSpacePageModule', canActivate: [AuthenticatedGuard] },
{
path: 'mydspace',
loadChildren: './+my-dspace-page/my-dspace-page.module#MyDSpacePageModule',
canActivate: [AuthenticatedGuard]
},
{ path: 'search', loadChildren: './+search-page/search-page.module#SearchPageModule' },
{ path: 'browse', loadChildren: './+browse-by/browse-by.module#BrowseByModule' },
{ path: ADMIN_MODULE_PATH, loadChildren: './+admin/admin.module#AdminModule', canActivate: [AuthenticatedGuard] },
{ path: 'login', loadChildren: './+login-page/login-page.module#LoginPageModule' },
{ path: 'logout', loadChildren: './+logout-page/logout-page.module#LogoutPageModule' },
{ path: 'submit', loadChildren: './+submit-page/submit-page.module#SubmitPageModule' },
{ path: 'workspaceitems', loadChildren: './+workspaceitems-edit-page/workspaceitems-edit-page.module#WorkspaceitemsEditPageModule' },
{ path: 'workflowitems', loadChildren: './+workflowitems-edit-page/workflowitems-edit-page.module#WorkflowItemsEditPageModule' },
{ path: ShibbConstants.SHIBBOLETH_REDIRECT_ROUTE, pathMatch: 'full', component: ShibbolethTargetPageComponent },
{
path: 'workspaceitems',
loadChildren: './+workspaceitems-edit-page/workspaceitems-edit-page.module#WorkspaceitemsEditPageModule'
},
{
path: 'workflowitems',
loadChildren: './+workflowitems-edit-page/workflowitems-edit-page.module#WorkflowItemsEditPageModule'
},
{ path: '**', pathMatch: 'full', component: PageNotFoundComponent },
])
],

View File

@@ -40,7 +40,6 @@ import { NavbarModule } from './navbar/navbar.module';
import { JournalEntitiesModule } from './entity-groups/journal-entities/journal-entities.module';
import { ResearchEntitiesModule } from './entity-groups/research-entities/research-entities.module';
import { ClientCookieService } from './core/services/client-cookie.service';
import { ShibbolethTargetPageComponent } from './+login-page/shibbolethTargetPage/shibboleth-target-page.component';
export function getConfig() {
return ENV_CONFIG;
@@ -114,7 +113,6 @@ const DECLARATIONS = [
PageNotFoundComponent,
NotificationComponent,
NotificationsBoardComponent,
ShibbolethTargetPageComponent
];
const EXPORTS = [

View File

@@ -1,7 +1,6 @@
<a class="btn btn-lg btn-primary btn-block mt-3"
(click)="submit()"
role="button"
>{{"login.form.shibboleth" | translate}}</a>
<a class="btn btn-lg btn-primary btn-block mt-2" [href]="location" role="button">
{{"login.form.shibboleth" | translate}}
</a>

View File

@@ -1,23 +1,14 @@
import {
Component,
Inject,
Input,
OnInit,
} from '@angular/core';
import { Component, Inject, Input, OnInit, } from '@angular/core';
import { Observable } from 'rxjs';
import { select, Store } from '@ngrx/store';
import { renderAuthMethodFor } from '../authMethods-decorator';
import { AuthMethodType } from '../authMethods-type';
import { AuthMethodModel } from '../../../../core/auth/models/auth-method.model';
import { FormBuilder } from '@angular/forms';
import { select, Store } from '@ngrx/store';
import { CoreState } from '../../../../core/core.reducers';
import { SetRedirectUrlAction, StartShibbolethAuthenticationAction } from '../../../../core/auth/auth.actions';
import { Observable } from 'rxjs';
import {
isAuthenticated,
isAuthenticationLoading
} from '../../../../core/auth/selectors';
import { AuthService } from '../../../../core/auth/auth.service';
import { Router } from '@angular/router';
import { isAuthenticated, isAuthenticationLoading } from '../../../../core/auth/selectors';
@Component({
selector: 'ds-log-in-shibboleth',
@@ -36,6 +27,12 @@ export class LogInShibbolethComponent implements OnInit {
*/
public loading: Observable<boolean>;
/**
* The shibboleth authentication location url.
* @type {string}
*/
public location: string;
/**
* Whether user is authenticated.
* @type {Observable<string>}
@@ -45,11 +42,10 @@ export class LogInShibbolethComponent implements OnInit {
/**
* @constructor
*/
constructor(@Inject('authMethodModelProvider') public injectedAuthMethodModel: AuthMethodModel,
private formBuilder: FormBuilder,
private store: Store<CoreState>,
private authService: AuthService,
private router: Router) {
constructor(
@Inject('authMethodModelProvider') public injectedAuthMethodModel: AuthMethodModel,
private store: Store<CoreState>
) {
this.authMethodModel = injectedAuthMethodModel;
}
@@ -59,14 +55,9 @@ export class LogInShibbolethComponent implements OnInit {
// set loading
this.loading = this.store.pipe(select(isAuthenticationLoading));
}
submit() {
const redirectUrl: string = this.router.url;
this.authService.setRedirectUrl(redirectUrl);
this.store.dispatch(new StartShibbolethAuthenticationAction(this.authMethodModel));
// https://host/Shibboleth.sso/Login?target=https://host/shibboleth
window.location.href = this.injectedAuthMethodModel.location;
// set location
this.location = this.injectedAuthMethodModel.location
}
}