Module: Sinatra::AuthHelper

Defined in:
lib/deltacloud/helpers/auth_helper.rb

Defined Under Namespace

Classes: LazyCredentials

Instance Method Summary collapse

Instance Method Details

#authorize!Object



60
61
62
63
64
# File 'lib/deltacloud/helpers/auth_helper.rb', line 60

def authorize!
  r = "#{Thread.current[:driver]}-deltacloud@#{ENV['HOSTNAME']}"
  response['WWW-Authenticate'] = %(Basic realm="#{r}")
  throw(:halt, [401, report_error(401)])
end

#credentialsObject

Request the current user’s credentials. Actual credentials are only requested when an attempt is made to get the user name or password



68
69
70
# File 'lib/deltacloud/helpers/auth_helper.rb', line 68

def credentials
  LazyCredentials.new(self)
end