If HTTP_AUTHORIZATION does not exist tries to get it from
@see getallheaders() when available.

@param array $globals The Slim application Environment

@return array
489287
public static function determineHeaderAuthorization(array $globals)
    {
        $authorization = isset($globals['HTTP_AUTHORIZATION']) ? $globals['HTTP_AUTHORIZATION'] : null;
        if (empty($authorization) && function_exists('getallheaders')) {
            $headers = getallheaders();
            $headers = array_change_key_case($headers, CASE_LOWER);
            if (isset($headers['authorization'])) {
                $globals['HTTP_AUTHORIZATION'] = $headers['authorization'];
            }
        }

        return $globals;
    }
288886
public static function createFromGlobalsResolveCLIRequest(array $globals = null) : Request
    {
        $globals = static::manipulateIfCLIRequest(
            ($globals === null
                ? Uri::fixSchemeProxyFromGlobals($_SERVER)
                : $globals
            )
        );

        return static::createFromGlobals($globals);
    }
1279500
private function getPresignHeaders(array $headers)
    {
        $presignHeaders = [];
        $blacklist = $this->getHeaderBlacklist();
        foreach ($headers as $name => $value) {
            $lName = strtolower($name);
            if (!isset($blacklist[$lName])
                && $name !== self::AMZ_CONTENT_SHA256_HEADER
            ) {
                $presignHeaders[] = $lName;
            }
        }
        return $presignHeaders;
    }
728459
public function setGlobals($globals = [])
    {
        $this->server = isset($globals['server']) ? array_merge($_SERVER, $globals['server']) : $_SERVER;
        $this->get    = isset($globals['get'])    ? array_merge($_GET, $globals['get'])       : $_GET;
        $this->post   = isset($globals['post'])   ? array_merge($_POST, $globals['post'])     : $_POST;
    }
572718
@RequestMapping(value = "globals", method = RequestMethod.GET)
    public Resources<GlobalPermission> getGlobalPermissions() {
        return Resources.of(
                accountService.getGlobalPermissions(),
                uri(on(PermissionController.class).getGlobalPermissions())
        ).with("_globalRoles", uri(on(PermissionController.class).getGlobalRoles()));
    }
1324772
public static function determineAuthorization(Environment $environment)
    {
        $authorization = $environment->get('HTTP_AUTHORIZATION');
        if (!empty($authorization) || !is_callable('getallheaders')) {
            return $environment;
        }

        $headers = getallheaders();
        if (!is_array($headers)) {
            return $environment;
        }

        $headers = array_change_key_case($headers, CASE_LOWER);
        if (isset($headers['authorization'])) {
            $environment->set('HTTP_AUTHORIZATION', $headers['authorization']);
        }

        return $environment;
    }
149351
public function authHeaders(array $headers = [ ])
    {
        if (count($headers) == 0) {
            $headers = [ 'X-Application' => Auth::$appKey, 'X-Authentication' => Auth::$sessionToken ];
        }
        $this->options[ 'headers' ] = array_merge($this->options[ 'headers' ], $headers);
        return $this;
    }
826447
public function getHttpResponseHeaders($rawHeaders)
    {
        if (is_array($rawHeaders)) {
            return $this->parseArrayHeaders($rawHeaders);
        }
        return $this->parseStringHeaders($rawHeaders);
    }
947115
public static function createFromGlobals(array $globals)
    {
        $env = new \Sofi\Base\Collection($globals);
        $data = [];
        foreach ($env as $key => $value) {
            $key = strtoupper($key);
            if (isset(static::$special[$key]) || strpos($key, 'HTTP_') === 0) {
                if ($key !== 'HTTP_CONTENT_LENGTH') {
                    $data[$key] = $value;
                }
            }
        }
        return new static($data);
    }
1229375
public static function createGlobalPermissions($globalPermissions, $id)
    {
        $query = [];

        if ($globalPermissions) {
            // Create global permissions
            foreach ($globalPermissions as $globalPermissionKey => $globalPermissionValue){
                if($globalPermissionValue) {
                    $query[] = array(
                        'groupID' => $id,
                        'app' => 'global',
                        'key' => $globalPermissionKey,
                        'value' => true,
                        'ids' => null,
                        'hasAll' => false,
                    );
                }
            }
        }
        return $query;
    }
257339
public function getAuthorizationHeader($realm = null)
    {
        $first = true;
        if ($realm) {
            $out = 'OAuth realm="' . Util::urlencodeRfc3986($realm) . '"';
            $first = false;
        } else {
            $out = 'OAuth';
        }

        foreach ($this->parameters as $k => $v) {
            if (substr($k, 0, 5) != "oauth") {
                continue;
            }
            if (is_array($v)) {
                throw new Exception('Arrays not supported in headers');
            }
            $out .= ($first) ? ' ' : ',';
            $out .= Util::urlencodeRfc3986($k) .
                '="' .
                Util::urlencodeRfc3986($v) .
                '"';
            $first = false;
        }
        return $out;
    }
1295993
public function getHeaders()
    {
        $digest = Klarna::digest(
            Klarna::colon(
                $this->config['eid'],
                $this->params['currency'],
                $this->config['secret']
            )
        );

        return array(
            "Accept: {$this->accept}",
            "Authorization: xmlrpc-4.2 {$digest}"
        );
    }
1357762
private function getHeaders() {
        $headers = array('Accept-Language: '.$this->locale);
        
        if($this->user_authorization) {
            $headers[] = 'Authorization: Bearer '.$this->token;
        } else {
            $headers[] ='Authorization: Token '.$this->token;
        }
        return $headers;
    }
373521
public function refreshAuthority($inputs)
    {
        $result = $this->restCall('RefreshAuthority.json', $inputs);

        if ($result['Status'] == 100 || $result['Status'] == 101) {
            return ['Status' => 'success', 'refreshed' => true];
        } else {
            return ['Status' => 'error', 'error' => $result['Status']];
        }
    }
718281
public function getAuthorizationHeader($url, array $params, array $overrides = [])
    {
        $headers = $this->prepareHeaders('POST', $url, $params, $overrides);

        $headers = implode(',', array_map(function($name, $value){
            return sprintf('%s="%s"', $name, $value);
        }, array_keys($headers), $headers));

        return sprintf('OAuth realm="",%s', $headers);
    }
1179716
protected function getRequestHeaders()
    {
        $contentKeys = array('CONTENT_LENGTH' => true, 'CONTENT_MD5' => true, 'CONTENT_TYPE' => true);
        $headers     = array();

        foreach ($this->server as $key => $value) {
            if (strpos($key, 'HTTP_') === 0) {
                $headers[str_replace('_', '-', substr($key, 5))] = $value;
            } elseif (isset($contentKeys[$key])) {
                $headers[str_replace('_', '-', $key)] = $value;
            }
        }

        if (!isset($headers['AUTHORIZATION'])) {
            if (isset($this->server['REDIRECT_HTTP_AUTHORIZATION'])) {
                $headers['AUTHORIZATION'] = $this->server['REDIRECT_HTTP_AUTHORIZATION'];
            } elseif (isset($this->server['PHP_AUTH_USER'])) {
                $headers['AUTHORIZATION'] = 'Basic ' . base64_encode($this->server['PHP_AUTH_USER'] . ':' . (isset($this->server['PHP_AUTH_PW']) ? $this->server['PHP_AUTH_PW'] : ''));
            } elseif (isset($this->server['PHP_AUTH_DIGEST'])) {
                $headers['AUTHORIZATION'] = $this->server['PHP_AUTH_DIGEST'];
            }
        }

        return $headers;
    }
286726
@RequestMapping(value = "globals/roles", method = RequestMethod.GET)
    public Resources<GlobalRole> getGlobalRoles() {
        return Resources.of(
                rolesService.getGlobalRoles(),
                uri(on(PermissionController.class).getGlobalRoles())
        );
    }