01: /*
02: * (C) Copyright 2000 - 2003 Nabh Information Systems, Inc.
03: *
04: * This program is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU General Public License
06: * as published by the Free Software Foundation; either version 2
07: * of the License, or (at your option) any later version.
08: *
09: * This program is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU General Public License for more details.
13: *
14: * You should have received a copy of the GNU General Public License
15: * along with this program; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17: *
18: */
19:
20: package com.nabhinc.portal.spi.impl.jaas;
21:
22: import java.io.IOException;
23: import java.util.Map;
24:
25: import javax.security.auth.callback.Callback;
26: import javax.security.auth.callback.CallbackHandler;
27: import javax.security.auth.callback.UnsupportedCallbackException;
28:
29: /**
30: *
31: *
32: * @author Wirawan Chokry
33: * (c) 2003 Nabh Information Systems, Inc. All Rights Reserved.
34: */
35: public class LoginCallbackHandler implements CallbackHandler {
36:
37: private StringbeansCallbackHandler lchCallbackHandler = null;
38:
39: public LoginCallbackHandler(String userName, String password,
40: Map paramMap) {
41: this (null, userName, password, paramMap);
42: }
43:
44: public LoginCallbackHandler(StringbeansCallbackHandler handler,
45: String userName, String password, Map paramMap) {
46:
47: if (handler == null) {
48: lchCallbackHandler = new StringbeansCallbackHandlerImpl();
49: } else {
50: lchCallbackHandler = handler;
51: }
52: lchCallbackHandler.setUserName(userName);
53: lchCallbackHandler.setPassword(password);
54: lchCallbackHandler.setParameterMap(paramMap);
55: }
56:
57: /* (non-Javadoc)
58: * @see javax.security.auth.callback.CallbackHandler#handle(javax.security.auth.callback.Callback[])
59: */
60: public void handle(Callback[] callbacks) throws IOException,
61: UnsupportedCallbackException {
62: lchCallbackHandler.handle(callbacks);
63: }
64:
65: }
|