Removed generic parameter in WSF_FILTER_HANDLER, since it is useless and make code heavy

Signed-off-by: Olivier Ligot <oligot@gmail.com>
Signed-off-by: Jocelyn Fiat <jfiat@eiffel.com>
This commit is contained in:
Jocelyn Fiat
2012-10-08 10:40:44 +02:00
parent 2d3151e45f
commit aa743c0a7d
15 changed files with 313 additions and 118 deletions

View File

@@ -24,6 +24,31 @@ feature -- Initialization
feature -- Access
user (a_id: INTEGER; a_name: detachable READABLE_STRING_GENERAL): detachable USER
-- User with id `a_id' or name `a_name'.
require
a_id > 0 xor a_name /= Void
local
n: like {USER}.name
do
if a_id > 0 then
Result := users.item (a_id)
elseif a_name /= Void then
n := a_name.as_string_8
across
users as c
until
Result /= Void
loop
if attached c.item as u and then u.name.same_string (n) then
Result := u
end
end
end
ensure
Result /= Void implies ((a_id > 0 and then Result.id = a_id) xor (a_name /= Void and then Result.name.same_string_general (a_name)))
end
users: HASH_TABLE [USER, INTEGER]
;note

View File

@@ -8,7 +8,7 @@ class
AUTHENTICATION_FILTER
inherit
WSF_FILTER_CONTEXT_HANDLER [FILTER_HANDLER_CONTEXT, WSF_URI_TEMPLATE_CONTEXT_HANDLER [FILTER_HANDLER_CONTEXT]]
WSF_FILTER_CONTEXT_HANDLER [FILTER_HANDLER_CONTEXT]
WSF_URI_TEMPLATE_CONTEXT_HANDLER [FILTER_HANDLER_CONTEXT]
@@ -25,9 +25,11 @@ feature -- Basic operations
do
create l_auth.make (req.http_authorization)
if (attached l_auth.type as l_auth_type and then l_auth_type.is_equal ("basic")) and
attached Db_access.users.item (1) as l_user and then
(attached l_auth.login as l_auth_login and then l_auth_login.is_equal (l_user.name)
and attached l_auth.password as l_auth_password and then l_auth_password.is_equal (l_user.password))
attached l_auth.login as l_auth_login and then
attached Db_access.user (0, l_auth_login) as l_user and then
l_auth_login.same_string (l_user.name) and then
attached l_auth.password as l_auth_password and then
l_auth_password.same_string (l_user.password)
then
ctx.set_user (l_user)
execute_next (ctx, req, res)

View File

@@ -8,7 +8,7 @@ class
USER_HANDLER
inherit
WSF_FILTER_CONTEXT_HANDLER [FILTER_HANDLER_CONTEXT, WSF_URI_TEMPLATE_CONTEXT_HANDLER [FILTER_HANDLER_CONTEXT]]
WSF_FILTER_CONTEXT_HANDLER [FILTER_HANDLER_CONTEXT]
WSF_URI_TEMPLATE_CONTEXT_HANDLER [FILTER_HANDLER_CONTEXT]