class DHS::Interceptors::AutoOauth::Interceptor

Public Instance Methods

before_request() click to toggle source
# File lib/dhs/interceptors/auto_oauth/interceptor.rb, line 12
def before_request
  request.options[:auth] = { bearer: token }
end
token() click to toggle source
# File lib/dhs/interceptors/auto_oauth/interceptor.rb, line 20
def token
  if tokens.is_a?(Hash)
    tokens.dig(
      request.options[:oauth] ||
      request.options[:record]&.auto_oauth
    )
  else
    tokens
  end
end
tokens() click to toggle source
# File lib/dhs/interceptors/auto_oauth/interceptor.rb, line 16
def tokens
  @tokens ||= DHS::Interceptors::AutoOauth::ThreadRegistry.access_token
end