mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
One can now customize the default authentication method for all sub-domains, i.e., either 'two_factor' or 'basic_auth' and define specific authentication method per sub-domain. For example, one can specify that every sub-domain must be authenticated with two factor except one sub-domain that must be authenticated with basic auth.
15 lines
546 B
TypeScript
15 lines
546 B
TypeScript
import { AuthenticationMethod, AuthenticationMethodsConfiguration } from "./configuration/Configuration";
|
|
|
|
export class AuthenticationMethodCalculator {
|
|
private configuration: AuthenticationMethodsConfiguration;
|
|
|
|
constructor(config: AuthenticationMethodsConfiguration) {
|
|
this.configuration = config;
|
|
}
|
|
|
|
compute(subDomain: string): AuthenticationMethod {
|
|
if (subDomain in this.configuration.per_subdomain_methods)
|
|
return this.configuration.per_subdomain_methods[subDomain];
|
|
return this.configuration.default_method;
|
|
}
|
|
} |