Sha256: ae5e7b74dc148faac0b55c22c3dd6195630f86ec64e469798e2a332ed152fe39

Contents?: true

Size: 812 Bytes

Versions: 7

Compression:

Stored size: 812 Bytes

Contents

# frozen_string_literal: true

require_relative 'auth_strategy'

module Redd
  module AuthStrategies
    # A password-based authentication scheme. Requests all scopes.
    class Script < AuthStrategy
      def initialize(client_id:, secret:, username:, password:, **kwargs)
        super(client_id: client_id, secret: secret, **kwargs)
        @username = username
        @password = password
      end

      # Perform authentication and return the resulting access object
      # @return [Access] the access token object
      def authenticate
        request_access('password', username: @username, password: @password)
      end

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
redd-0.8.8 lib/redd/auth_strategies/script.rb
redd-0.8.7 lib/redd/auth_strategies/script.rb
redd-0.8.6 lib/redd/auth_strategies/script.rb
redd-0.8.5 lib/redd/auth_strategies/script.rb
redd-0.8.4 lib/redd/auth_strategies/script.rb
redd-0.8.3 lib/redd/auth_strategies/script.rb
redd-0.8.2 lib/redd/auth_strategies/script.rb