Sha256: 043c7d41c9a5224ad449769608cfc6034aeaa93c3b568c148c27121da05ddecf

Contents?: true

Size: 628 Bytes

Versions: 8

Compression:

Stored size: 628 Bytes

Contents

module ScimRails
  class ApplicationController < ActionController::API
    include ActionController::HttpAuthentication::Basic::ControllerMethods
    include ExceptionHandler
    include Response

    before_action :authorize_request

    private

    def authorize_request
      authenticate_with_http_basic do |username, password|
        authorization = AuthorizeApiRequest.new(
          searchable_attribute: username,
          authentication_attribute: password
        )
        @company = authorization.company
      end
      raise  ScimRails::ExceptionHandler::InvalidCredentials if @company.blank?
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
scim_rails-0.2.2 app/controllers/scim_rails/application_controller.rb
scim_rails-0.2.1 app/controllers/scim_rails/application_controller.rb
scim_rails-0.2.0 app/controllers/scim_rails/application_controller.rb
scim_rails-0.1.4 app/controllers/scim_rails/application_controller.rb
scim_rails-0.1.3 app/controllers/scim_rails/application_controller.rb
scim_rails-0.1.2 app/controllers/scim_rails/application_controller.rb
scim_rails-0.1.1 app/controllers/scim_rails/application_controller.rb
scim_rails-0.1.0 app/controllers/scim_rails/application_controller.rb