View Javadoc

    1   /* Copyright 2004 Acegi Technology Pty Limited
    2    *
    3    * Licensed under the Apache License, Version 2.0 (the "License");
    4    * you may not use this file except in compliance with the License.
    5    * You may obtain a copy of the License at
    6    *
    7    *     http://www.apache.org/licenses/LICENSE-2.0
    8    *
    9    * Unless required by applicable law or agreed to in writing, software
    10   * distributed under the License is distributed on an "AS IS" BASIS,
    11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12   * See the License for the specific language governing permissions and
    13   * limitations under the License.
    14   */
    15
    16  package org.acegisecurity.providers.jaas;
    17
    18  import org.acegisecurity.Authentication;
    19
    20  import java.io.IOException;
    21
    22  import javax.security.auth.callback.Callback;
    23  import javax.security.auth.callback.UnsupportedCallbackException;
    24
    25
    26  /***
    27   * The JaasAuthenticationCallbackHandler is similar to the
    28   * javax.security.auth.callback.CallbackHandler interface in that it defines a
    29   * handle method. The JaasAuthenticationCallbackHandler is only asked to
    30   * handle one Callback instance at at time rather than an array of all
    31   * Callbacks, as the javax... CallbackHandler defines.
    32   *
    33   * <p>
    34   * Before a JaasAuthenticationCallbackHandler is asked to 'handle' any
    35   * callbacks, it is first passed the Authentication object that the login
    36   * attempt is for. NOTE: The Authentication object has not been
    37   * 'authenticated' yet.
    38   * </p>
    39   *
    40   * @author Ray Krueger
    41   * @version $Id: JaasAuthenticationCallbackHandler.java,v 1.4 2005/11/17 00:55:52 benalex Exp $
    42   *
    43   * @see JaasNameCallbackHandler
    44   * @see JaasPasswordCallbackHandler
    45   * @see <a
    46   *      href="http://java.sun.com/j2se/1.4.2/docs/api/javax/security/auth/callback/Callback.html">Callback</a>
    47   * @see <a
    48   *      href="http://java.sun.com/j2se/1.4.2/docs/api/javax/security/auth/callback/CallbackHandler.html">CallbackHandler</a>
    49   */
    50  public interface JaasAuthenticationCallbackHandler {
    51      //~ Methods ================================================================
    52
    53      /***
    54       * Handle the <a
    55       * href="http://java.sun.com/j2se/1.4.2/docs/api/javax/security/auth/callback/Callback.html">Callback</a>.
    56       * The handle method will be called for every callback instance sent from
    57       * the LoginContext. Meaning that The handle method may be called multiple
    58       * times for a given JaasAuthenticationCallbackHandler.
    59       *
    60       * @param callback
    61       * @param auth The Authentication object currently being authenticated.
    62       *
    63       * @throws IOException
    64       * @throws UnsupportedCallbackException
    65       */
    66      void handle(Callback callback, Authentication auth)
    67          throws IOException, UnsupportedCallbackException;
    68  }