Module: Xenon::Routing::SecurityDirectives
Instance Method Summary
collapse
#complete, #extract, #extract_request, #fail, #map_request, #map_response, #reject
Instance Method Details
#authenticate(authenticator) ⇒ Object
8
9
10
11
12
13
14
15
16
|
# File 'lib/xenon/routing/security_directives.rb', line 8
def authenticate(authenticator)
(authenticator) do |user|
if user
yield user
else
reject :unauthorized, { scheme: authenticator.scheme }.merge(authenticator.auth_params)
end
end
end
|
#authorize(check) ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/xenon/routing/security_directives.rb', line 24
def authorize(check)
if check.respond_to?(:call)
(check) do |authorized|
authorize(authorized) do
yield
end
end
elsif check
yield
else
reject :forbidden
end
end
|
#optional_authenticate(authenticator) ⇒ Object
18
19
20
21
22
|
# File 'lib/xenon/routing/security_directives.rb', line 18
def optional_authenticate(authenticator)
(authenticator) do |user|
yield user
end
end
|