Dynamic rendering of auth methods via decorator

This commit is contained in:
Julius Gruber
2019-08-29 17:58:07 +02:00
parent 466d01ce09
commit beb0f2d410
15 changed files with 137 additions and 132 deletions

View File

@@ -20,6 +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';
/**
* /users/sign-in
@@ -31,6 +33,7 @@ import {AuthService} from '../../../../core/auth/auth.service';
styleUrls: ['./log-in-password.component.scss'],
animations: [fadeOut]
})
@renderAuthMethodFor(AuthMethodType.Password)
export class LogInPasswordComponent implements OnDestroy, OnInit {
/**

View File

@@ -1,5 +1,7 @@
import {Component, Inject, Input, OnInit} from '@angular/core';
import { renderAuthMethodFor } from '../../authMethods-decorator';
import { AuthMethodType } from '../../authMethods-type';
import { AuthMethodModel } from '../../../../core/auth/models/auth-method.model';
@Component({
selector: 'ds-dynamic-shibboleth',
@@ -7,11 +9,17 @@ import {Component, Inject, Input, OnInit} from '@angular/core';
styleUrls: ['./dynamic-shibboleth.component.scss'],
})
export class DynamicShibbolethComponent {
@renderAuthMethodFor(AuthMethodType.Shibboleth)
export class DynamicShibbolethComponent implements OnInit {
/**
* @constructor
*/
constructor(@Inject('shibbolethUrlProvider') public injectedShibbolethUrl: string) {
constructor(@Inject('authMethodProvider') public injectedObject: AuthMethodModel) {
}
ngOnInit(): void {
console.log('injectedObject', this.injectedObject)
}
}