mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-47: Implement support for client hostname/IP token for connections.
This commit is contained in:
@@ -41,6 +41,16 @@ public class StandardTokens {
|
||||
*/
|
||||
public static final String PASSWORD_TOKEN = "GUAC_PASSWORD";
|
||||
|
||||
/**
|
||||
* The name of the client token added via addStandardTokens().
|
||||
*/
|
||||
public static final String CLIENT_HOST_TOKEN = "GUAC_CLIENT_HOST";
|
||||
|
||||
/**
|
||||
* The IP of the client token added via addStandardTokens().
|
||||
*/
|
||||
public static final String CLIENT_IP_TOKEN = "GUAC_CLIENT_IP";
|
||||
|
||||
/**
|
||||
* The name of the date token (server-local time) added via
|
||||
* addStandardTokens().
|
||||
@@ -115,6 +125,13 @@ public class StandardTokens {
|
||||
if (password != null)
|
||||
filter.setToken(PASSWORD_TOKEN, password);
|
||||
|
||||
// Add client hostname and ip tokens
|
||||
HttpServletRequest request = credentials.getRequest();
|
||||
if (request != null) {
|
||||
filter.setToken(CLIENT_HOST_TOKEN, request.getRemoteHost());
|
||||
filter.setToken(CLIENT_IP_TOKEN, request.getRemoteAddr());
|
||||
}
|
||||
|
||||
// Add any tokens which do not require credentials
|
||||
addStandardTokens(filter);
|
||||
|
||||
|
Reference in New Issue
Block a user