authentication: extend opnsense-auth to respond with json encoded data when the authenticator received additional properties (such as framed ip addresses, groups, etc). needed for https://github.com/opnsense/core/issues/3266 should be a non-breaking change, since current authentication sequences only use the return code.

This commit is contained in:
Ad Schellevis 2019-10-30 10:25:01 +01:00
parent f098b3a9ba
commit 875a1e2d4a

View File

@ -63,6 +63,11 @@ if (!empty($auth_data['user']) && isset($auth_data['password'])) {
$authFactory = new \OPNsense\Auth\AuthenticationFactory();
$is_authenticated = $authFactory->authenticate($auth_data['service'], $auth_data['user'], $auth_data['password']);
if ($is_authenticated) {
$authProps = $authFactory->getLastAuthProperties();
if (!empty($authProps)) {
// dump authentication response data to stdout
echo json_encode($authProps, JSON_INVALID_UTF8_IGNORE) ."\n";
}
$exit_status = 0;
} else {
if (getUserEntry($auth_data['user']) === false) {