Class: OpenAI::Providers::Bedrock::BearerAuth Private
- Inherits:
-
Object
- Object
- OpenAI::Providers::Bedrock::BearerAuth
- Defined in:
- lib/openai/providers/bedrock.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
-
#initialize(token_provider:, base_url:) ⇒ BearerAuth
constructor
private
A new instance of BearerAuth.
- #prepare_request(request) ⇒ Object private
Constructor Details
#initialize(token_provider:, base_url:) ⇒ BearerAuth
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of BearerAuth.
102 103 104 105 |
# File 'lib/openai/providers/bedrock.rb', line 102 def initialize(token_provider:, base_url:) @token_provider = token_provider @base_url = URI(base_url) end |
Instance Method Details
#prepare_request(request) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
107 108 109 110 111 112 113 114 115 116 |
# File 'lib/openai/providers/bedrock.rb', line 107 def prepare_request(request) Bedrock.validate_origin!(request.fetch(:url), @base_url, action: "authenticate") headers = Bedrock.provider_headers(request, marker: BEARER_AUTH_MARKER) token = resolve_token request.merge( headers: headers.merge("authorization" => "Bearer #{token}"), provider_auth: BEARER_AUTH_MARKER ) end |