Class: VagrantPlugins::BoxS3::Urls

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-box-s3/urls.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ Urls

Returns a new instance of Urls.



7
8
9
10
# File 'lib/vagrant-box-s3/urls.rb', line 7

def initialize(app, env)
  @app = app
  @logger = Log4r::Logger.new('vagrant::plugins::box_s3')
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/vagrant-box-s3/urls.rb', line 12

def call(env)
  # Assume 'env[:box_urls]' contains the original URLs that need authentication
  original_urls = env[:box_urls]

  # Your logic to authenticate the URLs goes here
  # This is just an example, replace it with your actual authentication mechanism
  authenticated_urls = original_urls.map do |url|
    presign_url(url)
  end

  # Ensure the authenticated URLs are set back in the environment
  env[:box_urls] = authenticated_urls

  # Continue the middleware chain
  @app.call(env)
end