Class: X::BearerTokenAuthenticator
- Inherits:
-
Authenticator
- Object
- Authenticator
- X::BearerTokenAuthenticator
- Defined in:
- lib/x/bearer_token_authenticator.rb
Overview
Authenticator for Bearer token authentication
Constant Summary
Constants inherited from Authenticator
Authenticator::AUTHENTICATION_HEADER
Instance Attribute Summary collapse
-
#bearer_token ⇒ String
The bearer token for authentication.
Instance Method Summary collapse
-
#header(_request) ⇒ Hash{String => String}
Generate the authentication header for a request.
-
#initialize(bearer_token:) ⇒ BearerTokenAuthenticator
constructor
Initialize a new BearerTokenAuthenticator.
Constructor Details
#initialize(bearer_token:) ⇒ BearerTokenAuthenticator
Initialize a new BearerTokenAuthenticator
21 22 23 |
# File 'lib/x/bearer_token_authenticator.rb', line 21 def initialize(bearer_token:) @bearer_token = bearer_token end |
Instance Attribute Details
#bearer_token ⇒ String
The bearer token for authentication
12 13 14 |
# File 'lib/x/bearer_token_authenticator.rb', line 12 def bearer_token @bearer_token end |
Instance Method Details
#header(_request) ⇒ Hash{String => String}
Generate the authentication header for a request
32 33 34 |
# File 'lib/x/bearer_token_authenticator.rb', line 32 def header(_request) {AUTHENTICATION_HEADER => "Bearer #{bearer_token}"} end |