Class: ForemanVirtWhoConfigure::AuthSourceHiddenWithAuthentication

Inherits:
AuthSourceHidden
  • Object
show all
Defined in:
app/models/foreman_virt_who_configure/auth_source_hidden_with_authentication.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.defaultObject



3
4
5
6
7
# File 'app/models/foreman_virt_who_configure/auth_source_hidden_with_authentication.rb', line 3

def self.default
  AuthSource.without_auditing do
    where(:name => 'HiddenWithAuthentication').first_or_create!
  end
end

Instance Method Details

#auth_method_nameObject Also known as: to_label



9
10
11
# File 'app/models/foreman_virt_who_configure/auth_source_hidden_with_authentication.rb', line 9

def auth_method_name
  "HIDDEN with API access"
end

#authenticate(login, password) ⇒ Object



14
15
16
17
18
19
20
# File 'app/models/foreman_virt_who_configure/auth_source_hidden_with_authentication.rb', line 14

def authenticate(, password)
  # the authentication should only happen if our SSO signals that it's available
  # we need to reset the signal since for non API calls the SSO is not used at all and does not set signal to false
  result = Thread.current[:service_user_login] ? AuthSourceInternal.new.authenticate(, password) : false
  Thread.current[:service_user_login] = nil
  result
end