Skip to content

Commit

Permalink
Merge branch '0.16' into feat/twitter-provider
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabhpoddar authored Sep 28, 2023
2 parents 236266c + 2bdd8b1 commit 75615ef
Show file tree
Hide file tree
Showing 24 changed files with 539 additions and 255 deletions.
16 changes: 16 additions & 0 deletions .circleci/config_continue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,22 @@ jobs:
- run: make with-django2x
- run: (cd .circleci/ && ./websiteDjango2x.sh)
- slack/status
test-website-flask-nest-asyncio:
docker:
- image: rishabhpoddar/supertokens_python_driver_testing
resource_class: large
environment:
SUPERTOKENS_NEST_ASYNCIO: "1"
steps:
- checkout
- run: update-alternatives --install "/usr/bin/java" "java" "/usr/java/jdk-15.0.1/bin/java" 2
- run: update-alternatives --install "/usr/bin/javac" "javac" "/usr/java/jdk-15.0.1/bin/javac" 2
- run: git config --global url."https://github.com/".insteadOf ssh://[email protected]/
- run: echo "127.0.0.1 localhost.org" >> /etc/hosts
- run: make with-flask
- run: python -m pip install nest-asyncio
- run: (cd .circleci/ && ./websiteFlask.sh)
- slack/status
test-authreact-fastapi:
docker:
- image: rishabhpoddar/supertokens_python_driver_testing
Expand Down
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [unreleased]

- Add Twitter provider for thirdparty login
- Add `Cache-Control` header for jwks endpoint `/jwt/jwks.json`
- Add `validity_in_secs` to the return value of overridable `get_jwks` recipe function.
- This can be used to control the `Cache-Control` header mentioned above.
- It defaults to `60` or the value set in the cache-control header returned by the core
- This is optional (so you are not required to update your overrides). Returning `None` means that the header won't be set

## [0.16.2] - 2023-09-20

- Allow use of [nest-asyncio](https://pypi.org/project/nest-asyncio/) when env var `SUPERTOKENS_NEST_ASYNCIO=1`.
- Retry Querier request on `AsyncLibraryNotFoundError`

## [0.16.1] - 2023-09-19
- Handle AWS Public URLs (ending with `.amazonaws.com`) separately while extracting TLDs for SameSite attribute.
Expand All @@ -26,10 +36,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Dashboard APIs now return a status code `403` for all non-GET requests if the currently logged in Dashboard User is not listed in the `admins` array
- Now ignoring protected props in the payload in `create_new_session` and `create_new_session_without_request_response`

## [0.15.3] - 2023-09-24
## [0.15.3] - 2023-09-25

- Handle 429 rate limiting from SaaS core instances


## [0.15.2] - 2023-09-23

- Fixed bugs in thirdparty providers: Bitbucket, Boxy-SAML, and Facebook
Expand Down
61 changes: 47 additions & 14 deletions html/supertokens_python/async_to_sync_wrapper.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,34 @@ <h1 class="title">Module <code>supertokens_python.async_to_sync_wrapper</code></

import asyncio
from typing import Any, Coroutine, TypeVar
from os import getenv

_T = TypeVar(&#34;_T&#34;)


def check_event_loop():
def nest_asyncio_enabled():
return getenv(&#34;SUPERTOKENS_NEST_ASYNCIO&#34;, &#34;&#34;) == &#34;1&#34;


def create_or_get_event_loop() -&gt; asyncio.AbstractEventLoop:
try:
asyncio.get_event_loop()
except RuntimeError as ex:
return asyncio.get_event_loop()
except Exception as ex:
if &#34;There is no current event loop in thread&#34; in str(ex):
loop = asyncio.new_event_loop()

if nest_asyncio_enabled():
import nest_asyncio # type: ignore

nest_asyncio.apply(loop) # type: ignore

asyncio.set_event_loop(loop)
return loop
raise ex


def sync(co: Coroutine[Any, Any, _T]) -&gt; _T:
check_event_loop()
loop = asyncio.get_event_loop()
loop = create_or_get_event_loop()
return loop.run_until_complete(co)</code></pre>
</details>
</section>
Expand All @@ -68,22 +80,43 @@ <h1 class="title">Module <code>supertokens_python.async_to_sync_wrapper</code></
<section>
<h2 class="section-title" id="header-functions">Functions</h2>
<dl>
<dt id="supertokens_python.async_to_sync_wrapper.check_event_loop"><code class="name flex">
<span>def <span class="ident">check_event_loop</span></span>(<span>)</span>
<dt id="supertokens_python.async_to_sync_wrapper.create_or_get_event_loop"><code class="name flex">
<span>def <span class="ident">create_or_get_event_loop</span></span>(<span>)> asyncio.events.AbstractEventLoop</span>
</code></dt>
<dd>
<div class="desc"></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def check_event_loop():
<pre><code class="python">def create_or_get_event_loop() -&gt; asyncio.AbstractEventLoop:
try:
asyncio.get_event_loop()
except RuntimeError as ex:
return asyncio.get_event_loop()
except Exception as ex:
if &#34;There is no current event loop in thread&#34; in str(ex):
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)</code></pre>

if nest_asyncio_enabled():
import nest_asyncio # type: ignore

nest_asyncio.apply(loop) # type: ignore

asyncio.set_event_loop(loop)
return loop
raise ex</code></pre>
</details>
</dd>
<dt id="supertokens_python.async_to_sync_wrapper.nest_asyncio_enabled"><code class="name flex">
<span>def <span class="ident">nest_asyncio_enabled</span></span>(<span>)</span>
</code></dt>
<dd>
<div class="desc"></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def nest_asyncio_enabled():
return getenv(&#34;SUPERTOKENS_NEST_ASYNCIO&#34;, &#34;&#34;) == &#34;1&#34;</code></pre>
</details>
</dd>
<dt id="supertokens_python.async_to_sync_wrapper.sync"><code class="name flex">
Expand All @@ -96,8 +129,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
<span>Expand source code</span>
</summary>
<pre><code class="python">def sync(co: Coroutine[Any, Any, _T]) -&gt; _T:
check_event_loop()
loop = asyncio.get_event_loop()
loop = create_or_get_event_loop()
return loop.run_until_complete(co)</code></pre>
</details>
</dd>
Expand All @@ -119,7 +151,8 @@ <h2>Index</h2>
</li>
<li><h3><a href="#header-functions">Functions</a></h3>
<ul class="">
<li><code><a title="supertokens_python.async_to_sync_wrapper.check_event_loop" href="#supertokens_python.async_to_sync_wrapper.check_event_loop">check_event_loop</a></code></li>
<li><code><a title="supertokens_python.async_to_sync_wrapper.create_or_get_event_loop" href="#supertokens_python.async_to_sync_wrapper.create_or_get_event_loop">create_or_get_event_loop</a></code></li>
<li><code><a title="supertokens_python.async_to_sync_wrapper.nest_asyncio_enabled" href="#supertokens_python.async_to_sync_wrapper.nest_asyncio_enabled">nest_asyncio_enabled</a></code></li>
<li><code><a title="supertokens_python.async_to_sync_wrapper.sync" href="#supertokens_python.async_to_sync_wrapper.sync">sync</a></code></li>
</ul>
</li>
Expand Down
2 changes: 1 addition & 1 deletion html/supertokens_python/constants.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ <h1 class="title">Module <code>supertokens_python.constants</code></h1>
from __future__ import annotations

SUPPORTED_CDI_VERSIONS = [&#34;3.0&#34;]
VERSION = &#34;0.16.1&#34;
VERSION = &#34;0.16.2&#34;
TELEMETRY = &#34;/telemetry&#34;
USER_COUNT = &#34;/users/count&#34;
USER_DELETE = &#34;/user/remove&#34;
Expand Down
24 changes: 17 additions & 7 deletions html/supertokens_python/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h1 class="title">Package <code>supertokens_python</code></h1>
# License for the specific language governing permissions and limitations
# under the License.

from typing import Any, Callable, Dict, List, Optional, Union
from typing import Any, Callable, Dict, List, Optional

from typing_extensions import Literal

Expand All @@ -60,11 +60,16 @@ <h1 class="title">Package <code>supertokens_python</code></h1>
framework: Literal[&#34;fastapi&#34;, &#34;flask&#34;, &#34;django&#34;],
supertokens_config: SupertokensConfig,
recipe_list: List[Callable[[supertokens.AppInfo], RecipeModule]],
mode: Union[Literal[&#34;asgi&#34;, &#34;wsgi&#34;], None] = None,
telemetry: Union[bool, None] = None,
mode: Optional[Literal[&#34;asgi&#34;, &#34;wsgi&#34;]] = None,
telemetry: Optional[bool] = None,
):
return Supertokens.init(
app_info, framework, supertokens_config, recipe_list, mode, telemetry
app_info,
framework,
supertokens_config,
recipe_list,
mode,
telemetry,
)


Expand Down Expand Up @@ -206,11 +211,16 @@ <h2 class="section-title" id="header-functions">Functions</h2>
framework: Literal[&#34;fastapi&#34;, &#34;flask&#34;, &#34;django&#34;],
supertokens_config: SupertokensConfig,
recipe_list: List[Callable[[supertokens.AppInfo], RecipeModule]],
mode: Union[Literal[&#34;asgi&#34;, &#34;wsgi&#34;], None] = None,
telemetry: Union[bool, None] = None,
mode: Optional[Literal[&#34;asgi&#34;, &#34;wsgi&#34;]] = None,
telemetry: Optional[bool] = None,
):
return Supertokens.init(
app_info, framework, supertokens_config, recipe_list, mode, telemetry
app_info,
framework,
supertokens_config,
recipe_list,
mode,
telemetry,
)</code></pre>
</details>
</dd>
Expand Down
Loading

0 comments on commit 75615ef

Please sign in to comment.