Sha256: e2b022f28ed4981071a41b20df19f4edbc4f2da44dca15f43b12de10df6f5826
Contents?: true
Size: 570 Bytes
Versions: 6
Compression:
Stored size: 570 Bytes
Contents
module PansophyAuthenticator class Matcher def initialize(keys, application) @keys = keys @application = application end def validate!(given_key) fail Error, 'Invalid application or key' unless valid?(given_key) end def valid?(given_key) return false unless valid_application? given_key == key end def key fail Error, "#{@application} is not defined" unless valid_application? @keys.fetch(@application) end def valid_application? @keys.key?(@application) end end end
Version data entries
6 entries across 6 versions & 1 rubygems