mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 01:24:36 +02:00
default to no auth for domain-server, fix no auth flow
This commit is contained in:
parent
cb40a9b00d
commit
d56bafc9a5
2 changed files with 24 additions and 21 deletions
|
@ -34,7 +34,7 @@ DomainServer::DomainServer(int argc, char* 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(),
|
||||||
_nodeAuthenticationURL(DEFAULT_NODE_AUTH_URL),
|
_nodeAuthenticationURL(),
|
||||||
_redeemedTokenResponses()
|
_redeemedTokenResponses()
|
||||||
{
|
{
|
||||||
setOrganizationName("High Fidelity");
|
setOrganizationName("High Fidelity");
|
||||||
|
@ -46,10 +46,10 @@ DomainServer::DomainServer(int argc, char* argv[]) :
|
||||||
int argumentIndex = 0;
|
int argumentIndex = 0;
|
||||||
|
|
||||||
// check if this domain server should use no authentication or a custom hostname for authentication
|
// 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";
|
const QString CUSTOM_AUTH_OPTION = "--customAuth";
|
||||||
if ((argumentIndex = _argumentList.indexOf(NO_AUTH_OPTION) != -1)) {
|
if ((argumentIndex = _argumentList.indexOf(DEFAULT_AUTH_OPTION) != -1)) {
|
||||||
_nodeAuthenticationURL = QUrl();
|
_nodeAuthenticationURL = QUrl(DEFAULT_NODE_AUTH_URL);
|
||||||
} else if ((argumentIndex = _argumentList.indexOf(CUSTOM_AUTH_OPTION)) != -1) {
|
} else if ((argumentIndex = _argumentList.indexOf(CUSTOM_AUTH_OPTION)) != -1) {
|
||||||
_nodeAuthenticationURL = QUrl(_argumentList.value(argumentIndex + 1));
|
_nodeAuthenticationURL = QUrl(_argumentList.value(argumentIndex + 1));
|
||||||
}
|
}
|
||||||
|
@ -74,8 +74,8 @@ DomainServer::DomainServer(int argc, char* argv[]) :
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "Authentication was requested against" << qPrintable(_nodeAuthenticationURL.toString())
|
qDebug() << "Authentication was requested against" << qPrintable(_nodeAuthenticationURL.toString())
|
||||||
<< "but both or one of" << qPrintable(DATA_SERVER_USERNAME_ENV)
|
<< "but both or one of" << qPrintable(DATA_SERVER_USERNAME_ENV)
|
||||||
<< "/" << qPrintable(DATA_SERVER_PASSWORD_ENV) << "are not set. Qutting!";
|
<< "/" << qPrintable(DATA_SERVER_PASSWORD_ENV) << "are not set. Qutting!";
|
||||||
|
|
||||||
// bail out
|
// bail out
|
||||||
QMetaObject::invokeMethod(this, "quit", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(this, "quit", Qt::QueuedConnection);
|
||||||
|
|
|
@ -108,16 +108,23 @@ bool NodeList::packetVersionAndHashMatch(const QByteArray& packet) {
|
||||||
<< uuidFromPacketHeader(packet);
|
<< uuidFromPacketHeader(packet);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (checkType == PacketTypeDomainList
|
if (checkType == PacketTypeDomainList) {
|
||||||
&& _domainInfo.getUUID() == uuidFromPacketHeader(packet)) {
|
|
||||||
if (hashForPacketAndConnectionUUID(packet, _domainInfo.getConnectionSecret()) == hashFromPacketHeader(packet)) {
|
if (_domainInfo.getRootAuthenticationURL().isEmpty() && _domainInfo.getUUID().isNull()) {
|
||||||
// this is a packet from the domain-server (PacketTypeDomainServerListRequest)
|
// pull the UUID from this packet and set it as our domain-server UUID
|
||||||
// and the sender UUID matches the UUID we expect for the domain
|
_domainInfo.setUUID(uuidFromPacketHeader(packet));
|
||||||
return true;
|
}
|
||||||
} else {
|
|
||||||
// this is a packet from the domain-server but there is a hash mismatch
|
if (_domainInfo.getUUID() == uuidFromPacketHeader(packet)) {
|
||||||
qDebug() << "Packet hash mismatch on" << checkType << "from domain-server at" << _domainInfo.getHostname();
|
if (hashForPacketAndConnectionUUID(packet, _domainInfo.getConnectionSecret()) == hashFromPacketHeader(packet)) {
|
||||||
return false;
|
// this is a packet from the domain-server (PacketTypeDomainServerListRequest)
|
||||||
|
// and the sender UUID matches the UUID we expect for the domain
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
// this is a packet from the domain-server but there is a hash mismatch
|
||||||
|
qDebug() << "Packet hash mismatch on" << checkType << "from domain-server at" << _domainInfo.getHostname();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,11 +214,7 @@ void NodeList::timePingReply(const QByteArray& packet, const SharedNodePointer&
|
||||||
void NodeList::processNodeData(const HifiSockAddr& senderSockAddr, const QByteArray& packet) {
|
void NodeList::processNodeData(const HifiSockAddr& senderSockAddr, const QByteArray& packet) {
|
||||||
switch (packetTypeForPacket(packet)) {
|
switch (packetTypeForPacket(packet)) {
|
||||||
case PacketTypeDomainList: {
|
case PacketTypeDomainList: {
|
||||||
// only process the DS if this is our current domain server
|
processDomainServerList(packet);
|
||||||
if (_domainInfo.getSockAddr() == senderSockAddr) {
|
|
||||||
processDomainServerList(packet);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PacketTypeDomainServerAuthRequest: {
|
case PacketTypeDomainServerAuthRequest: {
|
||||||
|
|
Loading…
Reference in a new issue