first version of http authorization ..

for now, only basic digest
This commit is contained in:
Jocelyn Fiat
2011-09-16 18:53:57 +02:00
parent c9a4ebcb23
commit 7b1557a52a
3 changed files with 80 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="http_authorization" uuid="321674DB-CE7C-417C-ADE8-64CFA376CD3E" library_target="http_authorization">
<target name="http_authorization">
<root all_classes="true"/>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard">
</option>
<library name="base" location="$ISE_LIBRARY/library/base/base-safe.ecf"/>
<library name="encoder" location="..\..\..\text\encoder\encoder-safe.ecf"/>
<cluster name="src" location="./src" recursive="true"/>
</target>
</system>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="http_authorization" uuid="321674DB-CE7C-417C-ADE8-64CFA376CD3E" library_target="http_authorization">
<target name="http_authorization">
<root all_classes="true"/>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" void_safety="none" syntax="standard">
</option>
<library name="base" location="$ISE_LIBRARY/library/base/base.ecf"/>
<library name="encoder" location="..\..\..\text\encoder\encoder.ecf"/>
<cluster name="src" location="./src" recursive="true"/>
</target>
</system>

View File

@@ -0,0 +1,48 @@
note
description : "Objects that ..."
author : "$Author$"
date : "$Date$"
revision : "$Revision$"
class
HTTP_AUTHORIZATION
create
make
feature {NONE} -- Initialization
make (a_http_authorization: detachable READABLE_STRING_GENERAL)
-- Initialize `Current'.
local
p: INTEGER
s: STRING_8
do
if attached a_http_authorization as l_auth then
s := l_auth.as_string_8
if not s.is_empty then
p := 1
if s[p] = ' ' then
p := p + 1
end
p := s.index_of (' ', p)
if p > 0 then
s := (create {BASE64}).decoded_string (s.substring (p + 1, s.count))
p := s.index_of (':', 1) --| Let's assume ':' is forbidden in login ...
if p > 0 then
login := s.substring (1, p - 1).as_string_32
password := s.substring (p + 1, s.count).as_string_32
end
end
end
end
end
feature -- Access
login: detachable READABLE_STRING_32
password: detachable READABLE_STRING_32
end