The parameters from the Authorization header (only).  If the
        Authorization header is not present or is not an AWS SigV4 header, an
        AttributeError exception is raised.
3038
def authorization_header_parameters(self):
        
        result = getattr(self, "_authorization_header_parameters", None)
        if result is None:
            auth = self.headers.get(_authorization)
            if auth is None:
                raise AttributeError("Authorization header is not present")
            
            if not auth.startswith(AWS4_HMAC_SHA256 + " "):
                raise AttributeError("Authorization header is not AWS SigV4")

            result = {}
            for parameter in auth[len(AWS4_HMAC_SHA256)+1:].split(","):
                parameter = parameter.strip()
                try:
                    key, value = parameter.split("=", 1)
                except ValueError:
                    raise AttributeError(
                        "Invalid Authorization header: missing '='")

                if key in result:
                    raise AttributeError(
                        "Invalid Authorization header: duplicate key %r" % key)
                
                result[key] = value
            
            self._authorization_header_parameters = result
        return result
155793
def request_headers(self, request):
        
        headers = {}

        allow_origin = self.allow_origin(request)
        if allow_origin:
            headers = dict_filter({
                'Access-Control-Allow-Origin': allow_origin,
                'Access-Control-Allow-Credentials': {True: 'true', False: 'false'}.get(self.allow_credentials),
                'Access-Control-Expose-Headers': ', '.join(self.expose_headers) if self.expose_headers else None,
            })

        return headers
1244440
def userParamFromDict(attributes):
    
    keys = ['name', 'value', 'unitAccession', 'type']
    return tuple(attributes[key] if key in attributes else None for key in keys)
450027
function authorizationHeaderParams (data) {
  var keys = Object.keys(data).sort()
  var encoded = ''

  keys.forEach(function (key, i) {
    encoded += key
    encoded += '="'
    encoded += encodeOAuthData(data[key])
    encoded += '"'
    if (i < keys.length - 1) {
      encoded += ', '
    }
  })

  return encoded
}
813616
private Map<String, String> getHttpHeaderBasic() throws Exception {
        
        return new HashMap<String, String>(){{
            put("Authorization", "Basic " + getHttpHeaderBasicKey());
        }};
    }
908
def session_hook(exception):
    
    safeprint(
        "The resource you are trying to access requires you to "
        "re-authenticate with specific identities."
    )

    params = exception.raw_json["authorization_parameters"]
    message = params.get("session_message")
    if message:
        safeprint("message: {}".format(message))

    identities = params.get("session_required_identities")
    if identities:
        id_str = " ".join(identities)
        safeprint(
            "Please run\n\n"
            "    globus session update {}\n\n"
            "to re-authenticate with the required identities".format(id_str)
        )
    else:
        safeprint(
            'Please use "globus session update" to re-authenticate '
            "with specific identities".format(id_str)
        )

    exit_with_mapped_status(exception.http_status)
235862
def _get_credentials(self, request):
        
        authorization = request.headers.get('Authorization')
        if not authorization:
            return None
        try:
            authmeth, authbytes = authorization.split(' ', 1)
        except ValueError:  # not enough values to unpack
            return None
        if authmeth.lower() != 'apikey':
            return None

        if six.PY2 or isinstance(authbytes, bytes):
            try:
                auth = authbytes.decode('utf-8')
            except UnicodeDecodeError:
                auth = authbytes.decode('latin-1')
        else:
            auth = authbytes

        try:
            username, api_key = auth.split(':', 1)
        except ValueError:  # not enough values to unpack
            return None
        return username, api_key
81291
def access_key(self):
        
        credential = self.query_parameters.get(_x_amz_credential)
        if credential is not None:
            credential = url_unquote(credential[0])
        else:
            credential = self.authorization_header_parameters.get(_credential)

            if credential is None:
                raise AttributeError("Credential was not passed in the request")
        try:
            key, scope = credential.split("/", 1)
        except ValueError:
            raise AttributeError("Invalid request credential: %r" % credential)

        if scope != self.credential_scope:
            raise AttributeError("Incorrect credential scope: %r (wanted %r)" %
                                 (scope, self.credential_scope))

        return key
1021366
def validate_authorization_request(self, uri, http_method='GET', body=None,
                                       headers=None):
        """"""
        request = Request(
            uri, http_method=http_method, body=body, headers=headers)

        request.scopes = utils.scope_to_list(request.scope)

        response_type_handler = self.response_types.get(
            request.response_type, self.default_response_type_handler)
        return response_type_handler.validate_authorization_request(request)
228462
def get_access_token(self, request):
        
        header = authentication.get_authorization_header(request)
        if not header:
            return None
        header = header.decode(authentication.HTTP_HEADER_ENCODING)

        auth = header.split()

        if auth[0].lower() != 'bearer':
            return None

        if len(auth) == 1:
            msg = 'Invalid "bearer" header: No credentials provided.'
            raise exceptions.AuthenticationFailed(msg)
        elif len(auth) > 2:
            msg = 'Invalid "bearer" header: Credentials string should not contain spaces.'
            raise exceptions.AuthenticationFailed(msg)

        return auth[1]
351531
protected void initAuthenticationHeader() {
        if (isAuthenticated()) {
            // Calculate the v2 signature
            // http://docs.amazonwebservices.com/AmazonS3/latest/dev/RESTAuthentication.html
            // #ConstructingTheAuthenticationHeader

            // Date should look like Thu, 17 Nov 2005 18:49:58 GMT, and must be
            // within 15 min. of S3 server time. contentMd5 and type are optional

            // We can't risk letting our date get clobbered and being inconsistent
            final String xamzdate = new SimpleDateFormat(DATE_FORMAT, Locale.US).format(new Date());
            final StringJoiner signedHeaders = new StringJoiner(EOL, "", EOL);
            final StringBuilder toSign = new StringBuilder();
            final String key = myKey.charAt(0) == '?' ? "" : myKey;

            headers().add("X-Amz-Date", xamzdate);
            signedHeaders.add("x-amz-date:" + xamzdate);

            if (!StringUtils.isEmpty(mySessionToken)) {
                headers().add("X-Amz-Security-Token", mySessionToken);
                signedHeaders.add("x-amz-security-token:" + mySessionToken);
            }

            toSign.append(myMethod).append(EOL).append(myContentMd5).append(EOL).append(myContentType).append(EOL)
                    .append(EOL).append(signedHeaders).append(PATH_SEP).append(myBucket).append(PATH_SEP).append(key);

            try {
                final String signature = b64SignHmacSha1(mySecretKey, toSign.toString());
                final String authorization = "AWS" + " " + myAccessKey + ":" + signature;

                headers().add("Authorization", authorization);
            } catch (InvalidKeyException | NoSuchAlgorithmException details) {
                LOGGER.error("Failed to sign S3 request due to {}", details);
            }
        }
    }
1089352
def parse_authorization_header(value, charset='utf-8'):
    '''
    '''
    if not value:
        return
    try:
        auth_type, auth_info = value.split(None, 1)
        auth_type = auth_type.lower()
    except ValueError:
        return
    if auth_type == 'basic':
        try:
            up = b64decode(auth_info.encode(CHARSET)).decode(charset)
            username, password = up.split(':', 1)
        except Exception:
            return
        return BasicAuth(username, password)
    elif auth_type == 'digest':
        auth_map = parse_dict_header(auth_info)
        if not digest_parameters.difference(auth_map):
            return DigestAuth(auth_map.pop('username'), options=auth_map)
1352501
def get_header(self, request):
        
        header = request.META.get('HTTP_AUTHORIZATION')

        if isinstance(header, str):
            # Work around django test client oddness
            header = header.encode(HTTP_HEADER_ENCODING)

        return header
1029753
def headers(self, url):
        
        if self._token and url.lower().startswith('https'):
            return {'Authorization': 'Bearer {}'.format(self._token)}
        else:
            return None
640644
def authorization_header(oauth_params):
        """"""
        authorization_headers = 'OAuth realm="",'
        authorization_headers += ','.join(['{0}="{1}"'.format(k, urllib.quote(str(v)))
            for k, v in oauth_params.items()])
        return authorization_headers
901086
def parse_attr_signature(sig):
    
    match = ATTR_SIG_RE.match(sig.strip())
    if not match:
        raise RuntimeError('Attribute signature invalid, got ' + sig)
    name, _, params = match.groups()
    if params is not None and params.strip() != '':
        params = split_sig(params)
        params = [parse_param_signature(x) for x in params]
    else:
        params = []
    return (name, params)
213121
def parse_auth(header):
    
    try:
        method, data = header.split(None, 1)
        if method.lower() == 'basic':
            data = base64.b64decode(uniorbytes(data, bytes))
            user, pwd = uniorbytes(data).split(':', 1)
            return user, pwd
    except (KeyError, AttributeError, ValueError):
        return (None, None)