-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added check for cookie update and support for HTTP Basic authentication #18
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -272,21 +272,67 @@ class RWSClient : public POCOClient | |
*/ | ||
std::vector<SubscriptionResource> resources_; | ||
}; | ||
|
||
/** | ||
* \brief A constructor. | ||
* | ||
* \param ip_address specifying the robot controller's IP address. | ||
*/ | ||
RWSClient(const std::string ip_address) | ||
: | ||
POCOClient(ip_address, | ||
SystemConstants::General::DEFAULT_PORT_NUMBER, | ||
SystemConstants::General::DEFAULT_USERNAME, | ||
SystemConstants::General::DEFAULT_PASSWORD) | ||
{} | ||
|
||
/** | ||
* \brief A constructor. | ||
* | ||
* \param ip_address specifying the robot controller's IP address. | ||
* \param username for the username to the RWS authentication process. | ||
* \param password for the password to the RWS authentication process. | ||
*/ | ||
RWSClient(const std::string ip_address, const std::string username, const std::string password) | ||
: | ||
POCOClient(ip_address, | ||
SystemConstants::General::DEFAULT_PORT_NUMBER, | ||
username, | ||
password) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we start using C++11, we could use delegating constructors here. (and for all the other ctor variants below) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I will keep that in mind. |
||
{} | ||
|
||
/** | ||
* \brief A constructor. | ||
* | ||
* \param ip_address specifying the robot controller's IP address. | ||
* \param port for the port used by the RWS server. | ||
*/ | ||
RWSClient(const std::string ip_address, const unsigned short port) | ||
: | ||
POCOClient(ip_address, | ||
port, | ||
SystemConstants::General::DEFAULT_USERNAME, | ||
SystemConstants::General::DEFAULT_PASSWORD) | ||
{} | ||
|
||
/** | ||
* \brief A constructor. | ||
* | ||
* \param ip_address for the remote server's IP address. | ||
* \param port for the remote server's port. | ||
* \param user for the remote server's authentication (assumed to be Digest). | ||
* \param password for the remote server's authentication (assumed to be Digest). | ||
* \param ip_address specifying the robot controller's IP address. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this the LAN address, or can it be any address? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have only tested with LAN addresses, but I guess it could be any address as long as it is possible to establish a network connection. The argument is passed down to a constructor for a POCO C++ HTTPClientSession. |
||
* \param port for the port used by the RWS server. | ||
* \param username for the username to the RWS authentication process. | ||
* \param password for the password to the RWS authentication process. | ||
*/ | ||
RWSClient(const std::string ip_address, | ||
const Poco::UInt16 port = 80, | ||
const std::string user = SystemConstants::General::DEFAULT_USERNAME, | ||
const std::string password = SystemConstants::General::DEFAULT_PASSWORD) | ||
const unsigned short port, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did this lose the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm... I don't remember... possibly a case of "copy-and-paste". |
||
const std::string username, | ||
const std::string password) | ||
: | ||
POCOClient(ip_address, port, user, password) {} | ||
POCOClient(ip_address, | ||
port, | ||
username, | ||
password) | ||
{} | ||
|
||
/** | ||
* \brief A destructor. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -305,10 +305,63 @@ class RWSInterface | |
* \brief A constructor. | ||
* | ||
* \param ip_address specifying the robot controller's IP address. | ||
* \param port specifying the robot controller's RWS server's port number. | ||
*/ | ||
RWSInterface(const std::string ip_address, const unsigned short port = 80); | ||
RWSInterface(const std::string ip_address) | ||
: | ||
rws_client_(ip_address, | ||
SystemConstants::General::DEFAULT_PORT_NUMBER, | ||
SystemConstants::General::DEFAULT_USERNAME, | ||
SystemConstants::General::DEFAULT_PASSWORD) | ||
{} | ||
|
||
/** | ||
* \brief A constructor. | ||
* | ||
* \param ip_address specifying the robot controller's IP address. | ||
* \param username for the username to the RWS authentication process. | ||
* \param password for the password to the RWS authentication process. | ||
*/ | ||
RWSInterface(const std::string ip_address, const std::string username, const std::string password) | ||
: | ||
rws_client_(ip_address, | ||
SystemConstants::General::DEFAULT_PORT_NUMBER, | ||
username, | ||
password) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment about the delegating constructors here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I will keep it in mind. |
||
{} | ||
|
||
/** | ||
* \brief A constructor. | ||
* | ||
* \param ip_address specifying the robot controller's IP address. | ||
* \param port for the port used by the RWS server. | ||
*/ | ||
RWSInterface(const std::string ip_address, const unsigned short port) | ||
: | ||
rws_client_(ip_address, | ||
port, | ||
SystemConstants::General::DEFAULT_USERNAME, | ||
SystemConstants::General::DEFAULT_PASSWORD) | ||
{} | ||
|
||
/** | ||
* \brief A constructor. | ||
* | ||
* \param ip_address specifying the robot controller's IP address. | ||
* \param port for the port used by the RWS server. | ||
* \param username for the username to the RWS authentication process. | ||
* \param password for the password to the RWS authentication process. | ||
*/ | ||
RWSInterface(const std::string ip_address, | ||
const unsigned short port, | ||
const std::string username, | ||
const std::string password) | ||
: | ||
rws_client_(ip_address, | ||
port, | ||
username, | ||
password) | ||
{} | ||
|
||
/** | ||
* \brief A method for collecting runtime information of the robot controller. | ||
* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,7 @@ | |
|
||
#include "Poco/Mutex.h" | ||
#include "Poco/Net/HTTPClientSession.h" | ||
#include "Poco/Net/HTTPCredentials.h" | ||
#include "Poco/Net/HTTPResponse.h" | ||
#include "Poco/Net/WebSocket.h" | ||
#include "Poco/SharedPtr.h" | ||
|
@@ -246,16 +247,16 @@ class POCOClient | |
* | ||
* \param ip_address for the remote server's IP address. | ||
* \param port for the remote server's port. | ||
* \param user for the remote server's authentication (assumed to be Digest). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is no longer only Digest auth, or has the default changed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, the default is still Digest for RWS. However, the POCOClient implementation don't know that it is used for RWS at all, and since the HTTPCredentials can handle both it is more general this way (compared to the previous HTTPDigestCredentials). |
||
* \param password for the remote server's authentication (assumed to be Digest). | ||
* \param username for the username to the remote server's authentication process. | ||
* \param password for the password to the remote server's authentication process. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment for all other places that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have thought about improving the parameter descriptions, but I haven't had time yet. I have opened an issue to improve this, see #26 |
||
*/ | ||
POCOClient(const std::string ip_address, | ||
const Poco::UInt16 port, | ||
const std::string user, | ||
const std::string username, | ||
const std::string password) | ||
: | ||
client_session_(ip_address, port), | ||
digest_credentials_(user, password) | ||
http_credentials_(username, password) | ||
{ | ||
client_session_.setKeepAlive(true); | ||
client_session_.setTimeout(Poco::Timespan(DEFAULT_TIMEOUT)); | ||
|
@@ -424,10 +425,10 @@ class POCOClient | |
Poco::Mutex websocket_mutex_; | ||
|
||
/** | ||
* \brief Digest authentication credentials. | ||
* \brief HTTP credentials for the remote server's access authentication process. | ||
*/ | ||
Poco::Net::HTTPDigestCredentials digest_credentials_; | ||
Poco::Net::HTTPCredentials http_credentials_; | ||
|
||
/** | ||
* \brief A container for cookies received from a server. | ||
*/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -411,15 +411,64 @@ class RWSSimpleStateMachineInterface : public RWSInterface | |
/** | ||
* \brief A constructor. | ||
* | ||
* \param ip_address for the remote server's IP address. | ||
* \param port for the remote server's port. | ||
* \param ip_address specifying the robot controller's IP address. | ||
*/ | ||
RWSSimpleStateMachineInterface(const std::string ip_address, const unsigned short port = 80) | ||
RWSSimpleStateMachineInterface(const std::string ip_address) | ||
: | ||
RWSInterface(ip_address, port) | ||
{ | ||
} | ||
RWSInterface(ip_address, | ||
SystemConstants::General::DEFAULT_PORT_NUMBER, | ||
SystemConstants::General::DEFAULT_USERNAME, | ||
SystemConstants::General::DEFAULT_PASSWORD) | ||
{} | ||
|
||
/** | ||
* \brief A constructor. | ||
* | ||
* \param ip_address specifying the robot controller's IP address. | ||
* \param username for the username to the RWS authentication process. | ||
* \param password for the password to the RWS authentication process. | ||
*/ | ||
RWSSimpleStateMachineInterface(const std::string ip_address, const std::string username, const std::string password) | ||
: | ||
RWSInterface(ip_address, | ||
SystemConstants::General::DEFAULT_PORT_NUMBER, | ||
username, | ||
password) | ||
{} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Delegating constructors again. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I will keep it in mind. |
||
|
||
/** | ||
* \brief A constructor. | ||
* | ||
* \param ip_address specifying the robot controller's IP address. | ||
* \param port for the port used by the RWS server. | ||
*/ | ||
RWSSimpleStateMachineInterface(const std::string ip_address, const unsigned short port) | ||
: | ||
RWSInterface(ip_address, | ||
port, | ||
SystemConstants::General::DEFAULT_USERNAME, | ||
SystemConstants::General::DEFAULT_PASSWORD) | ||
{} | ||
|
||
/** | ||
* \brief A constructor. | ||
* | ||
* \param ip_address specifying the robot controller's IP address. | ||
* \param port for the port used by the RWS server. | ||
* \param username for the username to the RWS authentication process. | ||
* \param password for the password to the RWS authentication process. | ||
*/ | ||
RWSSimpleStateMachineInterface(const std::string ip_address, | ||
const unsigned short port, | ||
const std::string username, | ||
const std::string password) | ||
: | ||
RWSInterface(ip_address, | ||
port, | ||
username, | ||
password) | ||
{} | ||
|
||
/** | ||
* \brief A method for retrieving the current jointtarget values of the robot. | ||
* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,18 +165,19 @@ const std::string SystemConstants::ContollerStates::CONTROLLER_MOTOR_OFF = | |
const std::string SystemConstants::ContollerStates::PANEL_OPERATION_MODE_AUTO = "AUTO"; | ||
const std::string SystemConstants::ContollerStates::RAPID_EXECUTION_RUNNING = "running"; | ||
|
||
const std::string SystemConstants::General::EXTERNAL_APPLICATION = "ExternalApplication"; | ||
const std::string SystemConstants::General::EXTERNAL_LOCATION = "ExternalLocation"; | ||
const std::string SystemConstants::General::DEFAULT_PASSWORD = "robotics"; | ||
const std::string SystemConstants::General::DEFAULT_USERNAME = "Default User"; | ||
const std::string SystemConstants::General::LOCAL = "local"; | ||
const std::string SystemConstants::General::MECHANICAL_UNIT_ROB_1 = "ROB_1"; | ||
const std::string SystemConstants::General::MECHANICAL_UNIT_ROB_2 = "ROB_2"; | ||
const std::string SystemConstants::General::MECHANICAL_UNIT_ROB_3 = "ROB_3"; | ||
const std::string SystemConstants::General::MECHANICAL_UNIT_ROB_4 = "ROB_4"; | ||
const std::string SystemConstants::General::MECHANICAL_UNIT_ROB_L = "ROB_L"; | ||
const std::string SystemConstants::General::MECHANICAL_UNIT_ROB_R = "ROB_R"; | ||
const std::string SystemConstants::General::REMOTE = "remote"; | ||
const std::string SystemConstants::General::EXTERNAL_APPLICATION = "ExternalApplication"; | ||
const std::string SystemConstants::General::EXTERNAL_LOCATION = "ExternalLocation"; | ||
const unsigned short SystemConstants::General::DEFAULT_PORT_NUMBER = 80; | ||
const std::string SystemConstants::General::DEFAULT_PASSWORD = "robotics"; | ||
const std::string SystemConstants::General::DEFAULT_USERNAME = "Default User"; | ||
const std::string SystemConstants::General::LOCAL = "local"; | ||
const std::string SystemConstants::General::MECHANICAL_UNIT_ROB_1 = "ROB_1"; | ||
const std::string SystemConstants::General::MECHANICAL_UNIT_ROB_2 = "ROB_2"; | ||
const std::string SystemConstants::General::MECHANICAL_UNIT_ROB_3 = "ROB_3"; | ||
const std::string SystemConstants::General::MECHANICAL_UNIT_ROB_4 = "ROB_4"; | ||
const std::string SystemConstants::General::MECHANICAL_UNIT_ROB_L = "ROB_L"; | ||
const std::string SystemConstants::General::MECHANICAL_UNIT_ROB_R = "ROB_R"; | ||
const std::string SystemConstants::General::REMOTE = "remote"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably change some of this to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I will keep it in mind. |
||
|
||
const std::string SystemConstants::IOSignals::HAND_ACTUAL_POSITION_L = "hand_ActualPosition_L"; | ||
const std::string SystemConstants::IOSignals::HAND_ACTUAL_POSITION_R = "hand_ActualPosition_R"; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a tad too general. Do you think we could describe this better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are quite a few such general descriptions. I have opened an issue to improve this, see #25