Sha256: c2681c05da262dd257948728581b219ed5307b3dc77f2d07639ffecc654ffd9e

Contents?: true

Size: 766 Bytes

Versions: 25

Compression:

Stored size: 766 Bytes

Contents

module ResoTransport
  module Authentication
    # This base class defines the basic interface support by all client authentication implementations.
    class AuthStrategy
      attr_reader :access

      # @abstract Perform requests to authenticate the client with the API
      # @return [Access] The access token object
      def authenticate(*)
        raise NotImplementedError, 'Implement me!'
      end

      # Ensure that a valid access token is present or raise an exception
      # @raise [ResoWebApi::Errors::AccessDenied] If authentication fails
      def ensure_valid_access!
        @access = authenticate unless access && access.valid?
        access
      end

      # Resets access
      def reset
        @access = nil
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
reso_transport-2.0.0 lib/reso_transport/authentication/auth_strategy.rb
reso_transport-1.5.19 lib/reso_transport/authentication/auth_strategy.rb
reso_transport-1.5.18 lib/reso_transport/authentication/auth_strategy.rb
reso_transport-1.5.17 lib/reso_transport/authentication/auth_strategy.rb
reso_transport-1.5.16 lib/reso_transport/authentication/auth_strategy.rb
reso_transport-1.5.15 lib/reso_transport/authentication/auth_strategy.rb
reso_transport-1.5.14 lib/reso_transport/authentication/auth_strategy.rb
reso_transport-1.5.13 lib/reso_transport/authentication/auth_strategy.rb
reso_transport-1.5.12 lib/reso_transport/authentication/auth_strategy.rb
reso_transport-1.5.11 lib/reso_transport/authentication/auth_strategy.rb
reso_transport-1.5.9 lib/reso_transport/authentication/auth_strategy.rb
reso_transport-1.5.8 lib/reso_transport/authentication/auth_strategy.rb
reso_transport-1.5.7 lib/reso_transport/authentication/auth_strategy.rb
reso_transport-1.5.5 lib/reso_transport/authentication/auth_strategy.rb
reso_transport-1.5.4 lib/reso_transport/authentication/auth_strategy.rb
reso_transport-1.5.3 lib/reso_transport/authentication/auth_strategy.rb
reso_transport-1.5.2 lib/reso_transport/authentication/auth_strategy.rb
reso_transport-1.5.1 lib/reso_transport/authentication/auth_strategy.rb
reso_transport-1.4.0 lib/reso_transport/authentication/auth_strategy.rb
reso_transport-1.3.2 lib/reso_transport/authentication/auth_strategy.rb