public final String getBasicAuthString() { /* * taking care of the descripancies in the Base64Encoder, for very * large lengths of passwords and/or usernames. * Abhijit did the analysis and as per his suggestion, replacing * a newline in Base64 encoded String by newline followed by a space * should work for any length of password, independent of the * web server buffer length. That investigation is still on, but * in the meanwhile, it was found that the replacement of newline * character with empty string "" works. Hence implementing the same. * Date: 10/10/2003. */ String cs = null, user = this.getUser(), pass = this.getPassword(); String up = (user == null) ? "" : user; String pp = (pass == null) ? "" : pass; cs = up + ":" + pp; String enc = this.getBase64Encoded(cs); enc = enc.replaceAll(System.getProperty("line.separator"), ""); return ( AUTHORIZATION_TYPE + enc ); }
public final String getBasicAuthString() { /* * taking care of the descripancies in the Base64Encoder, for very * large lengths of passwords and/or usernames. * Abhijit did the analysis and as per his suggestion, replacing * a newline in Base64 encoded String by newline followed by a space * should work for any length of password, independent of the * web server buffer length. That investigation is still on, but * in the meanwhile, it was found that the replacement of newline * character with empty string "" works. Hence implementing the same. * Date: 10/10/2003. */ String cs = null, user = this.getUser(), pass = this.getPassword() != null ? new String(this.getPassword()) : null; String up = (user == null) ? "" : user; String pp = (pass == null) ? "" : pass; cs = up + ":" + pp; String enc = this.getBase64Encoded(cs); enc = enc.replaceAll(System.getProperty("line.separator"), ""); return ( AUTHORIZATION_TYPE + enc ); }