Sha256: bf694d154ce2262602bc91052bbaf1ca24a9252fef35c845263d251ad5ed706d

Contents?: true

Size: 787 Bytes

Versions: 49

Compression:

Stored size: 787 Bytes

Contents

module ForemanVirtWhoConfigure
  class AuthSourceHiddenWithAuthentication < ::AuthSourceHidden
    def self.default
      AuthSource.without_auditing do
        where(:name => 'HiddenWithAuthentication').first_or_create!
      end
    end

    def auth_method_name
      "HIDDEN with API access"
    end
    alias_method :to_label, :auth_method_name

    def authenticate(login, 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(login, password) : false
      Thread.current[:service_user_login] = nil
      result
    end
  end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
foreman_virt_who_configure-0.5.26 app/models/foreman_virt_who_configure/auth_source_hidden_with_authentication.rb
foreman_virt_who_configure-0.5.25 app/models/foreman_virt_who_configure/auth_source_hidden_with_authentication.rb
foreman_virt_who_configure-0.5.24 app/models/foreman_virt_who_configure/auth_source_hidden_with_authentication.rb
foreman_virt_who_configure-0.5.23 app/models/foreman_virt_who_configure/auth_source_hidden_with_authentication.rb
foreman_virt_who_configure-0.5.21 app/models/foreman_virt_who_configure/auth_source_hidden_with_authentication.rb
foreman_virt_who_configure-0.5.20 app/models/foreman_virt_who_configure/auth_source_hidden_with_authentication.rb
foreman_virt_who_configure-0.5.19 app/models/foreman_virt_who_configure/auth_source_hidden_with_authentication.rb
foreman_virt_who_configure-0.5.18 app/models/foreman_virt_who_configure/auth_source_hidden_with_authentication.rb
foreman_virt_who_configure-0.5.17 app/models/foreman_virt_who_configure/auth_source_hidden_with_authentication.rb
foreman_virt_who_configure-0.5.16 app/models/foreman_virt_who_configure/auth_source_hidden_with_authentication.rb
foreman_virt_who_configure-0.5.15 app/models/foreman_virt_who_configure/auth_source_hidden_with_authentication.rb
foreman_virt_who_configure-0.5.14 app/models/foreman_virt_who_configure/auth_source_hidden_with_authentication.rb
foreman_virt_who_configure-0.5.13 app/models/foreman_virt_who_configure/auth_source_hidden_with_authentication.rb
foreman_virt_who_configure-0.5.12 app/models/foreman_virt_who_configure/auth_source_hidden_with_authentication.rb
foreman_virt_who_configure-0.5.11 app/models/foreman_virt_who_configure/auth_source_hidden_with_authentication.rb
foreman_virt_who_configure-0.5.10 app/models/foreman_virt_who_configure/auth_source_hidden_with_authentication.rb
foreman_virt_who_configure-0.5.9 app/models/foreman_virt_who_configure/auth_source_hidden_with_authentication.rb
foreman_virt_who_configure-0.5.8 app/models/foreman_virt_who_configure/auth_source_hidden_with_authentication.rb
foreman_virt_who_configure-0.5.7 app/models/foreman_virt_who_configure/auth_source_hidden_with_authentication.rb
foreman_virt_who_configure-0.5.6 app/models/foreman_virt_who_configure/auth_source_hidden_with_authentication.rb