final List<AuthenticationMechanism> mechanisms = new ArrayList<AuthenticationMechanism>();
if (config.basic) {
mechanisms.add(new BasicAuthenticationMechanism(config.realmName));
}
if (config.kerberos) {
mechanisms.add(new GSSAPIAuthenticationMechanism(config.subjectFactory));
}
if (config.form) {
mechanisms.add(new FormAuthenticationMechanism("FORM", config.loginPage, config.errorPage));
}
handler = new AuthenticationMechanismsHandler(handler, mechanisms);