class SSHScan::Api::Authenticator
Attributes
config[R]
Public Class Methods
from_config_file(config_file)
click to toggle source
# File lib/ssh_scan_api/authenticator.rb, line 10 def self.from_config_file(config_file) opts = YAML.load_file(config_file) SSHScan::Api::Authenticator.new(opts) end
new(config = {})
click to toggle source
# File lib/ssh_scan_api/authenticator.rb, line 6 def initialize(config = {}) @config = config end
Public Instance Methods
valid_token?(token)
click to toggle source
# File lib/ssh_scan_api/authenticator.rb, line 15 def valid_token?(token) if @config["users"] @config["users"].each do |user| return true if user["token"] == token end end if @config["workers"] @config["workers"].each do |worker| return true if worker["token"] == token end end if ENV['sshscan.worker.token'] == token return true end return false end