Module: Console::Auth::Basic

Extended by:
ActiveSupport::Concern
Defined in:
app/controllers/console/auth/basic.rb

Overview

The simplest possible security strategy - this controller mixin will challenge the user with BASIC authentication, pass that information to the broker, and then cache the ticket and the user identifier in the session until the ticket expires.

Defined Under Namespace

Classes: BasicUser

Instance Method Summary collapse

Instance Method Details

#authenticate_user!Object

This method should test authentication and handle if the user is unauthenticated



39
40
41
42
43
44
45
46
47
# File 'app/controllers/console/auth/basic.rb', line 39

def authenticate_user!
  authenticate_or_request_with_http_basic(auth_realm) do |,password|
    if .present?
      @authenticated_user = BasicUser.new :login => , :password => password
    else
      raise Console::AccessDenied
    end
  end
end

#current_userObject

return the current authenticated user or nil



33
34
35
# File 'app/controllers/console/auth/basic.rb', line 33

def current_user
  @authenticated_user
end

#previously_signed_in?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'app/controllers/console/auth/basic.rb', line 53

def previously_signed_in?
  cookies[:prev_login] ? true : false
end

#user_signed_in?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'app/controllers/console/auth/basic.rb', line 49

def user_signed_in?
  not current_user.nil?
end