01: /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
02: *
03: * Licensed under the Apache License, Version 2.0 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at
06: *
07: * http://www.apache.org/licenses/LICENSE-2.0
08: *
09: * 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: * The JaasAuthenticationCallbackHandler is similar to the
27: * javax.security.auth.callback.CallbackHandler interface in that it defines a
28: * handle method. The JaasAuthenticationCallbackHandler is only asked to
29: * handle one Callback instance at at time rather than an array of all
30: * Callbacks, as the javax... CallbackHandler defines.
31: *
32: * <p>
33: * Before a JaasAuthenticationCallbackHandler is asked to 'handle' any
34: * callbacks, it is first passed the Authentication object that the login
35: * attempt is for. NOTE: The Authentication object has not been
36: * 'authenticated' yet.
37: * </p>
38: *
39: * @author Ray Krueger
40: * @version $Id: JaasAuthenticationCallbackHandler.java 1784 2007-02-24 21:00:24Z luke_t $
41: *
42: * @see JaasNameCallbackHandler
43: * @see JaasPasswordCallbackHandler
44: * @see <a
45: * href="http://java.sun.com/j2se/1.4.2/docs/api/javax/security/auth/callback/Callback.html">Callback</a>
46: * @see <a href="http://java.sun.com/j2se/1.4.2/docs/api/javax/security/auth/callback/CallbackHandler.html">
47: * CallbackHandler</a>
48: */
49: public interface JaasAuthenticationCallbackHandler {
50: //~ Methods ========================================================================================================
51:
52: /**
53: * Handle the <a
54: * href="http://java.sun.com/j2se/1.4.2/docs/api/javax/security/auth/callback/Callback.html">Callback</a>. The
55: * handle method will be called for every callback instance sent from the LoginContext. Meaning that The handle
56: * method may be called multiple times for a given JaasAuthenticationCallbackHandler.
57: *
58: * @param callback
59: * @param auth The Authentication object currently being authenticated.
60: *
61: * @throws IOException
62: * @throws UnsupportedCallbackException
63: */
64: void handle(Callback callback, Authentication auth)
65: throws IOException, UnsupportedCallbackException;
66: }
|