Sha256: fb886604c3c8bb22720e07b2d1dcce1b2e19294da88bcbc8fddafb81542f4159
Contents?: true
Size: 724 Bytes
Versions: 10
Compression:
Stored size: 724 Bytes
Contents
require 'certmeister/policy/response' module Certmeister module Policy class Existing def initialize(store) is_a_store?(store) or raise ArgumentError.new("expected a fetchable store but received a #{store.class}") @store = store end def authenticate(request) if not request[:cn] Certmeister::Policy::Response.new(false, "missing cn") elsif @store.fetch(request[:cn]).nil? Certmeister::Policy::Response.new(true, nil) else Certmeister::Policy::Response.new(false, "certificate for cn already exists") end end private def is_a_store?(store) store.respond_to?(:fetch) end end end end
Version data entries
10 entries across 10 versions & 1 rubygems