test/lib/testhelper/auth.rb
def rw_credentials_from_keychain(kind)
      Keychain.user_interaction_allowed = true
      unlock_keychain
      label = KEYCHAIN_LABELS[kind]
      raise JSS::InvalidDataError, "argument must be one of :#{RW_CREDENTIAL_KINDS.join ', :'}" unless label

      pw_search = { label: label }
      pw_item = Keychain.default.internet_passwords.where(pw_search).first

      return nil unless pw_item

      { server: pw_item.server, user: pw_item.account, pw: pw_item.password, port: pw_item.port }
    end
# Fetch read-write credentials from the login keychain
#
# If the login keychain is locked, the user will be prompted
# to unlock it in the GUI.
#
# @param kind[Symbol] which kind of credentials? :jss, :db, or :dist
#
# @return [Hash{Symbol => String}, nil] A Hash with :server, :user and :password
#   values, nil if no matching keychain item.
#
Fetch read-write credentials from the login keychain
If the login keychain is locked, the user will be prompted
to unlock it in the GUI.
Fetch read - write credentials from the login keychain If the login keychain is locked the user will be prompted to unlock it in the GUI .
def rw_credentials_from_keychain(kind)
      Keychain.user_interaction_allowed = true
      unlock_keychain
      label = KEYCHAIN_LABELS[kind]
      raise JSS::InvalidDataError, "argument must be one of :#{RW_CREDENTIAL_KINDS.join ', :'}" unless label
      pw_search = { label: label }
      pw_item = Keychain.default.internet_passwords.where(pw_search).first
      return nil unless pw_item
      { server: pw_item.server, user: pw_item.account, pw: pw_item.password, port: pw_item.port }
    end
def rw_credentials_from_keychain ( kind ) Keychain . user_interaction_allowed = true unlock_keychain label = KEYCHAIN_LABELS [ kind ] raise JSS :: InvalidDataError , "argument must be one of :#{RW_CREDENTIAL_KINDS.join ', :'}" unless label pw_search = { label : label } pw_item = Keychain . default . internet_passwords . where ( pw_search ) . first return nil unless pw_item { server : pw_item . server , user : pw_item . account , pw : pw_item . password , port : pw_item . port } end
Fetch read-write credentials from the login keychain
If the login keychain is locked, the user will be prompted
to unlock it in the GUI.
Fetch read - write credentials from the login keychain If the login keychain is locked the user will be prompted to unlock it in the GUI .
A Hash with :server, :user and :password values, nil if no matching keychain item.
A Hash with : server : user and : password values nil if no matching keychain item .
Hash{Symbol => String}, nil
kind
which kind of credentials. :jss, :db, or :dist
which kind of credentials . : jss : db or : dist