default to no auth for domain-server, fix no auth flow

This commit is contained in:
Stephen Birarda 2014-02-21 13:16:24 -08:00
parent cb40a9b00d
commit d56bafc9a5
2 changed files with 24 additions and 21 deletions

View file

@ -34,7 +34,7 @@ DomainServer::DomainServer(int argc, char* argv[]) :
_HTTPManager(DOMAIN_SERVER_HTTP_PORT, QString("%1/resources/web/").arg(QCoreApplication::applicationDirPath()), this),
_staticAssignmentHash(),
_assignmentQueue(),
_nodeAuthenticationURL(DEFAULT_NODE_AUTH_URL),
_nodeAuthenticationURL(),
_redeemedTokenResponses()
{
setOrganizationName("High Fidelity");
@ -46,10 +46,10 @@ DomainServer::DomainServer(int argc, char* argv[]) :
int argumentIndex = 0;
// check if this domain server should use no authentication or a custom hostname for authentication
const QString NO_AUTH_OPTION = "--noAuth";
const QString DEFAULT_AUTH_OPTION = "--defaultAuth";
const QString CUSTOM_AUTH_OPTION = "--customAuth";
if ((argumentIndex = _argumentList.indexOf(NO_AUTH_OPTION) != -1)) {
_nodeAuthenticationURL = QUrl();
if ((argumentIndex = _argumentList.indexOf(DEFAULT_AUTH_OPTION) != -1)) {
_nodeAuthenticationURL = QUrl(DEFAULT_NODE_AUTH_URL);
} else if ((argumentIndex = _argumentList.indexOf(CUSTOM_AUTH_OPTION)) != -1) {
_nodeAuthenticationURL = QUrl(_argumentList.value(argumentIndex + 1));
}

View file

@ -108,8 +108,14 @@ bool NodeList::packetVersionAndHashMatch(const QByteArray& packet) {
<< uuidFromPacketHeader(packet);
}
} else {
if (checkType == PacketTypeDomainList
&& _domainInfo.getUUID() == uuidFromPacketHeader(packet)) {
if (checkType == PacketTypeDomainList) {
if (_domainInfo.getRootAuthenticationURL().isEmpty() && _domainInfo.getUUID().isNull()) {
// pull the UUID from this packet and set it as our domain-server UUID
_domainInfo.setUUID(uuidFromPacketHeader(packet));
}
if (_domainInfo.getUUID() == uuidFromPacketHeader(packet)) {
if (hashForPacketAndConnectionUUID(packet, _domainInfo.getConnectionSecret()) == hashFromPacketHeader(packet)) {
// this is a packet from the domain-server (PacketTypeDomainServerListRequest)
// and the sender UUID matches the UUID we expect for the domain
@ -120,6 +126,7 @@ bool NodeList::packetVersionAndHashMatch(const QByteArray& packet) {
return false;
}
}
}
qDebug() << "Packet of type" << checkType << "received from unknown node with UUID"
<< uuidFromPacketHeader(packet);
@ -207,11 +214,7 @@ void NodeList::timePingReply(const QByteArray& packet, const SharedNodePointer&
void NodeList::processNodeData(const HifiSockAddr& senderSockAddr, const QByteArray& packet) {
switch (packetTypeForPacket(packet)) {
case PacketTypeDomainList: {
// only process the DS if this is our current domain server
if (_domainInfo.getSockAddr() == senderSockAddr) {
processDomainServerList(packet);
}
break;
}
case PacketTypeDomainServerAuthRequest: {