1
2
3
4
5
6
7
8
9
10
11
12
13
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
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 }