2 * Copyright [2007] [University Corporation for Advanced Internet Development, Inc.]
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package edu.internet2.middleware.shibboleth.idp.config.profile.authn;
19 import java.util.List;
21 import org.springframework.beans.factory.config.AbstractFactoryBean;
23 import edu.internet2.middleware.shibboleth.idp.authn.provider.AbstractLoginHandler;
26 * Base class for authentication handler factory beans.
28 public abstract class AbstractLoginHandlerFactoryBean extends AbstractFactoryBean {
30 /** Authentication methods supported by the handler. */
31 private List<String> authenticationMethods;
33 /** Duration of the authentication, in minutes. */
34 private int authenticationDuration;
37 * Gets the duration of the authentication, in minutes.
39 * @return duration of the authentication, in minutes
41 public int getAuthenticationDuration() {
42 return authenticationDuration;
46 * Sets the duration of the authentication, in minutes.
48 * @param duration duration of the authentication, in minutes
50 public void setAuthenticationDuration(int duration) {
51 this.authenticationDuration = duration;
55 * Gets the authentication methods supported by the handler.
57 * @return authentication methods supported by the handler
59 public List<String> getAuthenticationMethods() {
60 return authenticationMethods;
64 * Sets the authentication methods supported by the handler.
66 * @param methods authentication methods supported by the handler
68 public void setAuthenticationMethods(List<String> methods) {
69 this.authenticationMethods = methods;
73 * Populates the authentication duration and methods of the handler.
75 * @param handler the authentication handler to populate
77 protected void populateHandler(AbstractLoginHandler handler) {
78 if (authenticationMethods != null) {
79 handler.getSupportedAuthenticationMethods().addAll(authenticationMethods);
81 handler.setAuthenticationDuration(authenticationDuration * 60 * 1000);