mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
CLI printing of URL.
This commit is contained in:
parent
8bb5bc736d
commit
2c1d7f3dcc
3 changed files with 16 additions and 10 deletions
|
@ -1331,6 +1331,9 @@ void EmbeddedNetworkController::_request(
|
||||||
member["lastAuthorizedCredential"] = autoAuthCredential;
|
member["lastAuthorizedCredential"] = autoAuthCredential;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int64_t authenticationExpiryTime = member["authenticationExpiryTime"];
|
||||||
|
const std::string authenticationURL = member["authenticationURL"];
|
||||||
|
|
||||||
if (authorized) {
|
if (authorized) {
|
||||||
// Update version info and meta-data if authorized and if this is a genuine request
|
// Update version info and meta-data if authorized and if this is a genuine request
|
||||||
if (requestPacketId) {
|
if (requestPacketId) {
|
||||||
|
@ -1357,18 +1360,12 @@ void EmbeddedNetworkController::_request(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const int64_t authenticationExpiryTime = member["authenticationExpiryTime"];
|
|
||||||
if ((authenticationExpiryTime >= 0)&&(authenticationExpiryTime < now)) {
|
if ((authenticationExpiryTime >= 0)&&(authenticationExpiryTime < now)) {
|
||||||
const std::string authenticationURL = member["authenticationURL"];
|
Dictionary<1024> authInfo;
|
||||||
if (authenticationURL.empty()) {
|
if (!authenticationURL.empty())
|
||||||
_sender->ncSendError(nwid,requestPacketId,identity.address(),NetworkController::NC_ERROR_AUTHENTICATION_REQUIRED, nullptr, 0);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
Dictionary<1024> authInfo;
|
|
||||||
authInfo.add("aU", authenticationURL.c_str());
|
authInfo.add("aU", authenticationURL.c_str());
|
||||||
_sender->ncSendError(nwid,requestPacketId,identity.address(),NetworkController::NC_ERROR_AUTHENTICATION_REQUIRED, authInfo.data(), authInfo.sizeBytes());
|
_sender->ncSendError(nwid,requestPacketId,identity.address(),NetworkController::NC_ERROR_AUTHENTICATION_REQUIRED, authInfo.data(), authInfo.sizeBytes());
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If they are not authorized, STOP!
|
// If they are not authorized, STOP!
|
||||||
|
|
8
one.cpp
8
one.cpp
|
@ -794,6 +794,14 @@ static int cli(int argc,char **argv)
|
||||||
OSUtils::jsonString(n["type"],"-").c_str(),
|
OSUtils::jsonString(n["type"],"-").c_str(),
|
||||||
OSUtils::jsonString(n["portDeviceName"],"-").c_str(),
|
OSUtils::jsonString(n["portDeviceName"],"-").c_str(),
|
||||||
aa.c_str());
|
aa.c_str());
|
||||||
|
int64_t authenticationExpiryTime = n["authenticationExpiryTime"];
|
||||||
|
if (authenticationExpiryTime >= 0) {
|
||||||
|
if (n["status"] == "AUTHENTICATION_REQUIRED") {
|
||||||
|
printf(" SSO authentication required, URL: %s" ZT_EOL_S, OSUtils::jsonString(n["authenticationURL"], "(null)").c_str());
|
||||||
|
} else {
|
||||||
|
printf(" SSO authentication expires in %lld" ZT_EOL_S, (authenticationExpiryTime - OSUtils::now()) / 1000LL);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,6 +184,7 @@ static void _networkToJson(nlohmann::json &nj,const ZT_VirtualNetworkConfig *nc,
|
||||||
case ZT_NETWORK_STATUS_NOT_FOUND: nstatus = "NOT_FOUND"; break;
|
case ZT_NETWORK_STATUS_NOT_FOUND: nstatus = "NOT_FOUND"; break;
|
||||||
case ZT_NETWORK_STATUS_PORT_ERROR: nstatus = "PORT_ERROR"; break;
|
case ZT_NETWORK_STATUS_PORT_ERROR: nstatus = "PORT_ERROR"; break;
|
||||||
case ZT_NETWORK_STATUS_CLIENT_TOO_OLD: nstatus = "CLIENT_TOO_OLD"; break;
|
case ZT_NETWORK_STATUS_CLIENT_TOO_OLD: nstatus = "CLIENT_TOO_OLD"; break;
|
||||||
|
case ZT_NETWORK_STATUS_AUTHENTICATION_REQUIRED: nstatus = "AUTHENTICATION_REQUIRED"; break;
|
||||||
}
|
}
|
||||||
switch(nc->type) {
|
switch(nc->type) {
|
||||||
case ZT_NETWORK_TYPE_PRIVATE: ntype = "PRIVATE"; break;
|
case ZT_NETWORK_TYPE_PRIVATE: ntype = "PRIVATE"; break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue