Class: Grack::Auth

Inherits:
Rack::Auth::Basic
  • Object
show all
Defined in:
lib/grack/auth.rb

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/grack/auth.rb', line 7

def call(env)
  @env = env
  @request = Rack::Request.new(env)
  @auth = Request.new(env)

  if not @auth.provided?
    unauthorized
  elsif not @auth.basic?
    bad_request
  else
    result = if (access = valid? and access == true)
      @env['REMOTE_USER'] = @auth.username
      @app.call(env)
    else
      if access == '404'
        render_not_found
      elsif access == '403'
        render_no_access
      else
        unauthorized
      end
    end
    result
  end
end

#valid?Boolean

method call

Returns:

  • (Boolean)


33
34
35
# File 'lib/grack/auth.rb', line 33

def valid?
  false
end