Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/API/V4/NGINXController.php
Show First 20 Lines • Show All 171 Lines • ▼ Show 20 Lines | public function authenticate(Request $request) | ||||
* Auth-SSL-Verify: SUCCESS | * Auth-SSL-Verify: SUCCESS | ||||
* Auth-SSL-Subject: /CN=example.com | * Auth-SSL-Subject: /CN=example.com | ||||
* Auth-SSL-Issuer: /CN=example.com | * Auth-SSL-Issuer: /CN=example.com | ||||
* Auth-SSL-Serial: C07AD56B846B5BFF | * Auth-SSL-Serial: C07AD56B846B5BFF | ||||
* Auth-SSL-Fingerprint: 29d6a80a123d13355ed16b4b04605e29cb55a5ad | * Auth-SSL-Fingerprint: 29d6a80a123d13355ed16b4b04605e29cb55a5ad | ||||
*/ | */ | ||||
$password = $request->headers->get('Auth-Pass', null); | $password = $request->headers->get('Auth-Pass', null); | ||||
$username = $request->headers->get('Auth-User', null); | |||||
$ip = $request->headers->get('Client-Ip', null); | |||||
$proxy_ip = $request->headers->get('Proxy-Protocol-Addr', null); | |||||
mollekopf: Alec pointed out that instead of extracting the Proxy-Protocol-Addr here we could set the… | |||||
Done Inline ActionsI have tried this, but don't know how to set the client ip on the http subrequest of the mail module if at all possible. mollekopf: I have tried this, but don't know how to set the client ip on the http subrequest of the mail… | |||||
if ($proxy_ip) { | |||||
$ip = $proxy_ip; | |||||
} | |||||
try { | try { | ||||
$user = $this->authorizeRequest( | $user = $this->authorizeRequest( | ||||
$request->headers->get('Auth-User', null), | $username, | ||||
$password, | $password, | ||||
$request->headers->get('Client-Ip', null), | $ip, | ||||
); | ); | ||||
} catch (\Exception $e) { | } catch (\Exception $e) { | ||||
return $this->byebye($request, $e->getMessage()); | return $this->byebye($request, $e->getMessage()); | ||||
} | } | ||||
// All checks passed | // All checks passed | ||||
switch ($request->headers->get('Auth-Protocol')) { | switch ($request->headers->get('Auth-Protocol')) { | ||||
case "imap": | case "imap": | ||||
▲ Show 20 Lines • Show All 80 Lines • Show Last 20 Lines |
Alec pointed out that instead of extracting the Proxy-Protocol-Addr here we could set the Client-Ip in NGINX on the request.