lib/certmeister/policy/existing.rb in certmeister-1.0.0 vs lib/certmeister/policy/existing.rb in certmeister-1.0.1
- old
+ new
@@ -10,10 +10,12 @@
is_a_store?(store) or raise ArgumentError.new("expected a fetchable store but received a #{store.class}")
@store = store
end
def authenticate(request)
- if @store.fetch(request[:cn]).nil?
+ 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