Normal invoke with authentication. Credentials are required and may be overriden at the request level.
345915
private <X, Y extends AmazonWebServiceRequest> Response<X> invoke(Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
            ExecutionContext executionContext, URI cachedEndpoint, URI uriFromEndpointTrait) {

        executionContext.setCredentialsProvider(CredentialUtils.getCredentialsProvider(request.getOriginalRequest(), awsCredentialsProvider));

        return doInvoke(request, responseHandler, executionContext, cachedEndpoint, uriFromEndpointTrait);
    }
1055000
def do_authenticated_request(method, url, options = {})
      begin
        response = case client
                   when BasicAuthClient
                     self.class.send(method, api_url(url), options.merge(:basic_auth => client.credentials))
                   when OauthClient
                     # We have to wrap the result of the access_token request into an HTTParty::Response object
                     # to keep duck typing with HTTParty
                     result = client.send(method, api_url(url), options)
                     content_type = Parser.format_from_mimetype(result.content_type)
                     parsed_response = Parser.call(result.body, content_type)

                     HTTParty::Response.new(nil, result, lambda { parsed_response })
                   else
                     raise CredentialsMissing
                   end
        check_response_codes(response)
        response.parsed_response
      rescue Timeout::Error
        raise Unavailable.new('Service Unavailable')
      end
    end
1006387
def _authenticate(self, request):
        

        def ensure_user_obj():
            """ Make sure that request object has user property.

            If `request.user` is not present or is `None`, it is
            created and initialized with `AnonymousUser`.
            """

            try:
                if request.user:
                    return
            except AttributeError:
                pass

            request.user = AnonymousUser()

        def anonymous_access(exc_obj):
            """ Determine what to do with unauthenticated requests.

            If the request has already been authenticated, does
            nothing.

            :param exc_obj: exception object to be thrown if anonymous
            access is not permitted.
            """

            if request.user and request.user.is_authenticated():
                # request is already authenticated
                pass
            elif self.allow_anonymous:
                request.user = AnonymousUser()
            else:
                raise exc_obj

        # first, make sure that the request carries `user` attribute
        ensure_user_obj()
        if self.authentication:
            # authentication handler is configured
            try:
                self.authentication.authenticate(request)
            except errors.Unauthorized, exc:
                # http request doesn't carry any authentication information
                anonymous_access(exc)
        else:
            # no authentication configured
            anonymous_access(errors.Forbidden())
110560
def basic(request, response, verify_user, realm='simple', context=None, **kwargs):
    """"""
    http_auth = request.auth
    response.set_header('WWW-Authenticate', 'Basic')
    if http_auth is None:
        return

    if isinstance(http_auth, bytes):
        http_auth = http_auth.decode('utf8')
    try:
        auth_type, user_and_key = http_auth.split(' ', 1)
    except ValueError:
        raise HTTPUnauthorized('Authentication Error',
                               'Authentication header is improperly formed',
                               challenges=('Basic realm="{}"'.format(realm), ))

    if auth_type.lower() == 'basic':
        try:
            user_id, key = base64.decodebytes(bytes(user_and_key.strip(), 'utf8')).decode('utf8').split(':', 1)
            try:
                user = verify_user(user_id, key)
            except TypeError:
                user = verify_user(user_id, key, context)
            if user:
                response.set_header('WWW-Authenticate', '')
                return user
        except (binascii.Error, ValueError):
            raise HTTPUnauthorized('Authentication Error',
                                   'Unable to determine user and password with provided encoding',
                                   challenges=('Basic realm="{}"'.format(realm), ))
    return False
1073018
protected AuthenticationHandlerExecutionResult finalizeAuthenticationHandlerResult(final ClientCredential credentials,
                                                                                       final Principal principal,
                                                                                       final UserProfile profile,
                                                                                       final BaseClient client) {
        preFinalizeAuthenticationHandlerResult(credentials, principal, profile, client);
        return createHandlerResult(credentials, principal, new ArrayList<>(0));
    }
1028598
def authenticate(self, request):
        
        auth = get_authorization_header(request).split()

        if not auth or auth[0].lower() != b'token':
            return None

        if len(auth) == 1:
            msg = _('Invalid auth token header. No credentials provided.')
            raise AuthenticationFailed(msg)
        elif len(auth) > 2:
            msg = _('Invalid auth token.')
            raise AuthenticationFailed(msg)

        try:
            token = urlsafe_b64decode(auth[1])
        except ValueError:
            msg = _('Invalid auth token.')
            raise AuthenticationFailed(msg)

        return self.authenticate_credentials(token, request)
117964
protected AuthenticationRiskContingencyResponse executeInternal(final Authentication authentication,
                                                                    final RegisteredService service,
                                                                    final AuthenticationRiskScore score,
                                                                    final HttpServletRequest request) {
        return null;
    }
513803
@Override
    public AuthenticationStatus authenticate(HttpServletRequest req, HttpServletResponse res, AuthenticationParameters params) {
        AuthenticationStatus authStatus = AuthenticationStatus.SEND_FAILURE;
        req.setAttribute(JavaEESecConstants.SECURITY_CONTEXT_AUTH_PARAMS, params);
        try {
            boolean result = req.authenticate(res);
            if (result) {
                authStatus = AuthenticationStatus.SUCCESS;
            } else {
//TODO some error handling.
            }
        } catch (Exception e) {
//TODO need to handle error.
            e.printStackTrace();
        }
        return authStatus;
    }
270808
def authenticate(job_args):
    

    # Load any authentication plugins as needed
    job_args = utils.check_auth_plugin(job_args)

    # Set the auth version
    auth_version = utils.get_authversion(job_args=job_args)

    # Define the base headers that are used in all authentications
    auth_headers = {
        'Content-Type': 'application/json',
        'Accept': 'application/json'
    }

    auth_headers.update(job_args['base_headers'])

    if auth_version == 'v1.0':
        auth = utils.V1Authentication(job_args=job_args)
        auth_headers.update(auth.get_headers())
        LOG.debug('Request Headers: [ %s ]', auth_headers)

        auth_url = job_args['os_auth_url']
        LOG.debug('Parsed Auth URL: [ %s ]', auth_url)

        auth_kwargs = {
            'url': auth_url,
            'headers': auth_headers
        }
    else:
        auth = utils.OSAuthentication(job_args=job_args)
        auth_url = auth.parse_region()
        LOG.debug('Parsed Auth URL: [ %s ]', auth_url)

        auth_json = auth.parse_reqtype()
        LOG.debug('Request Headers: [ %s ]', auth_headers)

        auth_body = json.dumps(auth_json)
        LOG.debug('Request JSON: [ %s ]', auth_body)

        auth_kwargs = {
            'url': auth_url,
            'headers': auth_headers,
            'body': auth_body
        }

    auth_resp = auth.auth_request(**auth_kwargs)
    if auth_resp.status_code >= 300:
        raise exceptions.AuthenticationProblem(
            'Authentication Failure, Status: [ %s ] Reason: [ %s ]',
            auth_resp.status_code,
            auth_resp.reason
        )
    else:
        return auth.parse_auth_response(auth_resp)
682500
def authenticateRequest(self, request, service_request, *args, **kwargs):
        
        username = password = None

        if 'Credentials' in request.headers:
            cred = request.headers['Credentials']

            username = cred['userid']
            password = cred['password']

        return self.gateway.authenticateRequest(service_request, username,
            password, *args, **kwargs)
90260
public AuthenticationResult authenticateRequest(WebRequest webRequest) {
        WebAuthenticator authenticator = getWebAuthenticatorProxy();
        return authenticator.authenticate(webRequest);
    }
870047
def authorized_default_handler(resp, remote, *args, **kwargs):
    
    response_token_setter(remote, resp)
    db.session.commit()
    return redirect(url_for('invenio_oauthclient_settings.index'))
1341162
def authenticate_credentials(self, userid, password, request=None):
        """"""

        user = auth.authenticate(username=userid, password=password)

        if user is None or (user and not user.is_active):
            raise exceptions.AuthenticationFailed("Invalid username/password.")

        return (user, None)
880397
def authenticate(credentials, sock_info):
    """"""
    mechanism = credentials.mechanism
    auth_func = _AUTH_MAP.get(mechanism)
    auth_func(credentials, sock_info)
504999
private Object invoke(Class<?> objClass, Object obj, String methodName, String[] argTypes,
            Object[] args, String appId, String token) throws RpcException {
        Object res;
        try {
            MethodDescriptor<String> desc = serviceLocator
                    .getServiceDescriptor(new MethodWrapper(objClass.getName(), methodName,
                            StringUtil.toString4Array(argTypes)).toString());
            if (desc == null) {
                throw new MethodNotFoundException(String.format(
                        "Service method not found. class=%s, method=%s, argTypes=%s", objClass,
                        methodName, StringUtil.toString4Array(argTypes)));
            }

            if (!isAuthoriedAccess(desc, appId, token)) {
                throw new AuthAccessDeniedException("AppId or token is not valid to access");
            }

            res = desc.getMethod().invoke(desc.getTarget(), args);
        } catch (MethodNotFoundException e1) {
            throw new InvalidParamException(e1);
        } catch (IllegalArgumentException e1) {
            throw new InvalidParamException(e1);
        } catch (IllegalAccessException e1) {
            throw new InvalidAccessException(e1);
        } catch (AuthAccessDeniedException e1) {
            throw new RpcException(e1);
        } catch (InvocationTargetException e1) {
            Throwable e2 = e1.getTargetException();
            if (e2 instanceof RpcException) {
                throw (RpcException) e2;
            } else {
                throw new ServerErrorException(e2);
            }
        }
        if (res == void.class) {
            return null;
        } else {
            return res;
        }
    }
485600
def authenticate(self, request, **credentials):
        
        username = credentials.get('username')
        password = credentials.get('password')
        login_server = credentials.get('login_server')
        port = credentials.get('port')

        user_model = get_user_model()
        try:
            user = user_model.objects.get(username=username)
        except user_model.DoesNotExist:
            return None
        try:
            response = poplib.POP3_SSL(host=login_server, port=port)
            response.user(user=username)
            password_string = response.pass_(pswd=password)
            if b'OK' in password_string:
                response.quit()
                return user
        except poplib.error_proto:
            return None
        except (ValueError, TypeError) as e:
            raise e
985258
def authenticate(api_key, api_url, **kwargs):
    """"""

    muddle = Muddle(**kwargs)

    # Login.
    muddle.authenticate(api_key, api_url)
    return muddle