Made all libraries compilable in any mode (voidsafe or not)
Fixed related examples
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -70,7 +70,7 @@ feature -- Execution
|
||||
-- if attached ctx.http_authorization_login_password as t then
|
||||
-- s.append_string ("Check login=" + t.login + "<br/>%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 + "<br/>%N")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -14,6 +14,9 @@ inherit
|
||||
end
|
||||
|
||||
REST_REQUEST_AGENT_HANDLER [APP_REQUEST_HANDLER_CONTEXT]
|
||||
undefine
|
||||
authenticated
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user