Updated OAUTH consumer using STRING_8 instead of STRING_32
This commit is contained in:
@@ -19,7 +19,7 @@ create
|
||||
|
||||
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
|
||||
endpoint := a_endpoint
|
||||
authorize_url := a_authorize_url
|
||||
@@ -30,13 +30,13 @@ feature {NONE} -- Initialize
|
||||
extractor_set: extractor = a_authorize_url
|
||||
end
|
||||
|
||||
endpoint: READABLE_STRING_32
|
||||
endpoint: READABLE_STRING_8
|
||||
-- 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
|
||||
|
||||
feature -- Access
|
||||
@@ -51,37 +51,37 @@ feature -- Access
|
||||
end
|
||||
end
|
||||
|
||||
access_token_verb: STRING_32
|
||||
access_token_verb: STRING_8
|
||||
do
|
||||
Result := "POST"
|
||||
end
|
||||
|
||||
access_token_endpoint: STRING_32
|
||||
access_token_endpoint: STRING_8
|
||||
-- Url that receives the access token request
|
||||
do
|
||||
create {STRING_32} Result.make_from_string (endpoint)
|
||||
create Result.make_from_string (endpoint)
|
||||
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
|
||||
local
|
||||
l_result: STRING_32
|
||||
l_result: STRING_8
|
||||
do
|
||||
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)
|
||||
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
|
||||
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
|
||||
end
|
||||
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)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user