Page MenuHomeDevCentral

No OneTemporary

diff --git a/app/Enums/TrustProxyConfigurationMode.php b/app/Enums/TrustProxyConfigurationMode.php
index 606e5ee..b071e0c 100644
--- a/app/Enums/TrustProxyConfigurationMode.php
+++ b/app/Enums/TrustProxyConfigurationMode.php
@@ -1,16 +1,14 @@
<?php
namespace AuthGrove\Enums;
use Artisaninweb\Enum\Enum;
/**
* @method static TrustProxyConfigurationMode ENUM()
*/
class TrustProxyConfigurationMode extends Enum {
- const __default = self::TrustNone;
-
- const TrustNone = 0;
- const TrustSome = 1;
- const TrustAll = 2;
+ const TRUST_NONE = 0;
+ const TRUST_SOME = 1;
+ const TRUST_ALL = 2;
}
diff --git a/app/Http/Middleware/TrustProxy.php b/app/Http/Middleware/TrustProxy.php
index 0512b7d..7a441d4 100644
--- a/app/Http/Middleware/TrustProxy.php
+++ b/app/Http/Middleware/TrustProxy.php
@@ -1,58 +1,58 @@
<?php namespace AuthGrove\Http\Middleware;
use AuthGrove\Enums\TrustProxyConfigurationMode;
use Config;
use Closure;
/**
* Allow the application to work behind a load balancer or a reverse proxy
*
* See http://symfony.com/doc/current/cookbook/request/load_balancer_reverse_proxy.html
*/
class TrustProxy {
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$proxy = Config::get('app.proxy');
switch ($mode = self::getConfigurationMode($proxy)) {
- case TrustProxyConfigurationMode::TrustNone:
+ case TrustProxyConfigurationMode::TRUST_NONE:
break;
- case TrustProxyConfigurationMode::TrustSome:
+ case TrustProxyConfigurationMode::TRUST_SOME:
$request->setTrustedProxies($proxy);
break;
- case TrustProxyConfigurationMode::TrustAll:
+ case TrustProxyConfigurationMode::TRUST_ALL:
$remoteAddr = $request->server->get('REMOTE_ADDR');
$request->setTrustedProxies([ '127.0.0.1', $remoteAddr ]);
break;
default:
throw new \ArgumentException("Unhandled configuration mode: $mode");
}
return $next($request);
}
/**
* Gets trust proxies configuration mode
*/
public static function getConfigurationMode ($configValue) {
if (!is_array($configValue) || !count($configValue)) {
- return TrustProxyConfigurationMode::TrustNone;
+ return TrustProxyConfigurationMode::TRUST_NONE;
}
if (in_array('*', $configValue)) {
- return TrustProxyConfigurationMode::TrustAll;
+ return TrustProxyConfigurationMode::TRUST_ALL;
}
- return TrustProxyConfigurationMode::TrustSome;
+ return TrustProxyConfigurationMode::TRUST_SOME;
}
}

File Metadata

Mime Type
text/x-diff
Expires
Sun, Nov 24, 23:57 (14 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2259232
Default Alt Text
(2 KB)

Event Timeline