Class: DHS::Interceptors::AutoOauth::Interceptor
- Inherits:
-
DHC::Interceptor
- Object
- DHC::Interceptor
- DHS::Interceptors::AutoOauth::Interceptor
- Defined in:
- lib/dhs/interceptors/auto_oauth/interceptor.rb
Instance Method Summary collapse
Instance Method Details
#before_request ⇒ Object
12 13 14 |
# File 'lib/dhs/interceptors/auto_oauth/interceptor.rb', line 12 def before_request request.[:auth] = { bearer: token } end |
#token ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/dhs/interceptors/auto_oauth/interceptor.rb', line 20 def token if tokens.is_a?(Hash) tokens.dig( request.[:oauth] || request.[:record]&.auto_oauth ) else tokens end end |
#tokens ⇒ Object
16 17 18 |
# File 'lib/dhs/interceptors/auto_oauth/interceptor.rb', line 16 def tokens @tokens ||= DHS::Interceptors::AutoOauth::ThreadRegistry.access_token end |