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

Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/a0d0e076
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/a0d0e076
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/a0d0e076

Branch: refs/heads/master
Commit: a0d0e076587ec57a02dbdd90989539e659e8e749
Parents: 52a3f45
Author: Nick Couchman <[email protected]>
Authored: Fri Jun 15 20:18:32 2018 -0400
Committer: Nick Couchman <[email protected]>
Committed: Sat Jun 16 08:06:07 2018 -0400

----------------------------------------------------------------------
 .../org/apache/guacamole/net/auth/Credentials.java | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/a0d0e076/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Credentials.java
----------------------------------------------------------------------
diff --git 
a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Credentials.java 
b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Credentials.java
index 2c3b89e..810e320 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Credentials.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Credentials.java
@@ -123,19 +123,22 @@ public class Credentials implements Serializable {
             if (matcher.matches())
                 this.remoteAddress = matcher.group(1);
         }
+        
         // Header not present, just use remote address
-        else {
+        else
             this.remoteAddress = request.getRemoteAddr();
-        }
         
+        // Get the remote hostname
         this.remoteHostname = request.getRemoteHost();
         
+        // If session exists get it, but don't create a new one.
         this.session = request.getSession(false);
         
     }
     
     /**
      * Returns the password associated with this set of credentials.
+     *
      * @return The password associated with this username/password pair, or
      *         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.
+     *
      * @param password The password to associate with this username/password
      *                 pair.
      */
@@ -154,6 +158,7 @@ public class Credentials implements Serializable {
 
     /**
      * Returns the username associated with this set of credentials.
+     *
      * @return The username associated with this username/password pair, or
      *         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.
+     *
      * @param username The username to associate with this username/password
      *                 pair.
      */
@@ -172,6 +178,7 @@ public class Credentials implements Serializable {
 
     /**
      * Returns the HttpServletRequest associated with this set of credentials.
+     *
      * @return The HttpServletRequest associated with this set of credentials,
      *         or null if no such request exists.
      */
@@ -181,9 +188,7 @@ public class Credentials implements Serializable {
 
     /**
      * 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
      *                 credentials.
      */
@@ -193,6 +198,7 @@ public class Credentials implements Serializable {
 
     /**
      * Returns the HttpSession associated with this set of credentials.
+     *
      * @return The HttpSession associated with this set of credentials, or null
      *         if no such request exists.
      */
@@ -202,6 +208,7 @@ public class Credentials implements Serializable {
 
     /**
      * Sets the HttpSession associated with this set of credentials.
+     *
      * @param session The HttpSession to associated with this set of
      *                credentials.
      */

Reply via email to