Requested changes implemented - basic functionality working

This commit is contained in:
Julius Gruber
2019-09-19 13:43:36 +02:00
parent 62cbba5982
commit 52ef2acb08
14 changed files with 33 additions and 21 deletions

View File

@@ -3,6 +3,7 @@ import { RouterModule } from '@angular/router';
import { PageNotFoundComponent } from './pagenotfound/pagenotfound.component'; import { PageNotFoundComponent } from './pagenotfound/pagenotfound.component';
import { AuthenticatedGuard } from './core/auth/authenticated.guard'; import { AuthenticatedGuard } from './core/auth/authenticated.guard';
import { ShibbolethComponent } from './+login-page/shibbolethTargetPage/shibboleth.component';
const ITEM_MODULE_PATH = 'items'; const ITEM_MODULE_PATH = 'items';
export function getItemModulePath() { export function getItemModulePath() {
@@ -39,6 +40,7 @@ export function getAdminModulePath() {
{ path: 'submit', loadChildren: './+submit-page/submit-page.module#SubmitPageModule' }, { path: 'submit', loadChildren: './+submit-page/submit-page.module#SubmitPageModule' },
{ path: 'workspaceitems', loadChildren: './+workspaceitems-edit-page/workspaceitems-edit-page.module#WorkspaceitemsEditPageModule' }, { path: 'workspaceitems', loadChildren: './+workspaceitems-edit-page/workspaceitems-edit-page.module#WorkspaceitemsEditPageModule' },
{ path: 'workflowitems', loadChildren: './+workflowitems-edit-page/workflowitems-edit-page.module#WorkflowItemsEditPageModule' }, { path: 'workflowitems', loadChildren: './+workflowitems-edit-page/workflowitems-edit-page.module#WorkflowItemsEditPageModule' },
{ path: 'shibboleth', pathMatch: 'full', component: ShibbolethComponent },
{ path: '**', pathMatch: 'full', component: PageNotFoundComponent }, { path: '**', pathMatch: 'full', component: PageNotFoundComponent },
]) ])
], ],

View File

@@ -58,11 +58,10 @@ export class AuthEffects {
}) })
); );
/** /* /!**
* Authenticate user. * Authenticate user.
* @method authenticate * @method authenticate
*/ *!/
/*
@Effect() @Effect()
public shibbolethAuthenticate$: Observable<Action> = this.actions$.pipe( public shibbolethAuthenticate$: Observable<Action> = this.actions$.pipe(
ofType(AuthActionTypes.START_SHIBBOLETH_AUTHENTICATION), ofType(AuthActionTypes.START_SHIBBOLETH_AUTHENTICATION),
@@ -73,8 +72,7 @@ export class AuthEffects {
catchError((error) => observableOf(new AuthenticationErrorAction(error))) catchError((error) => observableOf(new AuthenticationErrorAction(error)))
); );
}) })
); );*/
*/
/** /**
* Shib Login. * Shib Login.

View File

@@ -106,7 +106,7 @@ export class AuthInterceptor implements HttpInterceptor {
return authMethodModels; return authMethodModels;
} }
private makeAuthStatusObject(authenticated: boolean, accessToken?: string, error?: string, httpHeaders?: HttpHeaders,): AuthStatus { private makeAuthStatusObject(authenticated: boolean, accessToken?: string, error?: string, httpHeaders?: HttpHeaders): AuthStatus {
const authStatus = new AuthStatus(); const authStatus = new AuthStatus();
// let authMethods: AuthMethodModel[]; // let authMethods: AuthMethodModel[];
if (httpHeaders) { if (httpHeaders) {

View File

@@ -1,4 +1,4 @@
import {AuthMethodType} from '../../../shared/log-in/authMethods-type'; import {AuthMethodType} from '../../../shared/log-in/methods/authMethods-type';
export class AuthMethodModel { export class AuthMethodModel {
authMethodType: AuthMethodType; authMethodType: AuthMethodType;

View File

@@ -1,5 +1,5 @@
import { Component, ContentChild, Injector, Input, OnInit, ViewChild, ViewChildren } from '@angular/core'; import { Component, ContentChild, Injector, Input, OnInit, ViewChild, ViewChildren } from '@angular/core';
import { rendersAuthMethodType } from '../authMethods-decorator'; import { rendersAuthMethodType } from '../methods/authMethods-decorator';
import { AuthMethodModel } from '../../../core/auth/models/auth-method.model'; import { AuthMethodModel } from '../../../core/auth/models/auth-method.model';
import { select, Store } from '@ngrx/store'; import { select, Store } from '@ngrx/store';
import { CoreState } from '../../../core/core.reducers'; import { CoreState } from '../../../core/core.reducers';

View File

@@ -7,10 +7,10 @@ import { CoreState } from '../../core/core.reducers';
@Component({ @Component({
selector: 'ds-auth-methods', selector: 'ds-auth-methods',
templateUrl: './authMethods.component.html', templateUrl: './log-in.component.html',
styleUrls: ['./authMethods.component.scss'] styleUrls: ['./log-in.component.scss']
}) })
export class AuthMethodsComponent implements OnInit { export class LogInComponent implements OnInit {
/** /**
* The authentication methods data * The authentication methods data
* @type {AuthMethodModel[]} * @type {AuthMethodModel[]}
@@ -33,7 +33,7 @@ export class AuthMethodsComponent implements OnInit {
} }
ngOnInit(): void { ngOnInit(): void {
this.authMethodData = this.authMethodData = this.store.select(getAuthenticationMethods); this.authMethodData = this.store.pipe(select(getAuthenticationMethods));
// set loading // set loading
this.loading = this.store.pipe(select(isAuthenticationLoading)); this.loading = this.store.pipe(select(isAuthenticationLoading));

View File

@@ -20,8 +20,8 @@ import { CoreState } from '../../../../core/core.reducers';
import { isNotEmpty } from '../../../empty.util'; import { isNotEmpty } from '../../../empty.util';
import { fadeOut } from '../../../animations/fade'; import { fadeOut } from '../../../animations/fade';
import { AuthService } from '../../../../core/auth/auth.service'; import { AuthService } from '../../../../core/auth/auth.service';
import { AuthMethodType } from '../../authMethods-type'; import { AuthMethodType } from '../authMethods-type';
import { renderAuthMethodFor } from '../../authMethods-decorator'; import { renderAuthMethodFor } from '../authMethods-decorator';
/** /**
* /users/sign-in * /users/sign-in

View File

@@ -3,9 +3,17 @@
<button class="btn btn-lg btn-primary btn-block mt-3" type="submit" <button class="btn btn-lg btn-primary btn-block mt-3" type="submit"
[disabled]="!shibbForm.valid" [disabled]="!shibbForm.valid"
>{{"login.shibbForm.submit" | translate}}</button> >{{"login.shibbForm.submit" | translate}}</button>
</form> </form>
<!--
<div *ngIf="!(loading | async) && !(isAuthenticated | async)" class="form-login px-4 py-3">
<button class="btn btn-lg btn-primary btn-block mt-3"
type="submit"
[formControl]="shibbButton"
(click)="submit()"
>{{"login.shibbForm.submit" | translate}}</button>
</div>
-->

View File

@@ -1,8 +1,8 @@
import { Component, EventEmitter, Inject, Input, OnInit, Output, QueryList, ViewChildren } from '@angular/core'; import { Component, EventEmitter, Inject, Input, OnInit, Output, QueryList, ViewChildren } 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, FormGroup } from '@angular/forms'; import { FormBuilder, FormControl, FormGroup } 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';
@@ -42,6 +42,8 @@ export class DynamicShibbolethComponent implements OnInit {
private host: string; private host: string;
// public shibbButton: FormControl;
/** /**
* @constructor * @constructor
*/ */
@@ -63,6 +65,8 @@ export class DynamicShibbolethComponent implements OnInit {
shibbButton: [''], shibbButton: [''],
}); });
// this.shibbButton = new FormControl('');
// set isAuthenticated // set isAuthenticated
this.isAuthenticated = this.store.pipe(select(isAuthenticated)); this.isAuthenticated = this.store.pipe(select(isAuthenticated));

View File

@@ -141,7 +141,7 @@ import {DynamicShibbolethComponent} from './log-in/methods/shibboleth/dynamic-sh
// import {LogInComponent} from './log-in/log-in.component'; // import {LogInComponent} from './log-in/log-in.component';
import {LogInPasswordComponent} from './log-in/methods/password/log-in-password.component'; import {LogInPasswordComponent} from './log-in/methods/password/log-in-password.component';
import { LoginContainerComponent } from './log-in/container/login-container.component'; import { LoginContainerComponent } from './log-in/container/login-container.component';
import { AuthMethodsComponent } from './log-in/authMethods.component'; import { LogInComponent } from './log-in/log-in.component';
const MODULES = [ const MODULES = [
// Do NOT include UniversalModule, HttpModule, or JsonpModule here // Do NOT include UniversalModule, HttpModule, or JsonpModule here
@@ -266,7 +266,7 @@ const COMPONENTS = [
DynamicShibbolethComponent, DynamicShibbolethComponent,
LogInPasswordComponent, LogInPasswordComponent,
LoginContainerComponent, LoginContainerComponent,
AuthMethodsComponent LogInComponent
]; ];
const ENTRY_COMPONENTS = [ const ENTRY_COMPONENTS = [