Class: Redd::AuthStrategies::Userless

Inherits:
AuthStrategy show all
Defined in:
lib/redd/auth_strategies/userless.rb

Overview

A userless authentication scheme.

Constant Summary

Constants inherited from AuthStrategy

AuthStrategy::AUTH_ENDPOINT

Constants inherited from Client

Client::USER_AGENT

Instance Method Summary collapse

Methods inherited from AuthStrategy

#initialize, #revoke

Methods inherited from Client

#delete, #get, #initialize, #patch, #post, #put, #request

Constructor Details

This class inherits a constructor from Redd::AuthStrategies::AuthStrategy

Instance Method Details

#authenticateAccess

Perform authentication and return the resulting access object

Returns:

  • (Access)

    the access token object


11
12
13
# File 'lib/redd/auth_strategies/userless.rb', line 11

def authenticate
  request_access('client_credentials')
end

#refresh(_) ⇒ Access

Refresh the authentication and return the refreshed access

Returns:

  • (Access)

    the new access


24
25
26
# File 'lib/redd/auth_strategies/userless.rb', line 24

def refresh(_)
  authenticate
end

#refreshable?(_access) ⇒ true

Since the access isn't used for refreshing, the strategy is inherently refreshable.

Returns:

  • (true)

18
19
20
# File 'lib/redd/auth_strategies/userless.rb', line 18

def refreshable?(_access)
  true
end