2 * Licensed to the University Corporation for Advanced Internet Development,
3 * Inc. (UCAID) under one or more contributor license agreements. See the
4 * NOTICE file distributed with this work for additional information regarding
5 * copyright ownership. The UCAID licenses this file to You under the Apache
6 * License, Version 2.0 (the "License"); you may not use this file except in
7 * compliance with the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 package edu.internet2.middleware.shibboleth.idp.config.profile.authn;
20 import java.util.List;
22 import org.springframework.beans.factory.config.AbstractFactoryBean;
24 import edu.internet2.middleware.shibboleth.idp.authn.provider.AbstractLoginHandler;
27 * Base class for authentication handler factory beans.
29 public abstract class AbstractLoginHandlerFactoryBean extends AbstractFactoryBean {
31 /** Authentication methods supported by the handler. */
32 private List<String> authenticationMethods;
34 /** Duration of the authentication, in minutes. */
35 private long authenticationDuration;
38 * Gets the duration of the authentication, in milliseconds.
40 * @return duration of the authentication, in milliseconds
42 public long getAuthenticationDuration() {
43 return authenticationDuration;
47 * Sets the duration of the authentication, in milliseconds.
49 * @param duration duration of the authentication, in milliseconds
51 public void setAuthenticationDuration(long duration) {
52 this.authenticationDuration = duration;
56 * Gets the authentication methods supported by the handler.
58 * @return authentication methods supported by the handler
60 public List<String> getAuthenticationMethods() {
61 return authenticationMethods;
65 * Sets the authentication methods supported by the handler.
67 * @param methods authentication methods supported by the handler
69 public void setAuthenticationMethods(List<String> methods) {
70 this.authenticationMethods = methods;
74 * Populates the authentication duration and methods of the handler.
76 * @param handler the authentication handler to populate
78 protected void populateHandler(AbstractLoginHandler handler) {
79 if (authenticationMethods != null) {
80 handler.getSupportedAuthenticationMethods().addAll(authenticationMethods);
82 handler.setAuthenticationDuration(authenticationDuration);