Sha256: e81c761ed819f152ace4ab3d03377c8719f4060685ecab6ac9f463a46fac9005

Contents?: true

Size: 729 Bytes

Versions: 4

Compression:

Stored size: 729 Bytes

Contents

# frozen_string_literal: true

require_relative 'auth_strategy'

module Redd
  module AuthStrategies
    # A userless authentication scheme.
    class Userless < AuthStrategy
      # Perform authentication and return the resulting access object
      # @return [Access] the access token object
      def authenticate
        request_access('client_credentials')
      end

      # Since the access isn't used for refreshing, the strategy is inherently
      # refreshable.
      # @return [true]
      def refreshable?(_access)
        true
      end

      # Refresh the authentication and return the refreshed access
      # @return [Access] the new access
      def refresh(_)
        authenticate
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
spinels-redd-0.9.0 lib/redd/auth_strategies/userless.rb
redd-0.9.0.pre.3 lib/redd/auth_strategies/userless.rb
redd-0.9.0.pre.2 lib/redd/auth_strategies/userless.rb
redd-0.9.0.pre.1 lib/redd/auth_strategies/userless.rb