lib/rails/auth/x509/middleware.rb in rails-auth-0.2.0 vs lib/rails/auth/x509/middleware.rb in rails-auth-0.3.0

- old
+ new

@@ -17,11 +17,11 @@ # @param [OpenSSL::X509::Store] truststore (optional) provide your own truststore (for e.g. CRLs) # @param [Boolean] require_cert causes middleware to raise if certs are unverified # # @return [Rails::Auth::X509::Middleware] new X509 middleware instance def initialize(app, cert_filters: {}, ca_file: nil, truststore: nil, require_cert: false, logger: nil) - fail ArgumentError, "no ca_file given" unless ca_file + raise ArgumentError, "no ca_file given" unless ca_file @app = app @logger = logger @truststore = truststore || OpenSSL::X509::Store.new.add_file(ca_file) @require_cert = require_cert @@ -55,14 +55,14 @@ if @truststore.verify(cert) log("Verified", cert) return Rails::Auth::X509::Certificate.new(cert) else log("Verify FAILED", cert) - fail CertificateVerifyFailed, "verify failed: #{subject(cert)}" if @require_cert + raise CertificateVerifyFailed, "verify failed: #{subject(cert)}" if @require_cert end end - fail CertificateVerifyFailed, "no client certificate in request" if @require_cert + raise CertificateVerifyFailed, "no client certificate in request" if @require_cert nil end def log(message, cert) @logger.debug("rails-auth: #{message} (#{subject(cert)})") if @logger