add a node authentication hostname to the domain-server

This commit is contained in:
Stephen Birarda 2014-02-18 09:03:35 -08:00
parent 26d076f166
commit c9ade0585b
3 changed files with 19 additions and 2 deletions

View file

@ -33,12 +33,15 @@ const char* METAVOXEL_SERVER_CONFIG = "metavoxelServerConfig";
const quint16 DOMAIN_SERVER_HTTP_PORT = 8080; const quint16 DOMAIN_SERVER_HTTP_PORT = 8080;
const QString DEFAULT_NODE_AUTH_HOSTNAME = "https://data.highfidelity.io";
DomainServer::DomainServer(int argc, char* argv[]) : DomainServer::DomainServer(int argc, char* argv[]) :
QCoreApplication(argc, argv), QCoreApplication(argc, argv),
_HTTPManager(DOMAIN_SERVER_HTTP_PORT, QString("%1/resources/web/").arg(QCoreApplication::applicationDirPath()), this), _HTTPManager(DOMAIN_SERVER_HTTP_PORT, QString("%1/resources/web/").arg(QCoreApplication::applicationDirPath()), this),
_staticAssignmentHash(), _staticAssignmentHash(),
_assignmentQueue(), _assignmentQueue(),
_hasCompletedRestartHold(false) _hasCompletedRestartHold(false),
_nodeAuthenticationHostname(DEFAULT_NODE_AUTH_HOSTNAME)
{ {
const char CUSTOM_PORT_OPTION[] = "-p"; const char CUSTOM_PORT_OPTION[] = "-p";
const char* customPortString = getCmdOption(argc, (const char**) argv, CUSTOM_PORT_OPTION); const char* customPortString = getCmdOption(argc, (const char**) argv, CUSTOM_PORT_OPTION);
@ -57,6 +60,17 @@ DomainServer::DomainServer(int argc, char* argv[]) :
} }
populateDefaultStaticAssignmentsExcludingTypes(parsedTypes); populateDefaultStaticAssignmentsExcludingTypes(parsedTypes);
// check if this domain server should use no authentication or a custom hostname for authentication
const QString NO_AUTH_OPTION = "--noAuth";
const QString CUSTOM_AUTH_OPTION = "--customAuth";
if ((argumentIndex = argumentList.indexOf(NO_AUTH_OPTION) != -1)) {
_nodeAuthenticationHostname = QString();
} else if ((argumentIndex = argumentList.indexOf(CUSTOM_AUTH_OPTION)) != -1) {
_nodeAuthenticationHostname = argumentList.value(argumentIndex + 1);
}
qDebug() << "the node authentication hostname is" << _nodeAuthenticationHostname;
NodeList* nodeList = NodeList::createInstance(NodeType::DomainServer, domainServerPort); NodeList* nodeList = NodeList::createInstance(NodeType::DomainServer, domainServerPort);

View file

@ -57,6 +57,8 @@ private:
QQueue<SharedAssignmentPointer> _assignmentQueue; QQueue<SharedAssignmentPointer> _assignmentQueue;
bool _hasCompletedRestartHold; bool _hasCompletedRestartHold;
QString _nodeAuthenticationHostname;
private slots: private slots:
void readAvailableDatagrams(); void readAvailableDatagrams();
void addStaticAssignmentsBackToQueueAfterRestart(); void addStaticAssignmentsBackToQueueAfterRestart();

View file

@ -53,7 +53,8 @@ enum PacketType {
PacketTypeParticleErase, PacketTypeParticleErase,
PacketTypeParticleAddResponse, PacketTypeParticleAddResponse,
PacketTypeMetavoxelData, PacketTypeMetavoxelData,
PacketTypeAvatarIdentity PacketTypeAvatarIdentity,
PacketTypeDomainServerAuthRequest
}; };
typedef char PacketVersion; typedef char PacketVersion;