01: /*
02: * BEGIN_HEADER - DO NOT EDIT
03: *
04: * The contents of this file are subject to the terms
05: * of the Common Development and Distribution License
06: * (the "License"). You may not use this file except
07: * in compliance with the License.
08: *
09: * You can obtain a copy of the license at
10: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
11: * See the License for the specific language governing
12: * permissions and limitations under the License.
13: *
14: * When distributing Covered Code, include this CDDL
15: * HEADER in each file and include the License file at
16: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
17: * If applicable add the following below this CDDL HEADER,
18: * with the fields enclosed by brackets "[]" replaced with
19: * your own identifying information: Portions Copyright
20: * [year] [name of copyright owner]
21: */
22:
23: /*
24: * @(#)AppSrvAuthenticator.java
25: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
26: *
27: * END_HEADER - DO NOT EDIT
28: */
29: /**
30: * Authenticator.java
31: *
32: * SUN PROPRIETARY/CONFIDENTIAL.
33: * This software is the proprietary information of Sun Microsystems, Inc.
34: * Use is subject to license terms.
35: *
36: * Created on January 25, 2005, 10:29 PM
37: */package com.sun.jbi.internal.security.auth;
38:
39: import com.sun.jbi.internal.security.UserDomain;
40:
41: import javax.security.auth.callback.Callback;
42: import javax.security.auth.callback.CallbackHandler;
43: import javax.security.auth.callback.UnsupportedCallbackException;
44:
45: /**
46: * This class enforces user authentication.
47: *
48: * @author Sun Microsystems, Inc.
49: */
50: public class AppSrvAuthenticator implements Authenticator {
51: /** The User Domain. */
52: private UserDomain mDomain;
53:
54: /** The App Srv Callback Handler. */
55: private CallbackHandler mAppSrvCBHandler;
56:
57: /**
58: * Initialize the authenticator with the UserDomain.
59: *
60: * @param domain is the UserDomain which has the Authentication Context.
61: * @throws IllegalStateException if initialization fails.
62: */
63: public void initialize(UserDomain domain)
64: throws IllegalStateException {
65: mDomain = domain;
66:
67: try {
68: mAppSrvCBHandler = com.sun.jbi.internal.security.AppSrvEnvironment
69: .getCallbackHandler();
70: } catch (Exception ex) {
71: throw new IllegalStateException(ex.toString());
72: }
73: }
74:
75: /**
76: * The implementation on the CallbackHandlerInterface. This class only supports
77: * PasswordValidationCallback
78: *
79: *
80: * @param callbacks - array of Callbacks to be handled.
81: * @throws java.io.IOException - if an input or output error occurs.
82: * @throws UnsupportedCallbackException - if the implementation of this method
83: * does not support one or more of the Callbacks specified in the callbacks
84: * parameter.
85: */
86: public void handle(Callback[] callbacks)
87: throws java.io.IOException, UnsupportedCallbackException {
88: mAppSrvCBHandler.handle(callbacks);
89: }
90: }
|