GUACAMOLE-540: Update comments; remove unnecessary setter methods.

This commit is contained in:
Nick Couchman
2018-05-15 13:50:28 -04:00
parent cbd77b52ae
commit c725da00a0

View File

@@ -142,6 +142,9 @@ public class Credentials implements Serializable {
/** /**
* Sets the HttpServletRequest associated with this set of credentials. * Sets the HttpServletRequest associated with this set of credentials.
* Also sets the remoteAddress and remoteHostname objects, checking the
* request for X-Forwarded-For or falling back to provided remote address.
*
* @param request The HttpServletRequest to associated with this set of * @param request The HttpServletRequest to associated with this set of
* credentials. * credentials.
*/ */
@@ -153,14 +156,14 @@ public class Credentials implements Serializable {
if (header != null) { if (header != null) {
Matcher matcher = X_FORWARDED_FOR.matcher(header); Matcher matcher = X_FORWARDED_FOR.matcher(header);
if (matcher.matches()) if (matcher.matches())
setRemoteAddress(matcher.group(1)); this.remoteAddress = matcher.group(1);
} }
// Header not present, just use remote address // Header not present, just use remote address
else { else {
setRemoteAddress(request.getRemoteAddr()); this.remoteAddress = request.getRemoteAddr();
} }
setRemoteHostname(request.getRemoteHost()); this.remoteHostname = request.getRemoteHost();
} }
@@ -194,18 +197,6 @@ public class Credentials implements Serializable {
return remoteAddress; return remoteAddress;
} }
/**
* Sets the address of the client end of the connection which provided
* these credentials.
*
* @param remoteAddress
* The address of the client end of the connection which provided these
* credentials, or null if the address is not known.
*/
public void setRemoteAddress(String remoteAddress) {
this.remoteAddress = remoteAddress;
}
/** /**
* Returns the hostname of the client end of the connection which provided * Returns the hostname of the client end of the connection which provided
* these credentials, if known. If the hostname of the client cannot be * these credentials, if known. If the hostname of the client cannot be
@@ -220,18 +211,4 @@ public class Credentials implements Serializable {
return remoteHostname; return remoteHostname;
} }
/**
* Sets the hostname of the client end of the connection which provided
* these credentials, if known. If the hostname of the client cannot be
* determined, but the address is known, the address may be specified
* instead.
*
* @param remoteHostname
* The hostname or address of the client end of the connection which
* provided these credentials, or null if the hostname is not known.
*/
public void setRemoteHostname(String remoteHostname) {
this.remoteHostname = remoteHostname;
}
} }