Commit 7febe0a4 authored by Ad Schellevis's avatar Ad Schellevis

(Captiveportal, new) work in progress session/client restrictions (related to radius accounting)

parent b50eee57
...@@ -121,6 +121,9 @@ class AccessController extends ApiControllerBase ...@@ -121,6 +121,9 @@ class AccessController extends ApiControllerBase
} elseif ($this->request->isPost()) { } elseif ($this->request->isPost()) {
// close session for long running action // close session for long running action
$this->sessionClose(); $this->sessionClose();
// init variables for authserver object and name
$authServer = null;
$authServerName = "";
// get username from post // get username from post
$userName = $this->request->getPost("user", "striptags", null); $userName = $this->request->getPost("user", "striptags", null);
...@@ -149,7 +152,6 @@ class AccessController extends ApiControllerBase ...@@ -149,7 +152,6 @@ class AccessController extends ApiControllerBase
} else { } else {
// no authentication needed, set username to "anonymous@ip" // no authentication needed, set username to "anonymous@ip"
$userName = "anonymous@" . $clientIp; $userName = "anonymous@" . $clientIp;
$authServerName = "";
$isAuthenticated = true; $isAuthenticated = true;
} }
...@@ -172,6 +174,21 @@ class AccessController extends ApiControllerBase ...@@ -172,6 +174,21 @@ class AccessController extends ApiControllerBase
'json' 'json'
) )
); );
// push session restrictions, if they apply
if (array_key_exists('sessionId', $CPsession) && $authServer != null) {
$authProps = $authServer->getLastAuthProperties();
// when adding more client/session restrictions, extend next code
// (currently only time is restricted)
if (array_key_exists('session_timeout', $authProps)) {
$backend->configdpRun(
"captiveportal set session_restrictions",
array((string)$cpZone->zoneid,
$CPsession['sessionId'],
$authProps['session_timeout']
)
);
}
}
$CPsession = json_decode($CPsession, true); $CPsession = json_decode($CPsession, true);
if ($CPsession != null) { if ($CPsession != null) {
// only return session if configd return a valid json response, otherwise fallback to // only return session if configd return a valid json response, otherwise fallback to
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment