From 92d8357d0933f111342fe8f1e4fc16c4df7a4683 Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Fri, 16 Sep 2011 18:55:26 +0200 Subject: [PATCH] more flexible authenticated query .. on handler, and not anymore on context object --- .../server/request/rest/src/rest_request_handler.e | 12 ++++++++++-- .../request/rest/src/rest_request_handler_context.e | 11 ----------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/library/server/request/rest/src/rest_request_handler.e b/library/server/request/rest/src/rest_request_handler.e index 086db1e6..1660f996 100644 --- a/library/server/request/rest/src/rest_request_handler.e +++ b/library/server/request/rest/src/rest_request_handler.e @@ -42,7 +42,7 @@ feature -- Execution do if not rescued 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) else pre_execute (ctx, req, res) @@ -83,7 +83,15 @@ feature -- Execution res.write_header ({HTTP_STATUS_CODE}.unauthorized, Void) res.write_string ("Unauthorized") end - + +feature -- Auth + + authenticated (ctx: C): BOOLEAN + -- Is authenticated? + do + --| To redefine if needed + end + feature {NONE} -- Implementation supported_formats: INTEGER diff --git a/library/server/request/rest/src/rest_request_handler_context.e b/library/server/request/rest/src/rest_request_handler_context.e index 4fbf9913..8697bca5 100644 --- a/library/server/request/rest/src/rest_request_handler_context.e +++ b/library/server/request/rest/src/rest_request_handler_context.e @@ -54,17 +54,6 @@ feature -- Status report result_attached: Result /= Void end - authenticated: BOOLEAN - do - if request.http_authorization /= Void then - Result := True - end - end - - authenticated_identifier: detachable READABLE_STRING_32 - do - end - note copyright: "Copyright (c) 1984-2011, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"