From cdcfa5599d981a29393bebef2b831eda5287d6a8 Mon Sep 17 00:00:00 2001 From: Matt Pestritto Date: Tue, 17 Nov 2015 12:36:37 -0500 Subject: [PATCH] ssl support. --- app/controllers/swagger_engine/application_controller.rb | 5 +++++ lib/swagger_engine/engine.rb | 2 ++ 2 files changed, 7 insertions(+) diff --git a/app/controllers/swagger_engine/application_controller.rb b/app/controllers/swagger_engine/application_controller.rb index 7a582fe..bbbe2c3 100644 --- a/app/controllers/swagger_engine/application_controller.rb +++ b/app/controllers/swagger_engine/application_controller.rb @@ -3,6 +3,11 @@ class ApplicationController < ActionController::Base before_filter :authenticate + force_ssl if: :require_ssl + def require_ssl + SwaggerEngine.configuration.force_ssl || false + end + protected def authenticate if SwaggerEngine.configuration.admin_username diff --git a/lib/swagger_engine/engine.rb b/lib/swagger_engine/engine.rb index 45b8d2a..8d3120b 100644 --- a/lib/swagger_engine/engine.rb +++ b/lib/swagger_engine/engine.rb @@ -19,6 +19,8 @@ class Configuration attr_accessor :oauth_app_name attr_accessor :oauth_realm attr_accessor :oauth_redirect_url + + attr_accessor :force_ssl end class << self attr_writer :configuration