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

@@ -0,0 +1,16 @@
import { AuthMethodType } from './authMethods-type';
const authMethodsMap = new Map();
export function renderAuthMethodFor(authMethodType: AuthMethodType) {
return function decorator(objectElement: any) {
if (!objectElement) {
return;
}
authMethodsMap.set(authMethodType, objectElement);
};
}
export function rendersAuthMethodType(authMethodType: AuthMethodType) {
return authMethodsMap.get(authMethodType);
}

View File

@@ -0,0 +1,7 @@
export enum AuthMethodType {
Password = 'password',
Shibboleth = 'shibboleth',
Ldap = 'ldap',
Ip = 'ip',
X509 = 'x509'
}

View File

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

View File

@@ -3,9 +3,17 @@
<button class="btn btn-lg btn-primary btn-block mt-3" type="submit"
[disabled]="!shibbForm.valid"
>{{"login.shibbForm.submit" | translate}}</button>
</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 { renderAuthMethodFor } from '../../authMethods-decorator';
import { AuthMethodType } from '../../authMethods-type';
import { renderAuthMethodFor } from '../authMethods-decorator';
import { AuthMethodType } from '../authMethods-type';
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 { CoreState } from '../../../../core/core.reducers';
import { StartShibbolethAuthenticationAction } from '../../../../core/auth/auth.actions';
@@ -42,6 +42,8 @@ export class DynamicShibbolethComponent implements OnInit {
private host: string;
// public shibbButton: FormControl;
/**
* @constructor
*/
@@ -63,6 +65,8 @@ export class DynamicShibbolethComponent implements OnInit {
shibbButton: [''],
});
// this.shibbButton = new FormControl('');
// set isAuthenticated
this.isAuthenticated = this.store.pipe(select(isAuthenticated));