Module: Sorcery::Controller::Submodules::HttpBasicAuth

Defined in:
lib/sorcery/controller/submodules/http_basic_auth.rb

Overview

This submodule integrates HTTP Basic authentication into sorcery. You are provided with a before action, require_login_from_http_basic, which requests the browser for authentication. Then the rest of the submodule takes care of logging the user in into the session, so that the next requests will keep him logged in.

Defined Under Namespace

Modules: InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/sorcery/controller/submodules/http_basic_auth.rb', line 10

def self.included(base)
  base.send(:include, InstanceMethods)
  Config.module_eval do
    class << self
      attr_accessor :controller_to_realm_map # What realm to display for which controller name.

      def merge_http_basic_auth_defaults!
        @defaults.merge!(:@controller_to_realm_map => { 'application' => 'Application' })
      end
    end
    merge_http_basic_auth_defaults!
  end

  Config. << :login_from_basic_auth
end