diff --git a/src/app/+login-page/shibbolethTargetPage/const/shibbConstants.ts b/src/app/+login-page/shibbolethTargetPage/const/shibbConstants.ts deleted file mode 100644 index b424e24fc9..0000000000 --- a/src/app/+login-page/shibbolethTargetPage/const/shibbConstants.ts +++ /dev/null @@ -1,3 +0,0 @@ -export class ShibbConstants { - public static readonly SHIBBOLETH_REDIRECT_ROUTE = 'shibboleth'; -} diff --git a/src/app/+login-page/shibbolethTargetPage/shibboleth-target-page.component.html b/src/app/+login-page/shibbolethTargetPage/shibboleth-target-page.component.html deleted file mode 100644 index 8ad0948136..0000000000 --- a/src/app/+login-page/shibbolethTargetPage/shibboleth-target-page.component.html +++ /dev/null @@ -1,4 +0,0 @@ - - diff --git a/src/app/+login-page/shibbolethTargetPage/shibboleth-target-page.component.scss b/src/app/+login-page/shibbolethTargetPage/shibboleth-target-page.component.scss deleted file mode 100644 index 52c5af628b..0000000000 --- a/src/app/+login-page/shibbolethTargetPage/shibboleth-target-page.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -.login-shibboleth { - -} diff --git a/src/app/+login-page/shibbolethTargetPage/shibboleth-target-page.component.spec.ts b/src/app/+login-page/shibbolethTargetPage/shibboleth-target-page.component.spec.ts deleted file mode 100644 index bfae541aef..0000000000 --- a/src/app/+login-page/shibbolethTargetPage/shibboleth-target-page.component.spec.ts +++ /dev/null @@ -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; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ShibbolethTargetPageComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ShibbolethTargetPageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/+login-page/shibbolethTargetPage/shibboleth-target-page.component.ts b/src/app/+login-page/shibbolethTargetPage/shibboleth-target-page.component.ts deleted file mode 100644 index ef4510644a..0000000000 --- a/src/app/+login-page/shibbolethTargetPage/shibboleth-target-page.component.ts +++ /dev/null @@ -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; - - ngOnInit() { - this.loading = of(true); - this.store.dispatch(new GetJWTafterShibbLoginAction()); - } - - constructor(private store: Store,) { - } - -} diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 5dcb57615e..ec65073d8e 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -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 }, ]) ], diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 4967379b03..8e4e1424aa 100755 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -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 = [ diff --git a/src/app/shared/log-in/methods/shibboleth/log-in-shibboleth.component.html b/src/app/shared/log-in/methods/shibboleth/log-in-shibboleth.component.html index bd62a27f78..489b1ec2ae 100644 --- a/src/app/shared/log-in/methods/shibboleth/log-in-shibboleth.component.html +++ b/src/app/shared/log-in/methods/shibboleth/log-in-shibboleth.component.html @@ -1,7 +1,6 @@ - {{"login.form.shibboleth" | translate}} + + {{"login.form.shibboleth" | translate}} + 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 94f7988953..f1bf928e6f 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,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; + /** + * The shibboleth authentication location url. + * @type {string} + */ + public location: string; + /** * Whether user is authenticated. * @type {Observable} @@ -45,11 +42,10 @@ export class LogInShibbolethComponent implements OnInit { /** * @constructor */ - constructor(@Inject('authMethodModelProvider') public injectedAuthMethodModel: AuthMethodModel, - private formBuilder: FormBuilder, - private store: Store, - private authService: AuthService, - private router: Router) { + constructor( + @Inject('authMethodModelProvider') public injectedAuthMethodModel: AuthMethodModel, + private store: Store + ) { 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 } }