Project

General

Profile

1
/**
2
 *  '$RCSfile$'
3
 *    Purpose: An interface representing the methods that should be
4
 *             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: jones $'
10
 *     '$Date: 2006-11-10 10:25:38 -0800 (Fri, 10 Nov 2006) $'
11
 * '$Revision: 3077 $'
12
 *
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
 */
27

    
28
package edu.ucsb.nceas.metacat;
29

    
30
import java.net.ConnectException;
31
import java.util.HashMap;
32

    
33
/**
34
 * An interface representing the methods that should be
35
 * implemented by an authentication service.  The authentication service is
36
 * used to determine if a user is authenticated, and whether they are a member
37
 * of a particular group.
38
 */
39
public interface AuthInterface {
40

    
41
  /**
42
   * Determine if a user/password are valid according to the authentication
43
   * service.
44
   *
45
   * @param user the name of the principal to authenticate
46
   * @param password the password to use for authentication
47
   * @returns boolean true if authentication successful, false otherwise
48
   */
49
  public boolean authenticate(String user, String password)
50
         throws ConnectException;
51

    
52
  /**
53
   * Get all users from the authentication service
54
   */
55
  public String[][] getUsers(String user, String password)
56
         throws ConnectException;
57

    
58
  /**
59
   * Get information for a user - name, organization and email address. 
60
   */
61
  public String[] getUserInfo(String user, String password)
62
         throws ConnectException;
63

    
64
  /**
65
   * Get the users for a particular group from the authentication service
66
   */
67
  public String[] getUsers(String user, String password, String group)
68
         throws ConnectException;
69

    
70
  /**
71
   * Get all groups from the authentication service
72
   */
73
  public String[][] getGroups(String user, String password)
74
         throws ConnectException;
75

    
76
  /**
77
   * Get the groups for a particular user from the authentication service
78
   */
79
  public String[][] getGroups(String user, String password, String foruser)
80
         throws ConnectException;
81

    
82
  /**
83
   * Get attributes describing a user or group
84
   *
85
   * @param user the user for which the attribute list is requested
86
   * @returns HashMap a map of attribute name to a Vector of values
87
   */
88
  public HashMap getAttributes(String foruser)
89
         throws ConnectException;
90

    
91
  /**
92
   * Get attributes describing a user or group
93
   *
94
   * @param user the user for which the attribute list is requested
95
   * @param authuser the user for authenticating against the service
96
   * @param password the password for authenticating against the service
97
   * @returns HashMap a map of attribute name to a Vector of values
98
   */
99
  public HashMap getAttributes(String user, String password, String foruser)
100
         throws ConnectException;
101

    
102
  /**
103
   * Get all groups and users from authentication service.
104
   * The output is formatted in XML.
105
   * @param user the user which requests the information
106
   * @param password the user's password
107
   */
108
  public String getPrincipals(String user, String password)
109
                throws ConnectException;
110
}
(10-10/66)