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

@@ -1,30 +1,32 @@
import {AuthMethodType} from '../../../shared/log-in/authMethods-type';
export class AuthMethodModel {
authMethodName: string;
location?: string;
authMethodConstant: AuthMethodType
authMethodType: AuthMethodType
constructor(authMethodName: string, location?: string) {
this.authMethodName = authMethodName;
this.location = location;
switch (authMethodName) {
case 'ip': {
this.authMethodConstant = AuthMethodType.Ip;
this.authMethodType = AuthMethodType.Ip;
break;
}
case 'ldap': {
this.authMethodConstant = AuthMethodType.Ldap;
this.authMethodType = AuthMethodType.Ldap;
break;
}
case 'shibboleth': {
this.authMethodConstant = AuthMethodType.Shibboleth;
this.authMethodType = AuthMethodType.Shibboleth;
break;
}
case 'x509': {
this.authMethodConstant = AuthMethodType.X509;
this.authMethodType = AuthMethodType.X509;
break;
}
case 'password': {
this.authMethodConstant = AuthMethodType.Password;
this.authMethodType = AuthMethodType.Password;
break;
}
@@ -34,11 +36,3 @@ export class AuthMethodModel {
}
}
}
export enum AuthMethodType {
Password = 'password',
Shibboleth = 'shibboleth',
Ldap = 'ldap',
Ip = 'ip',
X509 = 'x509'
}