Project

General

Profile

1 503 bojilova
/**
2
 *  '$RCSfile$'
3 2058 sgarg
 *    Purpose: An interface representing the methods that should be
4 503 bojilova
 *             implemented by an authentication service
5
 *  Copyright: 2000 Regents of the University of California and the
6
 *             National Center for Ecological Analysis and Synthesis
7
 *    Authors: Matt Jones
8
 *
9
 *   '$Author$'
10
 *     '$Date$'
11
 * '$Revision$'
12 669 jones
 *
13
 * This program is free software; you can redistribute it and/or modify
14
 * it under the terms of the GNU General Public License as published by
15
 * the Free Software Foundation; either version 2 of the License, or
16
 * (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with this program; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26 503 bojilova
 */
27
28
package edu.ucsb.nceas.metacat;
29
30
import java.net.ConnectException;
31
import java.util.HashMap;
32 4546 daigle
import java.util.Vector;
33 503 bojilova
34
/**
35 2058 sgarg
 * An interface representing the methods that should be
36 503 bojilova
 * implemented by an authentication service.  The authentication service is
37 2058 sgarg
 * used to determine if a user is authenticated, and whether they are a member
38 503 bojilova
 * of a particular group.
39
 */
40
public interface AuthInterface {
41 8474 tao
    public static final short USERDNINDEX = 0;
42
    public static final short USERCNINDEX = 1;
43
    public static final short USERORGINDEX = 2;
44
    public static final short USERORGUNITINDEX = 3;
45
    public static final short USEREMAILINDEX = 4;
46
    public static final short GROUPNAMEINDEX = 0;
47 8476 tao
    public static final short GROUPDESINDEX = 1;
48
    public static final short USERINFOCNINDEX = 0;
49
    public static final short USERINFOORGANIDEX = 1;
50
    public static final short USERINFOEMAILINDEX = 2;
51 503 bojilova
52
  /**
53
   * Determine if a user/password are valid according to the authentication
54
   * service.
55
   *
56
   * @param user the name of the principal to authenticate
57
   * @param password the password to use for authentication
58
   * @returns boolean true if authentication successful, false otherwise
59
   */
60
  public boolean authenticate(String user, String password)
61 509 bojilova
         throws ConnectException;
62 503 bojilova
63
  /**
64
   * Get all users from the authentication service
65
   */
66 2058 sgarg
  public String[][] getUsers(String user, String password)
67 509 bojilova
         throws ConnectException;
68 503 bojilova
69
  /**
70 2679 sgarg
   * Get information for a user - name, organization and email address.
71
   */
72
  public String[] getUserInfo(String user, String password)
73
         throws ConnectException;
74
75
  /**
76 503 bojilova
   * Get the users for a particular group from the authentication service
77
   */
78 509 bojilova
  public String[] getUsers(String user, String password, String group)
79
         throws ConnectException;
80 503 bojilova
81
  /**
82
   * Get all groups from the authentication service
83
   */
84 2058 sgarg
  public String[][] getGroups(String user, String password)
85 509 bojilova
         throws ConnectException;
86 503 bojilova
87
  /**
88
   * Get the groups for a particular user from the authentication service
89
   */
90 2058 sgarg
  public String[][] getGroups(String user, String password, String foruser)
91 509 bojilova
         throws ConnectException;
92 503 bojilova
93
  /**
94
   * Get attributes describing a user or group
95
   *
96
   * @param user the user for which the attribute list is requested
97
   * @returns HashMap a map of attribute name to a Vector of values
98
   */
99 4546 daigle
  public HashMap<String,Vector<String>> getAttributes(String foruser)
100 503 bojilova
         throws ConnectException;
101
102
  /**
103
   * Get attributes describing a user or group
104
   *
105
   * @param user the user for which the attribute list is requested
106
   * @param authuser the user for authenticating against the service
107
   * @param password the password for authenticating against the service
108
   * @returns HashMap a map of attribute name to a Vector of values
109
   */
110 4546 daigle
  public HashMap<String,Vector<String>> getAttributes(String user, String password, String foruser)
111 503 bojilova
         throws ConnectException;
112 730 bojilova
113
  /**
114
   * Get all groups and users from authentication service.
115
   * The output is formatted in XML.
116
   * @param user the user which requests the information
117
   * @param password the user's password
118
   */
119
  public String getPrincipals(String user, String password)
120
                throws ConnectException;
121 503 bojilova
}