GUACAMOLE-540: Clean up style and comments in Credentials class

This commit is contained in:
Nick Couchman
2018-06-15 20:18:32 -04:00
parent 52a3f454e6
commit a0d0e07658

View File

@@ -123,19 +123,22 @@ public class Credentials implements Serializable {
if (matcher.matches()) if (matcher.matches())
this.remoteAddress = matcher.group(1); this.remoteAddress = matcher.group(1);
} }
// Header not present, just use remote address
else {
this.remoteAddress = request.getRemoteAddr();
}
// Header not present, just use remote address
else
this.remoteAddress = request.getRemoteAddr();
// Get the remote hostname
this.remoteHostname = request.getRemoteHost(); this.remoteHostname = request.getRemoteHost();
// If session exists get it, but don't create a new one.
this.session = request.getSession(false); this.session = request.getSession(false);
} }
/** /**
* Returns the password associated with this set of credentials. * Returns the password associated with this set of credentials.
*
* @return The password associated with this username/password pair, or * @return The password associated with this username/password pair, or
* null if no password has been set. * null if no password has been set.
*/ */
@@ -145,6 +148,7 @@ public class Credentials implements Serializable {
/** /**
* Sets the password associated with this set of credentials. * Sets the password associated with this set of credentials.
*
* @param password The password to associate with this username/password * @param password The password to associate with this username/password
* pair. * pair.
*/ */
@@ -154,6 +158,7 @@ public class Credentials implements Serializable {
/** /**
* Returns the username associated with this set of credentials. * Returns the username associated with this set of credentials.
*
* @return The username associated with this username/password pair, or * @return The username associated with this username/password pair, or
* null if no username has been set. * null if no username has been set.
*/ */
@@ -163,6 +168,7 @@ public class Credentials implements Serializable {
/** /**
* Sets the username associated with this set of credentials. * Sets the username associated with this set of credentials.
*
* @param username The username to associate with this username/password * @param username The username to associate with this username/password
* pair. * pair.
*/ */
@@ -172,6 +178,7 @@ public class Credentials implements Serializable {
/** /**
* Returns the HttpServletRequest associated with this set of credentials. * Returns the HttpServletRequest associated with this set of credentials.
*
* @return The HttpServletRequest associated with this set of credentials, * @return The HttpServletRequest associated with this set of credentials,
* or null if no such request exists. * or null if no such request exists.
*/ */
@@ -181,8 +188,6 @@ 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.
@@ -193,6 +198,7 @@ public class Credentials implements Serializable {
/** /**
* Returns the HttpSession associated with this set of credentials. * Returns the HttpSession associated with this set of credentials.
*
* @return The HttpSession associated with this set of credentials, or null * @return The HttpSession associated with this set of credentials, or null
* if no such request exists. * if no such request exists.
*/ */
@@ -202,6 +208,7 @@ public class Credentials implements Serializable {
/** /**
* Sets the HttpSession associated with this set of credentials. * Sets the HttpSession associated with this set of credentials.
*
* @param session The HttpSession to associated with this set of * @param session The HttpSession to associated with this set of
* credentials. * credentials.
*/ */