module Restforce::Concerns::Authentication
def authenticate!
def authenticate! raise AuthenticationError, 'No authentication middleware present' unless authentication_middleware middleware = authentication_middleware.new nil, self, options middleware.authenticate! end
def authentication_middleware
def authentication_middleware if username_password? Restforce::Middleware::Authentication::Password elsif oauth_refresh? Restforce::Middleware::Authentication::Token end end
def oauth_refresh?
Internal: Returns true if oauth token refresh flow should be used for
def oauth_refresh? options[:refresh_token] && options[:client_id] && options[:client_secret] end
def username_password?
Internal: Returns true if username/password (autonomous) flow should be used for
def username_password? options[:username] && options[:password] && options[:client_id] && options[:client_secret] end