Returns the value for authorization header
        Args:
            user_payload(dict, required): A `dict` containing required information
                to create authentication token
976269
def get_auth_header(self, user_payload):
        
        auth_token = self.get_auth_token(user_payload)
        return '{auth_header_prefix} {auth_token}'.format(
            auth_header_prefix=self.auth_header_prefix, auth_token=auth_token
        )
814646
def get_api_key(required_role: Roles::PUBLIC)
        api_key = params[:api_key]
        if api_key.nil?
          # This case is not likely, but as a safeguard in case migration
          # has not gone well.
          # :nocov:
          raise UNAUTHORIZED_ERROR, "Invalid api key"
          # :nocov:
        end
        auth_user = User.find_by_api_key(api_key)
        if auth_user.nil? || auth_user.role < required_role
          raise UNAUTHORIZED_ERROR, "Invalid api key"
        end
        @auth_user = auth_user
        @auth_session = nil
        @token = nil
        return true
      end
546313
def get_authorization_header(request):
    
    auth = request.META.get('HTTP_AUTHORIZATION', b'')

    if isinstance(auth, type('')):
        # Work around django test client oddness
        auth = auth.encode('iso-8859-1')

    return auth
723673
def create_user(self, username, first_name=None, last_name=None):
		
		
		url = api_url+'users/'
		payload = {
			'username':username
		}
		if first_name:
			payload['first_name'] = first_name
		if last_name:
			payload['last_name'] = last_name
		r = requests.post(url, data=json.dumps(payload), headers=self.headers)
		print(request_status(r))
		r.raise_for_status()
		return User(r.json())
410941
def jwt_get_secret_key(payload=None):
    
    User = get_user_model()  # noqa
    if api_settings.JWT_GET_USER_SECRET_KEY:
        user = User.objects.get(pk=payload.get('user_id'))
        key = str(api_settings.JWT_GET_USER_SECRET_KEY(user))
        return key

    return api_settings.JWT_SECRET_KEY
540912
def authenticated(self, user_token, **validation_context):
        
        token = self.token_storage.get(user_token)
        if token and token.validate(user_token, **validation_context):
            return True

        return False
264743
def get_user(self):
        

        return self.parse_raw_response(requests_util.run_request('get', self.API_BASE_URL + '/user',
                                                                 headers=self.__get_header_with_auth()))
863396
def get_token(self, user_id):
        
        if not self.jwt_implementation:
            return self.default_token_implementation(user_id)

        try:
            implementation = import_string(self.jwt_implementation)
        except ImportError:
            msg = 'Failed to import custom JWT implementation. '
            msg += 'Check that configured module exists [{}]'
            raise x.ConfigurationException(msg.format(self.jwt_implementation))

        # return custom token
        return implementation(user_id)
412563
def get_authorization_user(self, **kwargs):
        """"""
        if self.authorization_user is not None:
            return self.authorization_user

        self.authorization_user = self.request.user
        return self.request.user
406095
def userinfo_request(self, access_token):
        
        http_method = self._provider_configuration.userinfo_endpoint_method
        if http_method is None or not self._client.userinfo_endpoint:
            return None

        logger.debug('making userinfo request')
        userinfo_response = self._client.do_user_info_request(method=http_method, token=access_token)
        logger.debug('received userinfo response: %s', userinfo_response.to_json())

        return userinfo_response
35349
def get_user_by_auth_token(token=None):
    
    if not token:
        token = request.get_auth_token()
    secret_key = get_jwt_secret()
    s = utils.unsign_jwt(token=token,
                         secret_key=secret_key,
                         salt=get_jwt_salt())
    if "id" not in s:
        raise exceptions.AuthError("Invalid Authorization Bearer Token")
    return get_user_by_id(int(s["id"]))
868288
def authenticate_credentials(self, token: bytes, request=None):
        
        user = AuthToken.get_user_for_token(token)

        if user is None:
            raise AuthenticationFailed(_('Invalid auth token.'))

        if not user.is_active:
            raise AuthenticationFailed(_('User inactive or deleted.'))

        return user, token
332445
def get_user(self, user):
        
        self.project_service.set_auth(self._token_project)
        return self.project_service.get_user(user)
378790
def do_get(endpoint, access_token):
    '''
    '''
    headers = {"Authorization": 'Bearer ' + access_token}
    headers['User-Agent'] = get_user_agent()
    return requests.get(endpoint, headers=headers).json()
1046814
def parse_auth_token_from_request(self, auth_header):
        
        if not auth_header:
            raise falcon.HTTPUnauthorized(
                description='Missing Authorization Header')

        parts = auth_header.split()

        if parts[0].lower() != self.auth_header_prefix.lower():
            raise falcon.HTTPUnauthorized(
                description='Invalid Authorization Header: '
                            'Must start with {0}'.format(self.auth_header_prefix))

        elif len(parts) == 1:
            raise falcon.HTTPUnauthorized(
                description='Invalid Authorization Header: Token Missing')
        elif len(parts) > 2:
            raise falcon.HTTPUnauthorized(
                description='Invalid Authorization Header: Contains extra content')

        return parts[1]
1190684
public function updateUserAsyncWithHttpInfo($user_id, $payload_account)
    {
        $returnType = '';
        $request = $this->updateUserRequest($user_id, $payload_account);

        return $this->client
            ->sendAsync($request, $this->createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    return [null, $response->getStatusCode(), $response->getHeaders()];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();
                    throw new ApiException(
                        sprintf(
                            '[%d] Error connecting to the API (%s)',
                            $statusCode,
                            $exception->getRequest()->getUri()
                        ),
                        $statusCode,
                        $response->getHeaders(),
                        $response->getBody()
                    );
                }
            );
    }
638361
function __process_authorization_header_for_user(request_params) {
    return new Promise(async (resolve, reject) => {
        try {
            const user_account_id = await user_info_endpoint
                .user_account_registrar_module
                .get_user_account_id_for_credentials(request_params.authorization_credentials.username, request_params.authorization_credentials.password);
            return resolve(request_params);
        } catch (err) {
            return reject(err);
        }
    });
}