Module: Backends::Opennebula::Authn::CloudAuth::BasicCloudAuth

Defined in:
lib/backends/opennebula/authn/cloud_auth/basic_cloud_auth.rb

Instance Method Summary collapse

Instance Method Details

#do_auth(params = {}) ⇒ Object


19
20
21
22
23
24
25
26
27
# File 'lib/backends/opennebula/authn/cloud_auth/basic_cloud_auth.rb', line 19

def do_auth(params = {})
  fail Backends::Errors::AuthenticationError, 'Credentials for Basic not set!' unless params && params[:username] && params[:password]

  one_pass = get_password(params[:username], 'core')
  return nil if one_pass.blank?
  return nil unless one_pass == ::Digest::SHA1.hexdigest(params[:password])

  params[:username]
end