more flexible authenticated query .. on handler, and not anymore on context object
This commit is contained in:
@@ -42,7 +42,7 @@ feature -- Execution
|
|||||||
do
|
do
|
||||||
if not rescued then
|
if not rescued then
|
||||||
if request_method_name_supported (req.request_method) then
|
if request_method_name_supported (req.request_method) then
|
||||||
if authentication_required (req) and then not ctx.authenticated then
|
if authentication_required (req) and then not authenticated (ctx) then
|
||||||
execute_unauthorized (ctx, req, res)
|
execute_unauthorized (ctx, req, res)
|
||||||
else
|
else
|
||||||
pre_execute (ctx, req, res)
|
pre_execute (ctx, req, res)
|
||||||
@@ -84,6 +84,14 @@ feature -- Execution
|
|||||||
res.write_string ("Unauthorized")
|
res.write_string ("Unauthorized")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
feature -- Auth
|
||||||
|
|
||||||
|
authenticated (ctx: C): BOOLEAN
|
||||||
|
-- Is authenticated?
|
||||||
|
do
|
||||||
|
--| To redefine if needed
|
||||||
|
end
|
||||||
|
|
||||||
feature {NONE} -- Implementation
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
supported_formats: INTEGER
|
supported_formats: INTEGER
|
||||||
|
|||||||
@@ -54,17 +54,6 @@ feature -- Status report
|
|||||||
result_attached: Result /= Void
|
result_attached: Result /= Void
|
||||||
end
|
end
|
||||||
|
|
||||||
authenticated: BOOLEAN
|
|
||||||
do
|
|
||||||
if request.http_authorization /= Void then
|
|
||||||
Result := True
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
authenticated_identifier: detachable READABLE_STRING_32
|
|
||||||
do
|
|
||||||
end
|
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
|
|||||||
Reference in New Issue
Block a user