diff --git a/library/client/http_client/http_client.ecf b/library/client/http_client/http_client.ecf
index 0240a509..5aeb4acd 100644
--- a/library/client/http_client/http_client.ecf
+++ b/library/client/http_client/http_client.ecf
@@ -7,7 +7,7 @@
/EIFGENs$
/.svn$
-
diff --git a/library/server/ewsgi/specification/response/wgi_response_buffer.e b/library/server/ewsgi/specification/response/wgi_response_buffer.e
index 7cf4e9fa..b5b619fc 100644
--- a/library/server/ewsgi/specification/response/wgi_response_buffer.e
+++ b/library/server/ewsgi/specification/response/wgi_response_buffer.e
@@ -69,7 +69,7 @@ feature -- Status setting
feature -- Header output operation
- write_headers_string (a_headers: STRING)
+ write_headers_string (a_headers: READABLE_STRING_8)
require
status_set: status_is_set
header_not_committed: not header_committed
@@ -80,7 +80,7 @@ feature -- Header output operation
message_writable: message_writable
end
- write_header (a_status_code: INTEGER; a_headers: detachable ARRAY [TUPLE [key: STRING; value: STRING]])
+ write_header (a_status_code: INTEGER; a_headers: detachable ARRAY [TUPLE [key: READABLE_STRING_8; value: READABLE_STRING_8]])
-- Send headers with status `a_status', and headers from `a_headers'
require
status_not_set: not status_is_set
@@ -94,21 +94,21 @@ feature -- Header output operation
feature -- Output operation
- write_string (s: STRING)
+ write_string (s: READABLE_STRING_8)
-- Send the string `s'
require
message_writable: message_writable
deferred
end
- write_substring (s: STRING; a_begin_index, a_end_index: INTEGER)
+ write_substring (s: READABLE_STRING_8; a_begin_index, a_end_index: INTEGER)
-- Send the substring `s[a_begin_index:a_end_index]'
require
message_writable: message_writable
deferred
end
- write_file_content (fn: STRING)
+ write_file_content (fn: READABLE_STRING_8)
-- Send the content of file `fn'
require
message_writable: message_writable
diff --git a/library/server/request/rest/src/uri/rest_request_uri_routing_handler_i.e b/library/server/request/rest/src/uri/rest_request_uri_routing_handler_i.e
index badbe29d..6fc843d4 100644
--- a/library/server/request/rest/src/uri/rest_request_uri_routing_handler_i.e
+++ b/library/server/request/rest/src/uri/rest_request_uri_routing_handler_i.e
@@ -25,7 +25,14 @@ create
feature -- Status report
- authentication_required: BOOLEAN
+ authentication_required (req: WGI_REQUEST): BOOLEAN
+ do
+ Result := internal_authentication_required
+ end
+
+feature {NONE} -- Implementation
+
+ internal_authentication_required: BOOLEAN
feature -- Execution
diff --git a/library/server/request/rest/tests/src/app/app_account_verify_credential.e b/library/server/request/rest/tests/src/app/app_account_verify_credential.e
index 17efb516..3161dff7 100644
--- a/library/server/request/rest/tests/src/app/app_account_verify_credential.e
+++ b/library/server/request/rest/tests/src/app/app_account_verify_credential.e
@@ -63,9 +63,9 @@ feature -- Execution
do
content_type_supported := <<{HTTP_CONSTANTS}.json_app, {HTTP_CONSTANTS}.xml_text, {HTTP_CONSTANTS}.plain_text>>
l_format_id := ctx.request_format_id ("format", content_type_supported)
- if ctx.authenticated then
+ if authenticated (ctx) then
l_full := attached ctx.query_parameter ("details") as v and then v.is_case_insensitive_equal ("true")
- if attached ctx.authenticated_identifier as log then
+ if attached authenticated_identifier (ctx) as log then
l_login := log.as_string_8
create h.make
diff --git a/library/server/request/rest/tests/src/app/app_test.e b/library/server/request/rest/tests/src/app/app_test.e
index f642977a..031044c5 100644
--- a/library/server/request/rest/tests/src/app/app_test.e
+++ b/library/server/request/rest/tests/src/app/app_test.e
@@ -70,7 +70,7 @@ feature -- Execution
-- if attached ctx.http_authorization_login_password as t then
-- s.append_string ("Check login=" + t.login + "
%N")
-- end
- if ctx.authenticated and then attached ctx.authenticated_identifier as l_login then
+ if authenticated (ctx) and then attached authenticated_identifier (ctx) as l_login then
s.append_string ("Authenticated: login=" + l_login.as_string_8 + "
%N")
end
end
diff --git a/library/server/request/rest/tests/src/handler/app_request_agent_handler.e b/library/server/request/rest/tests/src/handler/app_request_agent_handler.e
index a59ab7ab..49551d2a 100644
--- a/library/server/request/rest/tests/src/handler/app_request_agent_handler.e
+++ b/library/server/request/rest/tests/src/handler/app_request_agent_handler.e
@@ -14,6 +14,9 @@ inherit
end
REST_REQUEST_AGENT_HANDLER [APP_REQUEST_HANDLER_CONTEXT]
+ undefine
+ authenticated
+ end
create
make
diff --git a/library/server/request/rest/tests/src/handler/app_request_handler.e b/library/server/request/rest/tests/src/handler/app_request_handler.e
index 01e78d9c..71214e66 100644
--- a/library/server/request/rest/tests/src/handler/app_request_handler.e
+++ b/library/server/request/rest/tests/src/handler/app_request_handler.e
@@ -8,6 +8,9 @@ deferred class
inherit
REST_REQUEST_HANDLER [APP_REQUEST_HANDLER_CONTEXT]
+ redefine
+ authenticated
+ end
APP_REQUEST_HELPER
@@ -17,7 +20,7 @@ feature {NONE} -- Initialization
-- Initialize various attributes
do
end
-
+
feature {NONE} -- Implementation
wgi_value_iteration_to_string (cur: ITERATION_CURSOR [WGI_VALUE]; using_pre: BOOLEAN): STRING_8
@@ -38,6 +41,24 @@ feature {NONE} -- Implementation
end
end
+feature -- Auth
+
+ authenticated (ctx: APP_REQUEST_HANDLER_CONTEXT): BOOLEAN
+ -- Is authenticated?
+ do
+ --| To redefine if needed
+ if attached ctx.request.http_authorization as l_http_authorization then
+ Result := True
+ end
+ end
+
+ authenticated_identifier (ctx: APP_REQUEST_HANDLER_CONTEXT): detachable READABLE_STRING_32
+ do
+ if attached ctx.request.http_authorization as l_http_authorization then
+ Result := "foo" -- Implement it as you want
+ end
+ end
+
feature -- Helpers
format_id (s: detachable STRING): INTEGER
diff --git a/library/server/request/rest/tests/src/handler/app_request_handler_context.e b/library/server/request/rest/tests/src/handler/app_request_handler_context.e
index 98bd12de..76b703a0 100644
--- a/library/server/request/rest/tests/src/handler/app_request_handler_context.e
+++ b/library/server/request/rest/tests/src/handler/app_request_handler_context.e
@@ -9,29 +9,10 @@ class
inherit
REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT
- redefine
- authenticated,
- authenticated_identifier
- end
create
make
-feature -- Auth
-
- authenticated: BOOLEAN
- do
- if attached request.http_authorization as l_http_auth then
- Result := True
- end
- end
-
- authenticated_identifier: detachable READABLE_STRING_32
- do
- if authenticated then
- Result := "foo"
- end
- end
feature -- Format
diff --git a/library/server/request/rest/tests/src/handler/app_request_routing_handler.e b/library/server/request/rest/tests/src/handler/app_request_routing_handler.e
index 63e0196f..f6db6ec1 100644
--- a/library/server/request/rest/tests/src/handler/app_request_routing_handler.e
+++ b/library/server/request/rest/tests/src/handler/app_request_routing_handler.e
@@ -10,12 +10,14 @@ class
inherit
APP_REQUEST_HANDLER
undefine
- execute,
- pre_execute,
- post_execute
+ execute
end
REST_REQUEST_URI_TEMPLATE_ROUTING_HANDLER_I [APP_REQUEST_HANDLER, APP_REQUEST_HANDLER_CONTEXT]
+ undefine
+ authenticated,
+ pre_execute,
+ post_execute
redefine
router
end
diff --git a/library/server/request/router/src/misc/routed_application_helper.e b/library/server/request/router/src/misc/routed_application_helper.e
index 0cce19bf..092511d2 100644
--- a/library/server/request/router/src/misc/routed_application_helper.e
+++ b/library/server/request/router/src/misc/routed_application_helper.e
@@ -14,31 +14,28 @@ feature -- Helper
execute_content_type_not_allowed (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER; a_content_types: detachable ARRAY [STRING]; a_uri_formats: detachable ARRAY [STRING])
local
- s, uri_s: detachable STRING
+ accept_s, uri_s: detachable STRING
i, n: INTEGER
- h: EWF_HEADER
do
- create h.make
- h.put_status ({HTTP_STATUS_CODE}.unsupported_media_type)
- h.put_content_type_text_plain
-
if a_content_types /= Void then
- create s.make (10)
+ create accept_s.make (10)
from
i := a_content_types.lower
n := a_content_types.upper
until
i > n
loop
- s.append_string (a_content_types[i])
+ accept_s.append_string (a_content_types[i])
if i < n then
- s.append_character (',')
- s.append_character (' ')
+ accept_s.append_character (',')
+ accept_s.append_character (' ')
end
i := i + 1
end
- h.put_header_key_value ("Accept", s)
+ else
+ accept_s := "*/*"
end
+
if a_uri_formats /= Void then
create uri_s.make (10)
from
@@ -56,9 +53,9 @@ feature -- Helper
end
end
res.set_status_code ({HTTP_STATUS_CODE}.unsupported_media_type)
- res.write_headers_string (h.string)
- if s /= Void then
- res.write_string ("Unsupported request content-type, Accept: " + s + "%N")
+ res.write_header ({HTTP_STATUS_CODE}.unsupported_media_type, << ["Content-Type", "text/plain"], ["Accept", accept_s]>>)
+ if accept_s /= Void then
+ res.write_string ("Unsupported request content-type, Accept: " + accept_s + "%N")
end
if uri_s /= Void then
res.write_string ("Unsupported request format from the URI: " + uri_s + "%N")