lib/jss/api_object/distribution_point.rb
def check_pw(user, pw)
      raise JSS::InvalidDataError, 'The first parameter must be one of :ro, :rw, :ssh, :http' unless %i[ro rw ssh http].include? user

      sha256 = case user
               when :rw then @read_write_password_sha256
               when :ro then @read_only_password_sha256
               when :http then @http_password_sha256
               when :ssh then @ssh_password_sha256
      end # case

      return nil if sha256 == EMPTY_PW_256

      sha256 == Digest::SHA2.new(256).update(pw).to_s
    end
# Check the validity of a password.
#
# @param user[Symbol] one of :ro, :rw, :ssh, :http
#
# @param pw[String] the password to check for the given user
#
# @return [Boolean,Nil] was the password correct?
#   nil is returned if there is no password set in the JSS.
#
Check the validity of a password.
Check the validity of a password .
def check_pw(user, pw)
      raise JSS::InvalidDataError, 'The first parameter must be one of :ro, :rw, :ssh, :http' unless %i[ro rw ssh http].include? user
      sha256 = case user
               when :rw then @read_write_password_sha256
               when :ro then @read_only_password_sha256
               when :http then @http_password_sha256
               when :ssh then @ssh_password_sha256
      end 
      return nil if sha256 == EMPTY_PW_256
      sha256 == Digest::SHA2.new(256).update(pw).to_s
    end
def check_pw ( user , pw ) raise JSS :: InvalidDataError , 'The first parameter must be one of :ro, :rw, :ssh, :http' unless %i[ ro rw ssh http ] . include? user sha256 = case user when :rw then @read_write_password_sha256 when :ro then @read_only_password_sha256 when :http then @http_password_sha256 when :ssh then @ssh_password_sha256 end return nil if sha256 == EMPTY_PW_256 sha256 == Digest :: SHA2 . new ( 256 ) . update ( pw ) . to_s end
Check the validity of a password.
Check the validity of a password .
# case
was the password correct. nil is returned if there is no password set in the JSS.
was the password correct . nil is returned if there is no password set in the JSS .
Boolean,Nil
user
one of :ro, :rw, :ssh, :http
one of : ro : rw : ssh : http
pw
the password to check for the given user
the password to check for the given user