Module: Sinatra::BasicAuth::Helpers

Defined in:
lib/sinatra/basic_auth.rb

Instance Method Summary collapse

Instance Method Details

#authObject



14
15
16
# File 'lib/sinatra/basic_auth.rb', line 14

def auth
  @auth ||= Rack::Auth::Basic::Request.new(request.env)
end

#authorized?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/sinatra/basic_auth.rb', line 18

def authorized?
  request.env[REALM_ENV % realm] != nil
end

#realmObject



22
23
24
# File 'lib/sinatra/basic_auth.rb', line 22

def realm
  @realm
end