Source code: gov/lanl/Authenticator/AuthenticatorImpl.java
1 //file AuthenticatorImpl.java
2
3 /**
4 * ***********************************
5 * Copyright Notice
6 * Copyright (c) 2001 Regents of the University of California. All rights reserved.
7 *
8 * DISCLAIMER
9 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
10 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
12 * SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
13 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
14 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
15 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
16 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
17 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
18 * DAMAGE.
19 * ************************************
20 */
21
22 package gov.lanl.Authenticator;
23
24
25 /**This implementation provides transient support for checking the authentication
26 * for a single user or a list of users. It can either make the decision
27 * or defer to a service, such as "SecureID" service; it may also keep
28 * a time dependent transient list to support one time sign on via
29 * secure cards or time restricted passwords. It expects to see
30 * data as GSSUP's InitialContextToken which is:
31 * struct InitialContextToken {
32 * CSI::UTF8String username;
33 * CSI::UTF8String password;
34 * CSI::GSS_NT_ExportedName target_name;
35 *
36 * typedef sequence <octet> GSS_NT_ExportedName;
37 *
38 * @author James George
39 * @version $Revision: 1.1 $ $Date: 2002/06/23 00:18:45 $
40 **/
41
42 public class AuthenticatorImpl extends gov.lanl.Authenticate.AuthenticatorPOA {
43 private static org.apache.log4j.Logger cat =
44 org.apache.log4j.Logger.getLogger(AuthenticatorImpl.class.getName());
45
46 /**The local userlist of current users*/
47 private UserListInterface userList;
48
49 public AuthenticatorImpl() {
50 System.out.println("AuthenticatorImpl instantiated!");
51 }
52
53 /**Check to see if a user is or can be authenticated; authenticate the user
54 * if possible.
55 * @param userToken is the user information to use for authentication,
56 * and consists of name, password and target_name.
57 * @return true if the user is authenticated.
58 **/
59
60 public boolean isUserOk(org.omg.GSSUP.InitialContextToken userToken) {
61 cat.debug("isUserOk called with " +
62 new String(userToken.username) + "," +
63 new String(userToken.password) + "," +
64 new String(userToken.target_name)
65 );
66 return userList.isUserOk(
67 new String(userToken.username),
68 new String(userToken.password),
69 new String(userToken.target_name));
70 }
71
72 /**Check to see if a user is or can be authenticated; authenticate the user
73 * if possible.
74 * User information to use for authentication is assumed to be in the
75 * security credentials of the connection.
76 * @return true if the user is authenticated.
77 **/
78 public boolean isUserOkFromCredentials() {
79 cat.error("not implemented");
80 return false;
81 }
82
83 /**Check to see if the users are or can be authenticated; authenticate each
84 * user as necessary.
85 * @param userTokenSeq is a sequence of user information to use for
86 * authentication, and consists of name, password and target_name for each user.
87 * @return a sequence of booleans for the user list, each element
88 * specifiying if the corresponding element in the userTokenSeq is
89 * authenticated.
90 **/
91
92 public boolean[] areUsersOk(org.omg.GSSUP.InitialContextToken[] userTokenSeq) {
93 cat.debug("areUsersOk not supported called with " + userTokenSeq.length + " users");
94 return new boolean[0];
95 }
96
97 /**Sets the local user list to use.
98 * @param inUserList is a particular user list implementation to use
99 */
100 public void setUserList(UserListInterface inUserList) {
101 userList = inUserList;
102 }
103
104 /**Logoff the user; i.e. forget that the user had been previously authenticated.
105 * @param userToken is the user data uniquely identifying the user to be
106 * logged off.
107 **/
108 public void logoffUser(org.omg.GSSUP.InitialContextToken userToken) {
109 cat.debug("not implemented");
110 }
111
112 /**Logoff the user; i.e. forget that the user had been previously authenticated.
113 * User information to identify the user to log off is assumed to be in the
114 * security credentials of the connection.
115 **/
116 public void logoffUserFromCredentials() {
117 cat.debug("not implemented");
118 }
119
120 }