Project

General

Profile

Revision 514

Added by Matt Jones over 20 years ago

Fixed problem with AuthInterface, AuthLdap, and AuthMcat where the
sigantures of the methods of these classes were not in agreement, which was
causing AuthLdap to no longer compile. Changed parameter signatures so that
the 'user' parameter is used consistently in all of the methods.

View differences:

src/edu/ucsb/nceas/metacat/AuthLdap.java
105 105
  /**
106 106
   * Get all users from the authentication service
107 107
   */
108
  public String[] getUsers() throws ConnectException
108
  public String[] getUsers(String user, String password) 
109
         throws ConnectException
109 110
  {
110 111
    // NOT IMPLEMENTED YET
111 112
    return null;
......
114 115
  /**
115 116
   * Get the users for a particular group from the authentication service
116 117
   */
117
  public String[] getUsers(String group) throws ConnectException
118
  public String[] getUsers(String user, String password, String group) 
119
         throws ConnectException
118 120
  {
119 121
    // NOT IMPLEMENTED YET
120 122
    return null;
......
123 125
  /**
124 126
   * Get all groups from the authentication service
125 127
   */
126
  public String[] getGroups() throws ConnectException
128
  public String[] getGroups(String user, String password) 
129
         throws ConnectException
127 130
  {
128 131
    // NOT IMPLEMENTED YET
129 132
    return null;
......
132 135
  /**
133 136
   * Get the groups for a particular user from the authentication service
134 137
   */
135
  public String[] getGroups(String user) throws ConnectException
138
  public String[] getGroups(String user, String password, String foruser) 
139
         throws ConnectException
136 140
  {
137 141
    // NOT IMPLEMENTED YET
138 142
    return null;
......
144 148
   * @param user the user for which the attribute list is requested
145 149
   * @returns HashMap a map of attribute name to a Vector of values
146 150
   */
147
  public HashMap getAttributes(String user) 
151
  public HashMap getAttributes(String foruser) 
148 152
         throws ConnectException
149 153
  {
150
    return getAttributes(user, null, null);
154
    return getAttributes(null, null, foruser);
151 155
  }
152 156

  
153 157
  /**
......
158 162
   * @param password the password for authenticating against the service
159 163
   * @returns HashMap a map of attribute name to a Vector of values
160 164
   */
161
  public HashMap getAttributes(String user, String authuser, String password) 
165
  public HashMap getAttributes(String user, String password, String foruser) 
162 166
         throws ConnectException
163 167
  {
164 168
    MetaCatUtil util = new MetaCatUtil();
......
174 178
    env.put(Context.PROVIDER_URL, ldapUrl + ldapBase);
175 179

  
176 180
    // Authentication information
177
    if ((authuser != null) && (password != null)) {
178
      String identifier = getIdentifyingName(authuser);
181
    if ((user != null) && (password != null)) {
182
      String identifier = getIdentifyingName(user);
179 183
      env.put(Context.SECURITY_AUTHENTICATION, "simple");
180 184
      env.put(Context.SECURITY_PRINCIPAL, identifier + "," + ldapBase);
181 185
      env.put(Context.SECURITY_CREDENTIALS, password);
......
184 188
    try {
185 189
  
186 190
      // Find out the identifying attribute for the user
187
      String userident = getIdentifyingName(user);
191
      String userident = getIdentifyingName(foruser);
188 192

  
189 193
      // Create the initial directory context
190 194
      DirContext ctx = new InitialDirContext(env);
......
308 312
      }
309 313

  
310 314
      if (isValid) {
311
        HashMap userInfo = authservice.getAttributes(user, user, password);
315
        HashMap userInfo = authservice.getAttributes(user, password, user);
312 316

  
313 317
        // Print all of the attributes
314 318
        Iterator attList = (Iterator)(((Set)userInfo.keySet()).iterator());
src/edu/ucsb/nceas/metacat/AuthMcat.java
199 199
   * @param user the user for which the attribute list is requested
200 200
   * @returns HashMap a map of attribute name to a Vector of values
201 201
   */
202
  public HashMap getAttributes(String user) 
202
  public HashMap getAttributes(String foruser) 
203 203
         throws ConnectException
204 204
  {
205
    return getAttributes(user, null, null);
205
    return getAttributes(null, null, foruser);
206 206
  }
207 207

  
208 208
  /**
......
213 213
   * @param password the password for authenticating against the service
214 214
   * @returns HashMap a map of attribute name to a Vector of values
215 215
   */
216
  public HashMap getAttributes(String user, String authuser, String password) 
216
  public HashMap getAttributes(String user, String password, String foruser) 
217 217
         throws ConnectException
218 218
  {
219 219
    // NOT IMPLEMENTED YET
src/edu/ucsb/nceas/metacat/AuthInterface.java
66 66
   * @param user the user for which the attribute list is requested
67 67
   * @returns HashMap a map of attribute name to a Vector of values
68 68
   */
69
  public HashMap getAttributes(String user) 
69
  public HashMap getAttributes(String foruser) 
70 70
         throws ConnectException;
71 71

  
72 72
  /**
......
77 77
   * @param password the password for authenticating against the service
78 78
   * @returns HashMap a map of attribute name to a Vector of values
79 79
   */
80
  public HashMap getAttributes(String user, String authuser, String password) 
80
  public HashMap getAttributes(String user, String password, String foruser) 
81 81
         throws ConnectException;
82 82
}

Also available in: Unified diff