Updated OAUTH consumer using STRING_8 instead of STRING_32
This commit is contained in:
@@ -19,7 +19,7 @@ create
|
|||||||
|
|
||||||
feature {NONE} -- Initialize
|
feature {NONE} -- Initialize
|
||||||
|
|
||||||
make (a_endpoint: READABLE_STRING_32; a_authorize_url: READABLE_STRING_32; a_extractor: READABLE_STRING_32)
|
make (a_endpoint: READABLE_STRING_8; a_authorize_url: READABLE_STRING_8; a_extractor: READABLE_STRING_8)
|
||||||
do
|
do
|
||||||
endpoint := a_endpoint
|
endpoint := a_endpoint
|
||||||
authorize_url := a_authorize_url
|
authorize_url := a_authorize_url
|
||||||
@@ -30,13 +30,13 @@ feature {NONE} -- Initialize
|
|||||||
extractor_set: extractor = a_authorize_url
|
extractor_set: extractor = a_authorize_url
|
||||||
end
|
end
|
||||||
|
|
||||||
endpoint: READABLE_STRING_32
|
endpoint: READABLE_STRING_8
|
||||||
-- Url that receives the access token request.
|
-- Url that receives the access token request.
|
||||||
|
|
||||||
authorize_url: READABLE_STRING_32
|
authorize_url: READABLE_STRING_8
|
||||||
--
|
--
|
||||||
|
|
||||||
extractor: READABLE_STRING_32
|
extractor: READABLE_STRING_8
|
||||||
-- text, json
|
-- text, json
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
@@ -51,37 +51,37 @@ feature -- Access
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
access_token_verb: STRING_32
|
access_token_verb: STRING_8
|
||||||
do
|
do
|
||||||
Result := "POST"
|
Result := "POST"
|
||||||
end
|
end
|
||||||
|
|
||||||
access_token_endpoint: STRING_32
|
access_token_endpoint: STRING_8
|
||||||
-- Url that receives the access token request
|
-- Url that receives the access token request
|
||||||
do
|
do
|
||||||
create {STRING_32} Result.make_from_string (endpoint)
|
create Result.make_from_string (endpoint)
|
||||||
end
|
end
|
||||||
|
|
||||||
authorization_url (config: OAUTH_CONFIG): detachable STRING_32
|
authorization_url (config: OAUTH_CONFIG): detachable STRING_8
|
||||||
-- Url where you should redirect your users to authneticate
|
-- Url where you should redirect your users to authneticate
|
||||||
local
|
local
|
||||||
l_result: STRING_32
|
l_result: STRING_8
|
||||||
do
|
do
|
||||||
if attached config.scope as l_scope then
|
if attached config.scope as l_scope then
|
||||||
create {STRING_32} l_result.make_from_string (authorize_url + SCOPED_AUTHORIZE_URL)
|
create l_result.make_from_string (authorize_url + SCOPED_AUTHORIZE_URL)
|
||||||
l_result.replace_substring_all ("$CLIENT_ID", config.api_key.as_string_8)
|
l_result.replace_substring_all ("$CLIENT_ID", config.api_key.as_string_8)
|
||||||
if attached config.callback as l_callback then
|
if attached config.callback as l_callback then
|
||||||
l_result.replace_substring_all ("$REDIRECT_URI", (create {OAUTH_ENCODER}).encoded_string (l_callback.as_string_32))
|
l_result.replace_substring_all ("$REDIRECT_URI", (create {OAUTH_ENCODER}).encoded_string (l_callback.as_string_8))
|
||||||
end
|
end
|
||||||
if attached config.callback as l_callback then
|
if attached config.callback as l_callback then
|
||||||
l_result.replace_substring_all ("$SCOPE", (create {OAUTH_ENCODER}).encoded_string (l_scope.as_string_32))
|
l_result.replace_substring_all ("$SCOPE", (create {OAUTH_ENCODER}).encoded_string (l_scope.as_STRING_8))
|
||||||
Result := l_result
|
Result := l_result
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
create {STRING_32} l_result.make_from_string (authorize_url + SCOPED_AUTHORIZE_URL)
|
create l_result.make_from_string (authorize_url + SCOPED_AUTHORIZE_URL)
|
||||||
l_result.replace_substring_all ("$CLIENT_ID", config.api_key.as_string_8)
|
l_result.replace_substring_all ("$CLIENT_ID", config.api_key.as_string_8)
|
||||||
if attached config.callback as l_callback then
|
if attached config.callback as l_callback then
|
||||||
l_result.replace_substring_all ("$REDIRECT_URI", (create {OAUTH_ENCODER}).encoded_string (l_callback.as_string_32))
|
l_result.replace_substring_all ("$REDIRECT_URI", (create {OAUTH_ENCODER}).encoded_string (l_callback.as_string_8))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user