View Javadoc

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