Sha256: 655319c48dd3b4aef19bde5f89d392040bf0fdb234a03458e178450ee69ecb68

Contents?: true

Size: 788 Bytes

Versions: 1

Compression:

Stored size: 788 Bytes

Contents

# frozen_string_literal: true

module Occams::AccessControl
  module AdminAuthentication

    # Set username and password in config/initializers/occams.rb
    # Like this:
    #   Occams::AccessControl::AdminAuthentication.username = 'myname'
    #   Occams::AccessControl::AdminAuthentication.password = 'mypassword'

    mattr_accessor  :username,
                    :password

    # Simple http_auth. When implementing some other form of authentication
    # this method should return +true+ if everything is great, or redirect user
    # to some other page, thus denying access to cms admin section.
    def authenticate
      authenticate_or_request_with_http_basic do |username, password|
        self.username == username && self.password == password
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
occams-1.0.0 lib/occams/access_control/admin_authentication.rb