Skip to content

Commit f12ffc8

Browse files
authored
fix: changes as per release checklist (#519)
* fix: CDI version * fix: api version changes * fix: include in non public tenant by default flag * fix: boxy additional config change * fix: oidc urls in built in providers * fix: working test server * fix: working third party tests * fix: all tests working * fix: pass params * fix: tidying tp providers * fix: changelog * fix: backend sdk testing * fix: cicd for testing * fix: cicd for testing * fix: cicd for testing * fix: cicd for testing * fix: cicd for testing * fix: cicd for testing * fix: cicd for testing * fix: cicd for testing * fix: cicd for testing * fix: cicd for testing * fix: cicd for testing * fix: cicd for testing * fix: cicd restore
1 parent 0600462 commit f12ffc8

34 files changed

+1541
-95
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ orbs:
1010
jobs:
1111
create-test-jobs:
1212
machine:
13-
image: ubuntu-2204:edge
13+
image: ubuntu-2204:2022.04.1
1414
steps:
1515
- checkout
1616
- run:

.circleci/config_continue.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,37 @@ jobs:
2727
- run: make dev-install
2828
- run: (cd .circleci/ && ./doUnitTests.sh << parameters.cdi-version >>)
2929
- slack/status
30+
test-backend-sdk-testing:
31+
docker:
32+
- image: rishabhpoddar/supertokens_node_driver_testing_node_20
33+
resource_class: large
34+
parameters:
35+
cdi-version:
36+
type: string
37+
fdi-version:
38+
type: string
39+
steps:
40+
- checkout
41+
- run: update-alternatives --install "/usr/bin/java" "java" "/usr/java/jdk-15.0.1/bin/java" 2
42+
- run: update-alternatives --install "/usr/bin/javac" "javac" "/usr/java/jdk-15.0.1/bin/javac" 2
43+
- run: echo "127.0.0.1 localhost.org" >> /etc/hosts
44+
- run:
45+
name: Install latest Python and dependencies
46+
command: |
47+
apt-get update
48+
apt-get install -y software-properties-common lsof
49+
add-apt-repository -y ppa:deadsnakes/ppa
50+
apt-get update
51+
DEBIAN_FRONTEND=noninteractive apt-get install -y python3.11 python3-pip python3.11-dev libffi-dev
52+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1
53+
update-alternatives --set python3 /usr/bin/python3.11
54+
python3 --version
55+
python3 -m pip install "cython<3.0.0" wheel
56+
python3 -m pip install --upgrade pip setuptools
57+
python3 -m pip install "pyyaml==5.4.1" --no-build-isolation
58+
- run: python3 -m pip install -r dev-requirements.txt
59+
- run: (cd .circleci/ && ./doBackendSDKTests.sh << parameters.cdi-version >> << parameters.fdi-version >>)
60+
- slack/status
3061
test-website-fastapi:
3162
docker:
3263
- image: rishabhpoddar/supertokens_python_driver_testing
@@ -256,6 +287,20 @@ workflows:
256287
matrix:
257288
parameters:
258289
cdi-version: placeholder
290+
- test-backend-sdk-testing:
291+
requires:
292+
- test-dev-tag-as-not-passed
293+
context:
294+
- slack-notification
295+
filters:
296+
tags:
297+
only: /dev-v[0-9]+(\.[0-9]+)*/
298+
branches:
299+
only: /test-cicd\/.*/
300+
matrix:
301+
parameters:
302+
cdi-version: placeholder
303+
fdi-version: placeholder
259304
- test-website-fastapi:
260305
requires:
261306
- test-dev-tag-as-not-passed
@@ -358,6 +403,7 @@ workflows:
358403
- test-success:
359404
requires:
360405
- test-unit
406+
- test-backend-sdk-testing
361407
- test-website-fastapi
362408
- test-website-flask
363409
- test-website-django

.circleci/doBackendSDKTests.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
echo "Starting tests for CDI $1";
2+
3+
if [ -z "$SUPERTOKENS_API_KEY" ]; then
4+
echo "SUPERTOKENS_API_KEY not set"
5+
exit 1
6+
fi
7+
8+
coreDriverVersion=$1
9+
coreDriverVersion=`echo $coreDriverVersion | tr -d '"'`
10+
11+
frontendDriverVersion=$2
12+
13+
coreFree=`curl -s -X GET \
14+
"https://api.supertokens.io/0/core-driver-interface/dependency/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$coreDriverVersion&driverName=python" \
15+
-H 'api-version: 1'`
16+
if [[ `echo $coreFree | jq .core` == "null" ]]
17+
then
18+
echo "fetching latest X.Y version for core given core-driver-interface X.Y version: $coreDriverVersion, planType: FREE gave response: $coreFree. Please make sure all relevant cores have been pushed."
19+
exit 1
20+
fi
21+
coreFree=$(echo $coreFree | jq .core | tr -d '"')
22+
23+
./setupAndTestBackendSDKWithFreeCore.sh $coreFree $coreDriverVersion $frontendDriverVersion
24+
if [[ $? -ne 0 ]]
25+
then
26+
echo "test failed... exiting!"
27+
exit 1
28+
fi
29+
rm -rf ../../supertokens-root
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
coreInfo=`curl -s -X GET \
2+
"https://api.supertokens.io/0/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$1" \
3+
-H 'api-version: 0'`
4+
if [[ `echo $coreInfo | jq .tag` == "null" ]]
5+
then
6+
echo "fetching latest X.Y.Z version for core, X.Y version: $1, planType: FREE gave response: $coreInfo"
7+
exit 1
8+
fi
9+
coreTag=$(echo $coreInfo | jq .tag | tr -d '"')
10+
coreVersion=$(echo $coreInfo | jq .version | tr -d '"')
11+
12+
pluginInterfaceVersionXY=`curl -s -X GET \
13+
"https://api.supertokens.io/0/core/dependency/plugin-interface/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$1" \
14+
-H 'api-version: 0'`
15+
if [[ `echo $pluginInterfaceVersionXY | jq .pluginInterface` == "null" ]]
16+
then
17+
echo "fetching latest X.Y version for plugin-interface, given core X.Y version: $1, planType: FREE gave response: $pluginInterfaceVersionXY"
18+
exit 1
19+
fi
20+
pluginInterfaceVersionXY=$(echo $pluginInterfaceVersionXY | jq .pluginInterface | tr -d '"')
21+
22+
pluginInterfaceInfo=`curl -s -X GET \
23+
"https://api.supertokens.io/0/plugin-interface/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$pluginInterfaceVersionXY" \
24+
-H 'api-version: 0'`
25+
if [[ `echo $pluginInterfaceInfo | jq .tag` == "null" ]]
26+
then
27+
echo "fetching latest X.Y.Z version for plugin-interface, X.Y version: $pluginInterfaceVersionXY, planType: FREE gave response: $pluginInterfaceInfo"
28+
exit 1
29+
fi
30+
pluginInterfaceTag=$(echo $pluginInterfaceInfo | jq .tag | tr -d '"')
31+
pluginInterfaceVersion=$(echo $pluginInterfaceInfo | jq .version | tr -d '"')
32+
33+
echo "Testing with FREE core: $coreVersion, plugin-interface: $pluginInterfaceVersion"
34+
35+
cd ../../
36+
git clone [email protected]:supertokens/supertokens-root.git
37+
cd supertokens-root
38+
if [[ $2 == "2.0" ]] || [[ $2 == "2.1" ]] || [[ $2 == "2.2" ]]
39+
then
40+
git checkout 36e5af1b9a4e3b07247d0cf333cf82a071a78681
41+
fi
42+
echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt
43+
./loadModules --ssh
44+
cd supertokens-core
45+
git checkout $coreTag
46+
cd ../supertokens-plugin-interface
47+
git checkout $pluginInterfaceTag
48+
cd ../
49+
echo $SUPERTOKENS_API_KEY > apiPassword
50+
./utils/setupTestEnvLocal
51+
cd ../project/
52+
export PYTHONPATH=$PWD:$PYTHONPATH
53+
54+
API_PORT=3030
55+
ST_CONNECTION_URI=http://localhost:8081
56+
57+
# start test-server
58+
pushd tests/test-server
59+
sh setup-for-test.sh
60+
SUPERTOKENS_ENV=testing API_PORT=$API_PORT ST_CONNECTION_URI=$ST_CONNECTION_URI python3 app.py &
61+
popd
62+
63+
frontendDriverVersion=$3
64+
# run tests
65+
cd ../
66+
git clone [email protected]:supertokens/backend-sdk-testing.git
67+
cd backend-sdk-testing
68+
git checkout $frontendDriverVersion
69+
npm install
70+
npm run build
71+
72+
if ! [[ -z "${CIRCLE_NODE_TOTAL}" ]]; then
73+
API_PORT=$API_PORT TEST_MODE=testing SUPERTOKENS_CORE_TAG=$coreTag NODE_PORT=8081 INSTALL_PATH=../supertokens-root npx mocha --node-option no-experimental-fetch -r test/fetch-polyfill.mjs --no-config --timeout 500000 $(npx mocha-split-tests -r ./runtime.log -t $CIRCLE_NODE_TOTAL -g $CIRCLE_NODE_INDEX -f 'test/**/*.test.js')
74+
else
75+
API_PORT=$API_PORT TEST_MODE=testing SUPERTOKENS_CORE_TAG=$coreTag NODE_PORT=8081 INSTALL_PATH=../supertokens-root npm test
76+
fi
77+
78+
# kill test-server
79+
kill $(lsof -t -i:$API_PORT)
80+

CHANGELOG.md

Lines changed: 102 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,112 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
## [unreleased]
1010

11-
## [0.24.0] - 2024-07-10
11+
## [0.24.0] - 2024-07-31
12+
13+
### Changes
14+
15+
- Adds test server for `backend-sdk-testing`
16+
- Sends `websiteDomain` and `apiDomain` to core for telemetry.
17+
- `boxyURL` is no more mandatory input in `additionalConfig` while adding boxy-saml provider in thirdParty.
18+
- Adds `jwks_refresh_interval_sec` input to `Session.init` to set the default JWKS cache duration. The default is 4 hours.
1219

1320
### Breaking change
1421

1522
- Removes the default `max_age_in_seconds` value (previously 300 seconds) in EmailVerification Claim. If the claim value is true and `max_age_in_seconds` is not provided, it will not be refetched.
23+
- SDK will no longer add `.well-known/openid-configuration` to the `oidc_discovery_endpoint` config in thirdParty providers. If you have specified any custom `oidc_discovery_endpoint` in the thirdparty.init or added to the core, please make sure to update them to include `.well-known/openid-configuration`.
24+
- For a non-public tenant, when there are no providers added in the core, the SDK used to fallback to the providers added in the ThirdParty.init. Now, the SDK will not fallback to the providers added in the ThirdParty.init by default. If you require a thirdparty provider to be available for non-public tenants, you can make it available by setting `include_in_non_public_tenants_by_default` for each of the providers. See the migration section below to see how to do this. Note that this only affects non-public tenants when there are no providers added in core.
25+
26+
### Migration
27+
28+
#### Make providers available in non-public tenants by default
29+
30+
To make all the providers added in the ThirdParty.init available for non-public tenants by default,
31+
32+
Before:
33+
34+
```py
35+
thirdparty.init(
36+
sign_in_and_up_feature=thirdparty.SignInAndUpFeature(
37+
providers=[
38+
thirdparty.ProviderInput(
39+
config=thirdparty.ProviderConfig(
40+
third_party_id="google",
41+
# rest of the config
42+
)
43+
),
44+
thirdparty.ProviderInput(
45+
config=thirdparty.ProviderConfig(
46+
third_party_id="github",
47+
# rest of the config
48+
)
49+
),
50+
]
51+
)
52+
)
53+
```
54+
55+
After:
56+
57+
```py
58+
thirdparty.init(
59+
sign_in_and_up_feature=thirdparty.SignInAndUpFeature(
60+
providers=[
61+
thirdparty.ProviderInput(
62+
config=thirdparty.ProviderConfig(
63+
third_party_id="google",
64+
# rest of the config
65+
),
66+
67+
# Add the following line to make this provider available in non-public tenants by default
68+
include_in_non_public_tenants_by_default=True
69+
),
70+
thirdparty.ProviderInput(
71+
config=thirdparty.ProviderConfig(
72+
third_party_id="github",
73+
# rest of the config
74+
),
75+
76+
# Add the following line to make this provider available in non-public tenants by default
77+
include_in_non_public_tenants_by_default=True
78+
),
79+
]
80+
)
81+
)
82+
```
83+
84+
#### Migrating `oidc_discover_endpoint` in core (for custom providers only):
85+
86+
For each tenant, do the following
87+
88+
1. GET `/appid-<appId>/<tenantId>/recipe/multitenancy/tenant/v2`
89+
90+
You should see the thirdParty providers in the response using `response.thirdParty.providers`
91+
92+
2. For each config in providers list, if you have `oidcDiscoveryEndpoint` in the config, update it to include `.well-known/openid-configuration` at the end.
93+
94+
Here's a sample code snippet to update the `oidcDiscoveryEndpoint`:
95+
96+
```py
97+
import supertokens_python.recipe.multitenancy.syncio as multitenancy
98+
99+
def is_custom_provider(third_party_id: str) -> bool:
100+
custom_providers = [
101+
"custom",
102+
# ... all your custom thirdPartyIds
103+
]
104+
return third_party_id in custom_providers
105+
106+
107+
tenants_res = multitenancy.list_all_tenants()
108+
109+
for tenant in tenants_res.tenants:
110+
for provider in tenant.third_party.providers:
111+
if is_custom_provider(provider.third_party_id) and provider.oidc_discovery_endpoint:
112+
provider.oidc_discovery_endpoint = provider.oidc_discovery_endpoint.rstrip("/")
113+
provider.oidc_discovery_endpoint += "/.well-known/openid-configuration"
114+
115+
multitenancy.create_or_update_third_party_config(tenant.tenant_id, provider)
116+
```
16117

17118
## [0.23.1] - 2024-07-09
18119

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-
"3.0"
4+
"3.1"
55
]
66
}

0 commit comments

Comments
 (0)