Project

General

Profile

« Previous | Next » 

Revision 3157

This is just a code cleanup patch that re-aligns some indentations and removes
some debugging code.

View differences:

src/edu/ucsb/nceas/metacat/AuthLdap.java
112 112
   * @returns boolean true if authentication successful, false otherwise
113 113
   */
114 114
  
115
  public boolean authenticate(String user, String password) throws
116
      ConnectException {
115
  public boolean authenticate(String user, String password) throws 
116
    ConnectException {
117 117
    String ldapUrl = this.ldapUrl;
118 118
    String ldapsUrl = this.ldapsUrl;
119 119
    String ldapBase = this.ldapBase;
......
152 152
        	String refUrl = "";
153 153
        	String refBase = "";
154 154
        	if (identifier.startsWith("ldap")) {
155
        		logMetacat.debug("identifier starts with ldap");
155
        		logMetacat.debug("identifier starts with \"ldap\"");
156 156

  
157 157
        		refUrl = identifier.substring(0, identifier.lastIndexOf("/") + 1);
158 158
        		int position = identifier.indexOf(",");
......
161 161
        		refBase = identifier.substring(position2 + 1);
162 162
        		identifier = identifier.substring(identifier.lastIndexOf("/") + 1);
163 163
        		
164
        		logMetacat.info("Calling ldapAuthenticate");
164
        		logMetacat.info("Calling ldapAuthenticate:");
165 165
        		logMetacat.info("with user as identifier: " + identifier);
166 166
        		logMetacat.info("and refUrl as: " + refUrl);
167 167
        		logMetacat.info("and refBase as: " + refBase);
......
180 180
            		(new Boolean(MetaCatUtil.getOption("onlySecureLDAPConnection"))).booleanValue());
181 181
        	}
182 182
        }
183
    }
184
    catch (NullPointerException e) {
183
    } catch (NullPointerException e) {
185 184
    	logMetacat.error("NullPointerException while authenticating in " +
186 185
                        "AuthLdap.authenticate: " + e);
187 186
    	e.printStackTrace();
......
207 206
   * @param identifier the distinguished name to check against LDAP
208 207
   * @param password the password for authentication
209 208
   */
210
  private boolean ldapAuthenticate(String identifier, String password, 
211
		  boolean secureConnectionOnly) throws ConnectException, NamingException, 
212
		  NullPointerException {
209
  private boolean ldapAuthenticate(String identifier, String password, boolean 
210
    secureConnectionOnly) throws ConnectException, NamingException, 
211
    NullPointerException {
213 212
    return ldapAuthenticate(identifier, password,
214 213
                            this.ldapsUrl, this.ldapBase, secureConnectionOnly);
215 214
  }
......
222 221
   * @param password the password for authentication
223 222
   */
224 223
  
225
  private boolean ldapAuthenticate(String dn, String password, String rootServer, 
226
		  String rootBase, boolean secureConnectionOnly){
224
  private boolean ldapAuthenticate(String dn, String password, 
225
    String rootServer, String rootBase, boolean secureConnectionOnly){
227 226
	  
228 227
	  boolean authenticated = false;
229 228
		
......
328 327
   * @returns String the identifying name for the user,
329 328
   *          or null if not found
330 329
   */
331
  private String getIdentifyingName(String user, String ldapUrl,
332
          String ldapBase) throws NamingException {
330
  private String getIdentifyingName(String user, String ldapUrl, 
331
    String ldapBase) throws NamingException {
333 332
	  
334 333
      String identifier = null;
335 334
      Hashtable env = new Hashtable();
......
388 387
   * @param password the password for authenticating against the service
389 388
   * @returns string array of all of the user names
390 389
   */
391
  public String[][] getUsers(String user, String password) throws
392
      ConnectException {
390
  public String[][] getUsers(String user, String password) throws 
391
    ConnectException {
393 392
    String[][] users = null;
394 393

  
395 394
    // Identify service provider to use
......
495 494
   * @param password the password for authenticating against the service
496 495
   * @returns string array of all of the user names
497 496
   */
498
  public String[] getUserInfo(String user, String password) throws
499
      ConnectException {
497
  public String[] getUserInfo(String user, String password) throws 
498
    ConnectException {
500 499
    String[] userinfo = new String[3];
501 500

  
502 501
    // Identify service provider to use
......
591 590
   * @param group the group whose user list should be returned
592 591
   * @returns string array of the user names belonging to the group
593 592
   */
594
  public String[] getUsers(String user, String password, String group) throws
595
      ConnectException {
593
  public String[] getUsers(String user, String password, String group) throws 
594
    ConnectException {
596 595
    String[] users = null;
597 596

  
598 597
    // Identify service provider to use
......
657 656
   * @param password the password for authenticating against the service
658 657
   * @returns string array of the group names
659 658
   */
660
  public String[][] getGroups(String user, String password) throws
661
      ConnectException {
659
  public String[][] getGroups(String user, String password) throws 
660
    ConnectException {
662 661
    return getGroups(user, password, null);
663 662
  }
664 663

  
......
735 734
            SearchResult sr = (SearchResult) namingEnum.next();
736 735
            
737 736
            tempAttr = sr.getAttributes();
738
            logMetacat.debug("Search result attributes are:" +
739
              "\n\t~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +
740
              "\n\tcn:          " + tempAttr.get("cn") +
741
              "\n\to:           " + tempAttr.get("o") +
742
              "\n\tdescription: " + tempAttr.get("description") +
743
              "\n\t~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
744 737

  
745 738
            if ( (tempAttr.get("description") + "").startsWith("description: ")) {
746 739
              desc.add( (tempAttr.get("description") + "").substring(13));

Also available in: Unified diff