View Javadoc

1   /*
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
8    *
9    *    http://www.apache.org/licenses/LICENSE-2.0
10   *
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.
16   */
17  
18  package edu.internet2.middleware.shibboleth.idp.authn.provider;
19  
20  import java.util.List;
21  
22  import org.opensaml.xml.util.LazyList;
23  
24  import edu.internet2.middleware.shibboleth.idp.authn.LoginHandler;
25  
26  /**
27   * Base class for authentication handlers.
28   */
29  public abstract class AbstractLoginHandler implements LoginHandler {
30      
31      /** Authentication methods this handler supports. */
32      private List<String> supportedAuthenticationMethods;
33  
34      /** Length of time, in milliseconds, after which a user should be re-authenticated. */
35      private long authenticationDuration;
36  
37      /** Whether this handler supports foreced re-authentication. */
38      private boolean supportsForceAuthentication;
39  
40      /** Whether this handler supports passive authentication. */
41      private boolean supportsPassive;
42      
43      /** Constructor. */
44      protected AbstractLoginHandler(){
45          supportedAuthenticationMethods = new LazyList<String>();
46          supportsForceAuthentication = false;
47          supportsPassive = false;
48      }
49      
50      /** {@inheritDoc} */
51      public List<String> getSupportedAuthenticationMethods() {
52          return supportedAuthenticationMethods;
53      }
54  
55      /** {@inheritDoc} */
56      public long getAuthenticationDuration() {
57          return authenticationDuration;
58      }
59      
60      /**
61       * Sets the length of time, in milliseconds, after which a user should be re-authenticated.
62       * 
63       * @param duration length of time, in milliseconds, after which a user should be re-authenticated 
64       */
65      public void setAuthenticationDuration(long duration) {
66          authenticationDuration = duration;
67      }
68  
69      /**
70       * Sets the length of time, in milliseconds, after which a user should be re-authenticated.
71       * 
72       * @param duration length of time, in milliseconds, after which a user should be re-authenticated
73       * 
74       * @deprecated use {@link #setAuthenticationDuration(long)}
75       */
76      public void setAuthenticationDurection(long duration) {
77          authenticationDuration = duration;
78      }
79  
80      /** {@inheritDoc} */
81      public boolean supportsForceAuthentication() {
82          return supportsForceAuthentication;
83      }
84  
85      /**
86       * Sets whether this handler supports forced re-authentication.
87       * 
88       * @param supported whether this handler supports forced re-authentication
89       */
90      public void setSupportsForceAuthentication(boolean supported) {
91          supportsForceAuthentication = supported;
92      }
93  
94      /** {@inheritDoc} */
95      public boolean supportsPassive() {
96          return supportsPassive;
97      }
98  
99      /**
100      * Sets whether this handler supports passive authentication.
101      * 
102      * @param supported whether this handler supports passive authentication.
103      */
104     public void setSupportsPassive(boolean supported) {
105         supportsPassive = supported;
106     }
107 }