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 |
|
|
* Release: @release@
|
9 |
|
|
*
|
10 |
|
|
* '$Author$'
|
11 |
|
|
* '$Date$'
|
12 |
|
|
* '$Revision$'
|
13 |
669
|
jones
|
*
|
14 |
|
|
* This program is free software; you can redistribute it and/or modify
|
15 |
|
|
* it under the terms of the GNU General Public License as published by
|
16 |
|
|
* the Free Software Foundation; either version 2 of the License, or
|
17 |
|
|
* (at your option) any later version.
|
18 |
|
|
*
|
19 |
|
|
* This program is distributed in the hope that it will be useful,
|
20 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
|
|
* GNU General Public License for more details.
|
23 |
|
|
*
|
24 |
|
|
* You should have received a copy of the GNU General Public License
|
25 |
|
|
* along with this program; if not, write to the Free Software
|
26 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
27 |
503
|
bojilova
|
*/
|
28 |
|
|
|
29 |
|
|
package edu.ucsb.nceas.metacat;
|
30 |
|
|
|
31 |
|
|
import java.net.ConnectException;
|
32 |
|
|
import java.util.HashMap;
|
33 |
|
|
|
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 |
|
|
|
42 |
|
|
/**
|
43 |
|
|
* Determine if a user/password are valid according to the authentication
|
44 |
|
|
* service.
|
45 |
|
|
*
|
46 |
|
|
* @param user the name of the principal to authenticate
|
47 |
|
|
* @param password the password to use for authentication
|
48 |
|
|
* @returns boolean true if authentication successful, false otherwise
|
49 |
|
|
*/
|
50 |
|
|
public boolean authenticate(String user, String password)
|
51 |
509
|
bojilova
|
throws ConnectException;
|
52 |
503
|
bojilova
|
|
53 |
|
|
/**
|
54 |
|
|
* Get all users from the authentication service
|
55 |
|
|
*/
|
56 |
2058
|
sgarg
|
public String[][] getUsers(String user, String password)
|
57 |
509
|
bojilova
|
throws ConnectException;
|
58 |
503
|
bojilova
|
|
59 |
|
|
/**
|
60 |
|
|
* Get the users for a particular group from the authentication service
|
61 |
|
|
*/
|
62 |
509
|
bojilova
|
public String[] getUsers(String user, String password, String group)
|
63 |
|
|
throws ConnectException;
|
64 |
503
|
bojilova
|
|
65 |
|
|
/**
|
66 |
|
|
* Get all groups from the authentication service
|
67 |
|
|
*/
|
68 |
2058
|
sgarg
|
public String[][] getGroups(String user, String password)
|
69 |
509
|
bojilova
|
throws ConnectException;
|
70 |
503
|
bojilova
|
|
71 |
|
|
/**
|
72 |
|
|
* Get the groups for a particular user from the authentication service
|
73 |
|
|
*/
|
74 |
2058
|
sgarg
|
public String[][] getGroups(String user, String password, String foruser)
|
75 |
509
|
bojilova
|
throws ConnectException;
|
76 |
503
|
bojilova
|
|
77 |
|
|
/**
|
78 |
|
|
* Get attributes describing a user or group
|
79 |
|
|
*
|
80 |
|
|
* @param user the user for which the attribute list is requested
|
81 |
|
|
* @returns HashMap a map of attribute name to a Vector of values
|
82 |
|
|
*/
|
83 |
2058
|
sgarg
|
public HashMap getAttributes(String foruser)
|
84 |
503
|
bojilova
|
throws ConnectException;
|
85 |
|
|
|
86 |
|
|
/**
|
87 |
|
|
* Get attributes describing a user or group
|
88 |
|
|
*
|
89 |
|
|
* @param user the user for which the attribute list is requested
|
90 |
|
|
* @param authuser the user for authenticating against the service
|
91 |
|
|
* @param password the password for authenticating against the service
|
92 |
|
|
* @returns HashMap a map of attribute name to a Vector of values
|
93 |
|
|
*/
|
94 |
2058
|
sgarg
|
public HashMap getAttributes(String user, String password, String foruser)
|
95 |
503
|
bojilova
|
throws ConnectException;
|
96 |
730
|
bojilova
|
|
97 |
|
|
/**
|
98 |
|
|
* Get all groups and users from authentication service.
|
99 |
|
|
* The output is formatted in XML.
|
100 |
|
|
* @param user the user which requests the information
|
101 |
|
|
* @param password the user's password
|
102 |
|
|
*/
|
103 |
|
|
public String getPrincipals(String user, String password)
|
104 |
|
|
throws ConnectException;
|
105 |
503
|
bojilova
|
}
|