summaryrefslogtreecommitdiff
path: root/controller/EmbeddedNetworkController.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <[email protected]>2021-07-23 19:05:59 -0400
committerAdam Ierymenko <[email protected]>2021-07-23 19:05:59 -0400
commitefe0e8aa7bf5acbc604bff0906f5c212a2c4d81d (patch)
tree25e69543860616d28c076ec4f2467d1ff0f31832 /controller/EmbeddedNetworkController.cpp
parent5c7e51feaf2dba254da48bb09587e3f5cf1893a2 (diff)
Notification of about-to-expire status... almost there.
Diffstat (limited to 'controller/EmbeddedNetworkController.cpp')
-rw-r--r--controller/EmbeddedNetworkController.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/controller/EmbeddedNetworkController.cpp b/controller/EmbeddedNetworkController.cpp
index 971cc1b7..5709878c 100644
--- a/controller/EmbeddedNetworkController.cpp
+++ b/controller/EmbeddedNetworkController.cpp
@@ -1366,17 +1366,21 @@ void EmbeddedNetworkController::_request(
std::string memberId = member["id"];
fprintf(stderr, "ssoEnabled && !ssoExempt %s-%s\n", nwids, memberId.c_str());
uint64_t authenticationExpiryTime = (int64_t)OSUtils::jsonInt(member["authenticationExpiryTime"], 0);
- fprintf(stderr, "authExpiryTime: %lld\n", authenticationExpiryTime);
- if (authenticationExpiryTime < now) {
- std::string authenticationURL = _db.getSSOAuthURL(member, _ssoRedirectURL);
- if (!authenticationURL.empty()) {
- Dictionary<3072> authInfo;
- authInfo.add("aU", authenticationURL.c_str());
- fprintf(stderr, "sending auth URL: %s\n", authenticationURL.c_str());
- DB::cleanMember(member);
- _db.save(member,true);
- _sender->ncSendError(nwid,requestPacketId,identity.address(),NetworkController::NC_ERROR_AUTHENTICATION_REQUIRED, authInfo.data(), authInfo.sizeBytes());
- return;
+ if (authenticationExpiryTime > 0) {
+ fprintf(stderr, "authExpiryTime: %lld\n", authenticationExpiryTime);
+ if (authenticationExpiryTime < now) {
+ std::string authenticationURL = _db.getSSOAuthURL(member, _ssoRedirectURL);
+ if (!authenticationURL.empty()) {
+ Dictionary<3072> authInfo;
+ authInfo.add("aU", authenticationURL.c_str());
+ fprintf(stderr, "sending auth URL: %s\n", authenticationURL.c_str());
+ DB::cleanMember(member);
+ _db.save(member,true);
+ _sender->ncSendError(nwid,requestPacketId,identity.address(),NetworkController::NC_ERROR_AUTHENTICATION_REQUIRED, authInfo.data(), authInfo.sizeBytes());
+ return;
+ }
+ } else {
+ _db.memberExpiring(authenticationExpiryTime, nwid, identity.address().toInt());
}
}
}