Skip to content

Commit fac7217

Browse files
authored
fix: tests and changes for oauth2 provider (#551)
* fix: cdi and fdi versions * fix: deps * fix: sdk version * fix: tests * fix: website reset * fix: website tests * fix: test scripts for oauth2 * fix: website tests * fix: unit test * fix: unit test * fix: django headers * fix: better types * fix: review comments * fix: test server
1 parent 0226085 commit fac7217

39 files changed

+333
-148
lines changed

.circleci/config_continue.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
test-backend-sdk-testing:
3535
docker:
3636
- image: python:<< parameters.python-version >>
37+
- image: rishabhpoddar/oauth-server-cicd
3738
resource_class: large
3839
parameters:
3940
cdi-version:
@@ -54,6 +55,7 @@ jobs:
5455
test-website-fastapi:
5556
docker:
5657
- image: python:<< parameters.python-version >>
58+
- image: rishabhpoddar/oauth-server-cicd
5759
resource_class: large
5860
parameters:
5961
fdi-version:
@@ -74,6 +76,7 @@ jobs:
7476
test-website-flask:
7577
docker:
7678
- image: python:<< parameters.python-version >>
79+
- image: rishabhpoddar/oauth-server-cicd
7780
resource_class: large
7881
parameters:
7982
fdi-version:
@@ -94,6 +97,7 @@ jobs:
9497
test-website-django:
9598
docker:
9699
- image: python:<< parameters.python-version >>
100+
- image: rishabhpoddar/oauth-server-cicd
97101
resource_class: large
98102
parameters:
99103
fdi-version:
@@ -114,6 +118,7 @@ jobs:
114118
test-website-drf-async:
115119
docker:
116120
- image: python:<< parameters.python-version >>
121+
- image: rishabhpoddar/oauth-server-cicd
117122
resource_class: large
118123
parameters:
119124
fdi-version:
@@ -134,6 +139,7 @@ jobs:
134139
test-website-drf-sync:
135140
docker:
136141
- image: python:<< parameters.python-version >>
142+
- image: rishabhpoddar/oauth-server-cicd
137143
resource_class: large
138144
parameters:
139145
fdi-version:
@@ -154,6 +160,7 @@ jobs:
154160
test-website-django2x:
155161
docker:
156162
- image: python:<< parameters.python-version >>
163+
- image: rishabhpoddar/oauth-server-cicd
157164
resource_class: large
158165
parameters:
159166
fdi-version:
@@ -174,6 +181,7 @@ jobs:
174181
test-website-flask-nest-asyncio:
175182
docker:
176183
- image: python:<< parameters.python-version >>
184+
- image: rishabhpoddar/oauth-server-cicd
177185
resource_class: large
178186
environment:
179187
SUPERTOKENS_NEST_ASYNCIO: "1"
@@ -197,6 +205,7 @@ jobs:
197205
test-authreact-fastapi:
198206
docker:
199207
- image: python:<< parameters.python-version >>
208+
- image: rishabhpoddar/oauth-server-cicd
200209
environment:
201210
MOCHA_FILE: /root/test_report/report_node-<< parameters.fdi-version >>.xml
202211
parameters:
@@ -227,6 +236,7 @@ jobs:
227236
test-authreact-flask:
228237
docker:
229238
- image: python:<< parameters.python-version >>
239+
- image: rishabhpoddar/oauth-server-cicd
230240
resource_class: large
231241
environment:
232242
MOCHA_FILE: /root/test_report/report_node-<< parameters.fdi-version >>.xml
@@ -258,6 +268,7 @@ jobs:
258268
test-authreact-django:
259269
docker:
260270
- image: python:<< parameters.python-version >>
271+
- image: rishabhpoddar/oauth-server-cicd
261272
resource_class: large
262273
environment:
263274
MOCHA_FILE: /root/test_report/report_node-<< parameters.fdi-version >>.xml

.circleci/markDevTagAsTestNotPassed.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ while IFS='"' read -ra ADDR; do
2121
done
2222
done <<< "$version"
2323

24-
responseStatus=`curl -s -o /dev/null -w "%{http_code}" -X PUT \
24+
responseStatus=`curl -s -o out.bin -w "%{http_code}" -X PUT \
2525
https://api.supertokens.io/0/driver \
2626
-H 'Content-Type: application/json' \
2727
-H 'api-version: 0' \
@@ -35,5 +35,6 @@ responseStatus=`curl -s -o /dev/null -w "%{http_code}" -X PUT \
3535
if [ $responseStatus -ne "200" ]
3636
then
3737
echo "failed core PUT API status code: $responseStatus. Exiting!"
38+
cat out.bin
3839
exit 1
3940
fi

.circleci/setupAndTestBackendSDKWithFreeCore.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt
4343
./loadModules --ssh
4444
cd supertokens-core
4545
git checkout $coreTag
46+
47+
# Update oauth provider config in devConfig.yaml
48+
sed -i 's/# oauth_provider_public_service_url:/oauth_provider_public_service_url: "http:\/\/localhost:4444"/' devConfig.yaml
49+
sed -i 's/# oauth_provider_admin_service_url:/oauth_provider_admin_service_url: "http:\/\/localhost:4445"/' devConfig.yaml
50+
sed -i 's/# oauth_provider_consent_login_base_url:/oauth_provider_consent_login_base_url: "http:\/\/localhost:3001\/auth"/' devConfig.yaml
51+
sed -i 's/# oauth_client_secret_encryption_key:/oauth_client_secret_encryption_key: "asdfasdfasdfasdfasdf"/' devConfig.yaml
52+
4653
cd ../supertokens-plugin-interface
4754
git checkout $pluginInterfaceTag
4855
cd ../

.circleci/setupAndTestWithAuthReact.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt
3939
./loadModules --ssh
4040
cd supertokens-core
4141
git checkout $coreTag
42+
43+
# Update oauth provider config in devConfig.yaml
44+
sed -i 's/# oauth_provider_public_service_url:/oauth_provider_public_service_url: "http:\/\/localhost:4444"/' devConfig.yaml
45+
sed -i 's/# oauth_provider_admin_service_url:/oauth_provider_admin_service_url: "http:\/\/localhost:4445"/' devConfig.yaml
46+
sed -i 's/# oauth_provider_consent_login_base_url:/oauth_provider_consent_login_base_url: "http:\/\/localhost:3001\/auth"/' devConfig.yaml
47+
sed -i 's/# oauth_client_secret_encryption_key:/oauth_client_secret_encryption_key: "asdfasdfasdfasdfasdf"/' devConfig.yaml
48+
4249
cd ../supertokens-plugin-interface
4350
git checkout $pluginInterfaceTag
4451
cd ../

.circleci/setupAndTestWithAuthReactWithDjango.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt
4141
./loadModules --ssh
4242
cd supertokens-core
4343
git checkout $coreTag
44+
45+
# Update oauth provider config in devConfig.yaml
46+
sed -i 's/# oauth_provider_public_service_url:/oauth_provider_public_service_url: "http:\/\/localhost:4444"/' devConfig.yaml
47+
sed -i 's/# oauth_provider_admin_service_url:/oauth_provider_admin_service_url: "http:\/\/localhost:4445"/' devConfig.yaml
48+
sed -i 's/# oauth_provider_consent_login_base_url:/oauth_provider_consent_login_base_url: "http:\/\/localhost:3001\/auth"/' devConfig.yaml
49+
sed -i 's/# oauth_client_secret_encryption_key:/oauth_client_secret_encryption_key: "asdfasdfasdfasdfasdf"/' devConfig.yaml
50+
4451
cd ../supertokens-plugin-interface
4552
git checkout $pluginInterfaceTag
4653
cd ../

.circleci/setupAndTestWithAuthReactWithFlask.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt
4141
./loadModules --ssh
4242
cd supertokens-core
4343
git checkout $coreTag
44+
45+
# Update oauth provider config in devConfig.yaml
46+
sed -i 's/# oauth_provider_public_service_url:/oauth_provider_public_service_url: "http:\/\/localhost:4444"/' devConfig.yaml
47+
sed -i 's/# oauth_provider_admin_service_url:/oauth_provider_admin_service_url: "http:\/\/localhost:4445"/' devConfig.yaml
48+
sed -i 's/# oauth_provider_consent_login_base_url:/oauth_provider_consent_login_base_url: "http:\/\/localhost:3001\/auth"/' devConfig.yaml
49+
sed -i 's/# oauth_client_secret_encryption_key:/oauth_client_secret_encryption_key: "asdfasdfasdfasdfasdf"/' devConfig.yaml
50+
4451
cd ../supertokens-plugin-interface
4552
git checkout $pluginInterfaceTag
4653
cd ../

.circleci/setupAndTestWithFreeCore.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt
4343
./loadModules --ssh
4444
cd supertokens-core
4545
git checkout $coreTag
46+
47+
# Update oauth provider config in devConfig.yaml
48+
sed -i 's/# oauth_provider_public_service_url:/oauth_provider_public_service_url: "http:\/\/localhost:4444"/' devConfig.yaml
49+
sed -i 's/# oauth_provider_admin_service_url:/oauth_provider_admin_service_url: "http:\/\/localhost:4445"/' devConfig.yaml
50+
sed -i 's/# oauth_provider_consent_login_base_url:/oauth_provider_consent_login_base_url: "http:\/\/localhost:3001\/auth"/' devConfig.yaml
51+
sed -i 's/# oauth_client_secret_encryption_key:/oauth_client_secret_encryption_key: "asdfasdfasdfasdfasdf"/' devConfig.yaml
52+
4653
cd ../supertokens-plugin-interface
4754
git checkout $pluginInterfaceTag
4855
cd ../

.circleci/setupAndTestWithFrontend.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt
3939
./loadModules --ssh
4040
cd supertokens-core
4141
git checkout $coreTag
42+
43+
# Update oauth provider config in devConfig.yaml
44+
sed -i 's/# oauth_provider_public_service_url:/oauth_provider_public_service_url: "http:\/\/localhost:4444"/' devConfig.yaml
45+
sed -i 's/# oauth_provider_admin_service_url:/oauth_provider_admin_service_url: "http:\/\/localhost:4445"/' devConfig.yaml
46+
sed -i 's/# oauth_provider_consent_login_base_url:/oauth_provider_consent_login_base_url: "http:\/\/localhost:3001\/auth"/' devConfig.yaml
47+
sed -i 's/# oauth_client_secret_encryption_key:/oauth_client_secret_encryption_key: "asdfasdfasdfasdfasdf"/' devConfig.yaml
48+
4249
cd ../supertokens-plugin-interface
4350
git checkout $pluginInterfaceTag
4451
cd ../

.circleci/setupAndTestWithFrontendWithDjango.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt
3939
./loadModules --ssh
4040
cd supertokens-core
4141
git checkout $coreTag
42+
43+
# Update oauth provider config in devConfig.yaml
44+
sed -i 's/# oauth_provider_public_service_url:/oauth_provider_public_service_url: "http:\/\/localhost:4444"/' devConfig.yaml
45+
sed -i 's/# oauth_provider_admin_service_url:/oauth_provider_admin_service_url: "http:\/\/localhost:4445"/' devConfig.yaml
46+
sed -i 's/# oauth_provider_consent_login_base_url:/oauth_provider_consent_login_base_url: "http:\/\/localhost:3001\/auth"/' devConfig.yaml
47+
sed -i 's/# oauth_client_secret_encryption_key:/oauth_client_secret_encryption_key: "asdfasdfasdfasdfasdf"/' devConfig.yaml
48+
4249
cd ../supertokens-plugin-interface
4350
git checkout $pluginInterfaceTag
4451
cd ../

.circleci/setupAndTestWithFrontendWithDjango2x.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt
3939
./loadModules --ssh
4040
cd supertokens-core
4141
git checkout $coreTag
42+
43+
# Update oauth provider config in devConfig.yaml
44+
sed -i 's/# oauth_provider_public_service_url:/oauth_provider_public_service_url: "http:\/\/localhost:4444"/' devConfig.yaml
45+
sed -i 's/# oauth_provider_admin_service_url:/oauth_provider_admin_service_url: "http:\/\/localhost:4445"/' devConfig.yaml
46+
sed -i 's/# oauth_provider_consent_login_base_url:/oauth_provider_consent_login_base_url: "http:\/\/localhost:3001\/auth"/' devConfig.yaml
47+
sed -i 's/# oauth_client_secret_encryption_key:/oauth_client_secret_encryption_key: "asdfasdfasdfasdfasdf"/' devConfig.yaml
48+
4249
cd ../supertokens-plugin-interface
4350
git checkout $pluginInterfaceTag
4451
cd ../

.circleci/setupAndTestWithFrontendWithDrfAsync.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt
3939
./loadModules --ssh
4040
cd supertokens-core
4141
git checkout $coreTag
42+
43+
# Update oauth provider config in devConfig.yaml
44+
sed -i 's/# oauth_provider_public_service_url:/oauth_provider_public_service_url: "http:\/\/localhost:4444"/' devConfig.yaml
45+
sed -i 's/# oauth_provider_admin_service_url:/oauth_provider_admin_service_url: "http:\/\/localhost:4445"/' devConfig.yaml
46+
sed -i 's/# oauth_provider_consent_login_base_url:/oauth_provider_consent_login_base_url: "http:\/\/localhost:3001\/auth"/' devConfig.yaml
47+
sed -i 's/# oauth_client_secret_encryption_key:/oauth_client_secret_encryption_key: "asdfasdfasdfasdfasdf"/' devConfig.yaml
48+
4249
cd ../supertokens-plugin-interface
4350
git checkout $pluginInterfaceTag
4451
cd ../

.circleci/setupAndTestWithFrontendWithDrfSync.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt
3939
./loadModules --ssh
4040
cd supertokens-core
4141
git checkout $coreTag
42+
43+
# Update oauth provider config in devConfig.yaml
44+
sed -i 's/# oauth_provider_public_service_url:/oauth_provider_public_service_url: "http:\/\/localhost:4444"/' devConfig.yaml
45+
sed -i 's/# oauth_provider_admin_service_url:/oauth_provider_admin_service_url: "http:\/\/localhost:4445"/' devConfig.yaml
46+
sed -i 's/# oauth_provider_consent_login_base_url:/oauth_provider_consent_login_base_url: "http:\/\/localhost:3001\/auth"/' devConfig.yaml
47+
sed -i 's/# oauth_client_secret_encryption_key:/oauth_client_secret_encryption_key: "asdfasdfasdfasdfasdf"/' devConfig.yaml
48+
4249
cd ../supertokens-plugin-interface
4350
git checkout $pluginInterfaceTag
4451
cd ../

.circleci/setupAndTestWithFrontendWithFlask.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt
3939
./loadModules --ssh
4040
cd supertokens-core
4141
git checkout $coreTag
42+
43+
# Update oauth provider config in devConfig.yaml
44+
sed -i 's/# oauth_provider_public_service_url:/oauth_provider_public_service_url: "http:\/\/localhost:4444"/' devConfig.yaml
45+
sed -i 's/# oauth_provider_admin_service_url:/oauth_provider_admin_service_url: "http:\/\/localhost:4445"/' devConfig.yaml
46+
sed -i 's/# oauth_provider_consent_login_base_url:/oauth_provider_consent_login_base_url: "http:\/\/localhost:3001\/auth"/' devConfig.yaml
47+
sed -i 's/# oauth_client_secret_encryption_key:/oauth_client_secret_encryption_key: "asdfasdfasdfasdfasdf"/' devConfig.yaml
48+
4249
cd ../supertokens-plugin-interface
4350
git checkout $pluginInterfaceTag
4451
cd ../

coreDriverInterfaceSupported.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"_comment": "contains a list of core-driver interfaces branch names that this core supports",
33
"versions": [
4-
"5.1"
4+
"5.2"
55
]
66
}

frontendDriverInterfaceSupported.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"1.19",
77
"2.0",
88
"3.0",
9-
"3.1"
9+
"3.1",
10+
"4.0"
1011
]
1112
}

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383

8484
setup(
8585
name="supertokens_python",
86-
version="0.26.1",
86+
version="0.27.0",
8787
author="SuperTokens",
8888
license="Apache 2.0",
8989
author_email="[email protected]",
@@ -127,6 +127,7 @@
127127
"aiosmtplib>=1.1.6,<4.0.0",
128128
"pkce<1.1.0",
129129
"pyotp<3",
130+
"python-dateutil<3",
130131
],
131132
python_requires=">=3.8",
132133
include_package_data=True,

supertokens_python/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
from __future__ import annotations
1616

17-
SUPPORTED_CDI_VERSIONS = ["5.1"]
18-
VERSION = "0.26.1"
17+
SUPPORTED_CDI_VERSIONS = ["5.2"]
18+
VERSION = "0.27.0"
1919
TELEMETRY = "/telemetry"
2020
USER_COUNT = "/users/count"
2121
USER_DELETE = "/user/remove"

supertokens_python/framework/django/django_request.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ def get_cookie(self, key: str) -> Union[str, None]:
5757

5858
def get_header(self, key: str) -> Union[None, str]:
5959
key = key.replace("-", "_")
60+
if key.upper() in self.request.META:
61+
return self.request.META.get(key.upper())
6062
key = "HTTP_" + key
6163
return self.request.META.get(key.upper())
6264

supertokens_python/framework/django/django_response.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,5 @@ def redirect(self, url: str) -> BaseResponse:
9393
if not self.response_sent:
9494
self.set_header("Location", url)
9595
self.set_status_code(302)
96+
self.response_sent = True
9697
return self

supertokens_python/framework/fastapi/fastapi_response.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,5 @@ def redirect(self, url: str) -> BaseResponse:
9999
if not self.response_sent:
100100
self.set_header("Location", url)
101101
self.set_status_code(302)
102+
self.response_sent = True
102103
return self

0 commit comments

Comments
 (0)