module WSOC::Helpers::Authentication
Public Instance Methods
protected!(&block)
click to toggle source
Protects an action by requiring HTTP Basic Access Authentication
.
@yield []
If a block is given, it will be called if the client is authenticated.
@since 0.1.1
# File lib/wsoc/helpers/authentication.rb, line 34 def protected!(&block) if authorized? block.call() if block else response['WWW-Authenticate'] = %(Basic realm="HTTP Auth Test") throw :halt, [401, "Not authorized\n"] end end