From 8dce51ca79b410ba7fd4c06f7be0f5a18ec0c871 Mon Sep 17 00:00:00 2001 From: Denis Feklushkin Date: Wed, 9 Sep 2020 18:24:08 +0700 Subject: [PATCH 1/6] vibe-d:core dependency version update --- dub.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dub.json b/dub.json index ea1aec0..bbf4f77 100644 --- a/dub.json +++ b/dub.json @@ -9,7 +9,7 @@ ], "targetType" : "library", "dependencies" : { - "vibe-d:core" : "~>0.8.0-beta.6", + "vibe-d:core" : ">=0.8.0-beta.6 <0.10.0", "vibe-d:data" : "*", "vibe-d:http" : "*", "vibe-d:web" : { From 52c8da86900385b414c8f63d7522c544f6d04475 Mon Sep 17 00:00:00 2001 From: Denis Feklushkin Date: Wed, 9 Sep 2020 18:55:07 +0700 Subject: [PATCH 2/6] Wider unit-threaded version --- dub.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dub.json b/dub.json index bbf4f77..4d1ab94 100644 --- a/dub.json +++ b/dub.json @@ -29,7 +29,7 @@ "postBuildCommands": ["rm ut.d"], "mainSourceFile": "ut.d", "dependencies": { - "unit-threaded": "~>0.7.11" + "unit-threaded": ">=0.7.11" } } ], From d67f3cebb29d9895763388394211c8b97711291a Mon Sep 17 00:00:00 2001 From: Denis Feklushkin Date: Sun, 13 Sep 2020 21:02:13 +0700 Subject: [PATCH 3/6] Improvements to support OAuth2 implementation used by vk.com --- source/oauth/provider/package.d | 3 ++- source/oauth/settings.d | 9 ++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/oauth/provider/package.d b/source/oauth/provider/package.d index 1dfda9e..12fceb9 100644 --- a/source/oauth/provider/package.d +++ b/source/oauth/provider/package.d @@ -44,9 +44,10 @@ class OAuthProvider /// authorization redirect. tokenRequestHttpGet = 0x02, /// use the GET http method when requesting /// an access token. - clientAuthParams = 0x04 /// pass client credentials as parameters + clientAuthParams = 0x04, /// pass client credentials as parameters /// rather than using http Basic /// authentication. + tokenResponseType = 0x08, /// request access_token in authorization redirect. } /++ diff --git a/source/oauth/settings.d b/source/oauth/settings.d index 0cacce8..ec00916 100644 --- a/source/oauth/settings.d +++ b/source/oauth/settings.d @@ -194,9 +194,9 @@ class OAuthSettings foreach (k, v; extraParams) reqParams[k] = v; - // Request an authorization code from the OAuth server. Subsequently, - // the authorization code may be exchanged for an access token. - reqParams["response_type"] = "code"; + reqParams["response_type"] = + (provider.options & OAuthProvider.Option.tokenResponseType) ? "token" : "code"; + reqParams["client_id"] = clientId; if (provider.options & OAuthProvider.Option.explicitRedirectUri) @@ -412,14 +412,13 @@ class OAuthSettings Throws: OAuthException if authentication fails. +/ final - OAuthSession clientSession(string[] scopes = null) immutable + OAuthSession clientSession(string[] scopes = null, string[string] params = null) immutable out(result) { assert(result !is null); } body { - string[string] params; params["grant_type"] = "client_credentials"; if (scopes) From f39433b28abb3515dfc10a302f6a22b28c9cb9ee Mon Sep 17 00:00:00 2001 From: Denis Feklushkin Date: Mon, 14 Sep 2020 02:16:15 +0700 Subject: [PATCH 4/6] DDoc comment added --- source/oauth/settings.d | 1 + 1 file changed, 1 insertion(+) diff --git a/source/oauth/settings.d b/source/oauth/settings.d index ec00916..6558227 100644 --- a/source/oauth/settings.d +++ b/source/oauth/settings.d @@ -406,6 +406,7 @@ class OAuthSettings Params: scopes = An array of identifiers specifying the scope of access to be requested. (optional) + params = Additional parameters of request. (optional) Returns: The new session. From c460c79ed84fc525233551332948142b2bd6fc83 Mon Sep 17 00:00:00 2001 From: Denis Feklushkin Date: Mon, 14 Sep 2020 09:41:49 +0700 Subject: [PATCH 5/6] Ability to construct session from external token data --- source/oauth/session.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/oauth/session.d b/source/oauth/session.d index be44099..bb73b41 100644 --- a/source/oauth/session.d +++ b/source/oauth/session.d @@ -377,7 +377,7 @@ class OAuthSession return default_; } - struct SaveData + protected struct SaveData { SysTime timestamp; Json tokenData; From ef77256dca8b139fdeb9fb8f24747249e8aac3ba Mon Sep 17 00:00:00 2001 From: Denis Feklushkin Date: Tue, 29 Sep 2020 16:40:57 +0700 Subject: [PATCH 6/6] clientSession: params arg removed --- source/oauth/settings.d | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/oauth/settings.d b/source/oauth/settings.d index 6558227..8a0ae40 100644 --- a/source/oauth/settings.d +++ b/source/oauth/settings.d @@ -406,20 +406,20 @@ class OAuthSettings Params: scopes = An array of identifiers specifying the scope of access to be requested. (optional) - params = Additional parameters of request. (optional) Returns: The new session. Throws: OAuthException if authentication fails. +/ final - OAuthSession clientSession(string[] scopes = null, string[string] params = null) immutable + OAuthSession clientSession(string[] scopes = null) immutable out(result) { assert(result !is null); } body { + string[string] params; params["grant_type"] = "client_credentials"; if (scopes)