Sha256: a5e61b360dac3b391f4b3e767c8cfc717751c4d43edfd6bf332879d4553ed4db

Contents?: true

Size: 504 Bytes

Versions: 7

Compression:

Stored size: 504 Bytes

Contents

module RailsSso
  class FailureApp < ::ActionController::Metal
    include ActionController::Redirecting
    include RailsSso::Engine.routes.url_helpers

    def self.call(env)
      @respond ||= action(:respond)
      @respond.call(env)
    end

    def respond
      if request.content_type == 'application/json'
        self.status = :unauthorized
        self.content_type = request.content_type
        self.response_body = ''
      else
        redirect_to sign_in_path
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rails_sso-0.7.4 lib/rails_sso/failure_app.rb
rails_sso-0.7.3 lib/rails_sso/failure_app.rb
rails_sso-0.7.2 lib/rails_sso/failure_app.rb
rails_sso-0.7.1 lib/rails_sso/failure_app.rb
rails_sso-0.7.0 lib/rails_sso/failure_app.rb
rails_sso-0.6.1 lib/rails_sso/failure_app.rb
rails_sso-0.6.0 lib/rails_sso/failure_app.rb