mirror of
https://github.com/overte-org/overte.git
synced 2025-04-16 09:07:19 +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),
|
||||
_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));
|
||||
}
|
||||
|
@ -74,8 +74,8 @@ DomainServer::DomainServer(int argc, char* argv[]) :
|
|||
|
||||
} else {
|
||||
qDebug() << "Authentication was requested against" << qPrintable(_nodeAuthenticationURL.toString())
|
||||
<< "but both or one of" << qPrintable(DATA_SERVER_USERNAME_ENV)
|
||||
<< "/" << qPrintable(DATA_SERVER_PASSWORD_ENV) << "are not set. Qutting!";
|
||||
<< "but both or one of" << qPrintable(DATA_SERVER_USERNAME_ENV)
|
||||
<< "/" << qPrintable(DATA_SERVER_PASSWORD_ENV) << "are not set. Qutting!";
|
||||
|
||||
// bail out
|
||||
QMetaObject::invokeMethod(this, "quit", Qt::QueuedConnection);
|
||||
|
|
|
@ -108,16 +108,23 @@ bool NodeList::packetVersionAndHashMatch(const QByteArray& packet) {
|
|||
<< uuidFromPacketHeader(packet);
|
||||
}
|
||||
} else {
|
||||
if (checkType == PacketTypeDomainList
|
||||
&& _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
|
||||
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;
|
||||
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
|
||||
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) {
|
||||
switch (packetTypeForPacket(packet)) {
|
||||
case PacketTypeDomainList: {
|
||||
// only process the DS if this is our current domain server
|
||||
if (_domainInfo.getSockAddr() == senderSockAddr) {
|
||||
processDomainServerList(packet);
|
||||
}
|
||||
|
||||
processDomainServerList(packet);
|
||||
break;
|
||||
}
|
||||
case PacketTypeDomainServerAuthRequest: {
|
||||
|
|
Loading…
Reference in a new issue