Skip to content

Commit 77e3463

Browse files
committed
adding dev-v0.12.3 tag to this commit to ensure building
1 parent ef02e0f commit 77e3463

File tree

16 files changed

+672
-120
lines changed

16 files changed

+672
-120
lines changed

html/supertokens_python/constants.html

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,19 @@ <h1 class="title">Module <code>supertokens_python.constants</code></h1>
3939
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
4040
# License for the specific language governing permissions and limitations
4141
# under the License.
42-
SUPPORTED_CDI_VERSIONS = [&#34;2.9&#34;, &#34;2.10&#34;, &#34;2.11&#34;, &#34;2.12&#34;, &#34;2.13&#34;, &#34;2.14&#34;, &#34;2.15&#34;]
43-
VERSION = &#34;0.12.2&#34;
42+
SUPPORTED_CDI_VERSIONS = [
43+
&#34;2.9&#34;,
44+
&#34;2.10&#34;,
45+
&#34;2.11&#34;,
46+
&#34;2.12&#34;,
47+
&#34;2.13&#34;,
48+
&#34;2.14&#34;,
49+
&#34;2.15&#34;,
50+
&#34;2.16&#34;,
51+
&#34;2.17&#34;,
52+
&#34;2.18&#34;,
53+
]
54+
VERSION = &#34;0.12.3&#34;
4455
TELEMETRY = &#34;/telemetry&#34;
4556
USER_COUNT = &#34;/users/count&#34;
4657
USER_DELETE = &#34;/user/remove&#34;
@@ -53,7 +64,7 @@ <h1 class="title">Module <code>supertokens_python.constants</code></h1>
5364
FDI_KEY_HEADER = &#34;fdi-version&#34;
5465
API_VERSION = &#34;/apiversion&#34;
5566
API_VERSION_HEADER = &#34;cdi-version&#34;
56-
DASHBOARD_VERSION = &#34;0.3&#34;</code></pre>
67+
DASHBOARD_VERSION = &#34;0.4&#34;</code></pre>
5768
</details>
5869
</section>
5970
<section>

html/supertokens_python/querier.html

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,18 @@ <h1 class="title">Module <code>supertokens_python.querier</code></h1>
194194

195195
return await self.__send_request_helper(path, &#34;POST&#34;, f, len(self.__hosts))
196196

197-
async def send_delete_request(self, path: NormalisedURLPath):
197+
async def send_delete_request(
198+
self, path: NormalisedURLPath, params: Union[Dict[str, Any], None] = None
199+
):
200+
if params is None:
201+
params = {}
202+
198203
async def f(url: str) -&gt; Response:
199204
async with AsyncClient() as client:
200205
return await client.delete( # type:ignore
201-
url, headers=await self.__get_headers_with_api_version(path)
206+
url,
207+
params=params,
208+
headers=await self.__get_headers_with_api_version(path),
202209
)
203210

204211
return await self.__send_request_helper(path, &#34;DELETE&#34;, f, len(self.__hosts))
@@ -421,11 +428,18 @@ <h2 class="section-title" id="header-classes">Classes</h2>
421428

422429
return await self.__send_request_helper(path, &#34;POST&#34;, f, len(self.__hosts))
423430

424-
async def send_delete_request(self, path: NormalisedURLPath):
431+
async def send_delete_request(
432+
self, path: NormalisedURLPath, params: Union[Dict[str, Any], None] = None
433+
):
434+
if params is None:
435+
params = {}
436+
425437
async def f(url: str) -&gt; Response:
426438
async with AsyncClient() as client:
427439
return await client.delete( # type:ignore
428-
url, headers=await self.__get_headers_with_api_version(path)
440+
url,
441+
params=params,
442+
headers=await self.__get_headers_with_api_version(path),
429443
)
430444

431445
return await self.__send_request_helper(path, &#34;DELETE&#34;, f, len(self.__hosts))
@@ -621,19 +635,26 @@ <h3>Methods</h3>
621635
</details>
622636
</dd>
623637
<dt id="supertokens_python.querier.Querier.send_delete_request"><code class="name flex">
624-
<span>async def <span class="ident">send_delete_request</span></span>(<span>self, path: NormalisedURLPath)</span>
638+
<span>async def <span class="ident">send_delete_request</span></span>(<span>self, path: NormalisedURLPath, params: Union[Dict[str, Any], None] = None)</span>
625639
</code></dt>
626640
<dd>
627641
<div class="desc"></div>
628642
<details class="source">
629643
<summary>
630644
<span>Expand source code</span>
631645
</summary>
632-
<pre><code class="python">async def send_delete_request(self, path: NormalisedURLPath):
646+
<pre><code class="python">async def send_delete_request(
647+
self, path: NormalisedURLPath, params: Union[Dict[str, Any], None] = None
648+
):
649+
if params is None:
650+
params = {}
651+
633652
async def f(url: str) -&gt; Response:
634653
async with AsyncClient() as client:
635654
return await client.delete( # type:ignore
636-
url, headers=await self.__get_headers_with_api_version(path)
655+
url,
656+
params=params,
657+
headers=await self.__get_headers_with_api_version(path),
637658
)
638659

639660
return await self.__send_request_helper(path, &#34;DELETE&#34;, f, len(self.__hosts))</code></pre>

html/supertokens_python/recipe/dashboard/api/implementation.html

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,12 @@ <h1 class="title">Module <code>supertokens_python.recipe.dashboard.api.implement
4545
from textwrap import dedent
4646
from typing import TYPE_CHECKING, Any, Dict
4747

48-
from supertokens_python.normalised_url_domain import NormalisedURLDomain
4948
from supertokens_python import Supertokens
49+
from supertokens_python.normalised_url_domain import NormalisedURLDomain
5050
from supertokens_python.normalised_url_path import NormalisedURLPath
51+
5152
from ..constants import DASHBOARD_API
52-
from ..interfaces import (
53-
APIInterface,
54-
)
53+
from ..interfaces import APIInterface
5554

5655
if TYPE_CHECKING:
5756
from ..interfaces import APIOptions
@@ -76,7 +75,7 @@ <h1 class="title">Module <code>supertokens_python.recipe.dashboard.api.implement
7675

7776
connection_uri = &#34;&#34;
7877
super_tokens_instance = Supertokens.get_instance()
79-
78+
auth_mode = options.config.auth_mode
8079
connection_uri = super_tokens_instance.supertokens_config.connection_uri
8180

8281
dashboard_path = options.app_info.api_base_path.append(
@@ -93,6 +92,7 @@ <h1 class="title">Module <code>supertokens_python.recipe.dashboard.api.implement
9392
window.staticBasePath = &#34;${bundleDomain}/static&#34;
9493
window.dashboardAppPath = &#34;${dashboardPath}&#34;
9594
window.connectionURI = &#34;${connectionURI}&#34;
95+
window.authMode = &#34;${authMode}&#34;
9696
&lt;/script&gt;
9797
&lt;script defer src=&#34;${bundleDomain}/static/js/bundle.js&#34;&gt;&lt;/script&gt;&lt;/head&gt;
9898
&lt;link href=&#34;${bundleDomain}/static/css/main.css&#34; rel=&#34;stylesheet&#34; type=&#34;text/css&#34;&gt;
@@ -109,6 +109,7 @@ <h1 class="title">Module <code>supertokens_python.recipe.dashboard.api.implement
109109
bundleDomain=bundle_domain,
110110
dashboardPath=dashboard_path,
111111
connectionURI=connection_uri,
112+
authMode=auth_mode,
112113
)
113114

114115
self.dashboard_get = dashboard_get</code></pre>
@@ -151,7 +152,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
151152

152153
connection_uri = &#34;&#34;
153154
super_tokens_instance = Supertokens.get_instance()
154-
155+
auth_mode = options.config.auth_mode
155156
connection_uri = super_tokens_instance.supertokens_config.connection_uri
156157

157158
dashboard_path = options.app_info.api_base_path.append(
@@ -168,6 +169,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
168169
window.staticBasePath = &#34;${bundleDomain}/static&#34;
169170
window.dashboardAppPath = &#34;${dashboardPath}&#34;
170171
window.connectionURI = &#34;${connectionURI}&#34;
172+
window.authMode = &#34;${authMode}&#34;
171173
&lt;/script&gt;
172174
&lt;script defer src=&#34;${bundleDomain}/static/js/bundle.js&#34;&gt;&lt;/script&gt;&lt;/head&gt;
173175
&lt;link href=&#34;${bundleDomain}/static/css/main.css&#34; rel=&#34;stylesheet&#34; type=&#34;text/css&#34;&gt;
@@ -184,6 +186,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
184186
bundleDomain=bundle_domain,
185187
dashboardPath=dashboard_path,
186188
connectionURI=connection_uri,
189+
authMode=auth_mode,
187190
)
188191

189192
self.dashboard_get = dashboard_get</code></pre>

html/supertokens_python/recipe/dashboard/api/index.html

Lines changed: 90 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ <h1 class="title">Module <code>supertokens_python.recipe.dashboard.api</code></h
4141
# under the License.
4242
from .api_key_protector import api_key_protector
4343
from .dashboard import handle_dashboard_api
44+
from .signin import handle_emailpassword_signin_api
45+
from .signout import handle_emailpassword_signout_api
4446
from .userdetails.user_delete import handle_user_delete
4547
from .userdetails.user_email_verify_get import handle_user_email_verify_get
4648
from .userdetails.user_email_verify_put import handle_user_email_verify_put
@@ -73,6 +75,8 @@ <h1 class="title">Module <code>supertokens_python.recipe.dashboard.api</code></h
7375
&#34;handle_user_sessions_post&#34;,
7476
&#34;handle_user_password_put&#34;,
7577
&#34;handle_email_verify_token_post&#34;,
78+
&#34;handle_emailpassword_signin_api&#34;,
79+
&#34;handle_emailpassword_signout_api&#34;,
7680
]</code></pre>
7781
</details>
7882
</section>
@@ -87,6 +91,14 @@ <h2 class="section-title" id="header-submodules">Sub-modules</h2>
8791
<dd>
8892
<div class="desc"></div>
8993
</dd>
94+
<dt><code class="name"><a title="supertokens_python.recipe.dashboard.api.signin" href="signin.html">supertokens_python.recipe.dashboard.api.signin</a></code></dt>
95+
<dd>
96+
<div class="desc"></div>
97+
</dd>
98+
<dt><code class="name"><a title="supertokens_python.recipe.dashboard.api.signout" href="signout.html">supertokens_python.recipe.dashboard.api.signout</a></code></dt>
99+
<dd>
100+
<div class="desc"></div>
101+
</dd>
90102
<dt><code class="name"><a title="supertokens_python.recipe.dashboard.api.userdetails" href="userdetails/index.html">supertokens_python.recipe.dashboard.api.userdetails</a></code></dt>
91103
<dd>
92104
<div class="desc"></div>
@@ -214,6 +226,74 @@ <h2 class="section-title" id="header-functions">Functions</h2>
214226
return UserEmailVerifyTokenPostAPIOkResponse()</code></pre>
215227
</details>
216228
</dd>
229+
<dt id="supertokens_python.recipe.dashboard.api.handle_emailpassword_signin_api"><code class="name flex">
230+
<span>async def <span class="ident">handle_emailpassword_signin_api</span></span>(<span>_: APIInterface, api_options: APIOptions)</span>
231+
</code></dt>
232+
<dd>
233+
<div class="desc"></div>
234+
<details class="source">
235+
<summary>
236+
<span>Expand source code</span>
237+
</summary>
238+
<pre><code class="python">async def handle_emailpassword_signin_api(_: APIInterface, api_options: APIOptions):
239+
body = await api_options.request.json()
240+
if body is None:
241+
raise_bad_input_exception(&#34;Please send body&#34;)
242+
email = body.get(&#34;email&#34;)
243+
password = body.get(&#34;password&#34;)
244+
245+
if email is None or not isinstance(email, str):
246+
raise_bad_input_exception(&#34;Missing required parameter &#39;email&#39;&#34;)
247+
if password is None or not isinstance(password, str):
248+
raise_bad_input_exception(&#34;Missing required parameter &#39;password&#39;&#34;)
249+
response = await Querier.get_instance().send_post_request(
250+
NormalisedURLPath(&#34;/recipe/dashboard/signin&#34;),
251+
{&#34;email&#34;: email, &#34;password&#34;: password},
252+
)
253+
254+
if &#34;status&#34; in response and response[&#34;status&#34;] == &#34;OK&#34;:
255+
return send_200_response(
256+
{&#34;status&#34;: &#34;OK&#34;, &#34;sessionId&#34;: response[&#34;sessionId&#34;]}, api_options.response
257+
)
258+
if &#34;status&#34; in response and response[&#34;status&#34;] == &#34;INVALID_CREDENTIALS_ERROR&#34;:
259+
return send_200_response(
260+
{&#34;status&#34;: &#34;INVALID_CREDENTIALS_ERROR&#34;},
261+
api_options.response,
262+
)
263+
if &#34;status&#34; in response and response[&#34;status&#34;] == &#34;USER_SUSPENDED_ERROR&#34;:
264+
return send_200_response(
265+
{&#34;status&#34;: &#34;USER_SUSPENDED_ERROR&#34;, &#34;message&#34;: response[&#34;message&#34;]},
266+
api_options.response,
267+
)</code></pre>
268+
</details>
269+
</dd>
270+
<dt id="supertokens_python.recipe.dashboard.api.handle_emailpassword_signout_api"><code class="name flex">
271+
<span>async def <span class="ident">handle_emailpassword_signout_api</span></span>(<span>_: APIInterface, api_options: APIOptions) ‑> SignOutOK</span>
272+
</code></dt>
273+
<dd>
274+
<div class="desc"></div>
275+
<details class="source">
276+
<summary>
277+
<span>Expand source code</span>
278+
</summary>
279+
<pre><code class="python">async def handle_emailpassword_signout_api(
280+
_: APIInterface, api_options: APIOptions
281+
) -&gt; SignOutOK:
282+
if api_options.config.auth_mode == &#34;api-key&#34;:
283+
return SignOutOK()
284+
session_id_form_auth_header = api_options.request.get_header(&#34;authorization&#34;)
285+
if not session_id_form_auth_header:
286+
return raise_bad_input_exception(
287+
&#34;Neither &#39;API Key&#39; nor &#39;Authorization&#39; header was found&#34;
288+
)
289+
session_id_form_auth_header = session_id_form_auth_header.split()[1]
290+
await Querier.get_instance().send_delete_request(
291+
NormalisedURLPath(&#34;/recipe/dashboard/session&#34;),
292+
{&#34;sessionId&#34;: session_id_form_auth_header},
293+
)
294+
return SignOutOK()</code></pre>
295+
</details>
296+
</dd>
217297
<dt id="supertokens_python.recipe.dashboard.api.handle_metadata_get"><code class="name flex">
218298
<span>async def <span class="ident">handle_metadata_get</span></span>(<span>_api_interface: <a title="supertokens_python.recipe.dashboard.interfaces.APIInterface" href="../interfaces.html#supertokens_python.recipe.dashboard.interfaces.APIInterface">APIInterface</a>, api_options: <a title="supertokens_python.recipe.dashboard.interfaces.APIOptions" href="../interfaces.html#supertokens_python.recipe.dashboard.interfaces.APIOptions">APIOptions</a>) ‑> Union[<a title="supertokens_python.recipe.dashboard.interfaces.UserMetadataGetAPIOkResponse" href="../interfaces.html#supertokens_python.recipe.dashboard.interfaces.UserMetadataGetAPIOkResponse">UserMetadataGetAPIOkResponse</a><a title="supertokens_python.recipe.dashboard.interfaces.FeatureNotEnabledError" href="../interfaces.html#supertokens_python.recipe.dashboard.interfaces.FeatureNotEnabledError">FeatureNotEnabledError</a>]</span>
219299
</code></dt>
@@ -824,7 +904,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
824904
</details>
825905
</dd>
826906
<dt id="supertokens_python.recipe.dashboard.api.handle_validate_key_api"><code class="name flex">
827-
<span>async def <span class="ident">handle_validate_key_api</span></span>(<span>api_implementation: APIInterface, api_options: APIOptions)</span>
907+
<span>async def <span class="ident">handle_validate_key_api</span></span>(<span>_api_implementation: APIInterface, api_options: APIOptions)</span>
828908
</code></dt>
829909
<dd>
830910
<div class="desc"></div>
@@ -833,21 +913,14 @@ <h2 class="section-title" id="header-functions">Functions</h2>
833913
<span>Expand source code</span>
834914
</summary>
835915
<pre><code class="python">async def handle_validate_key_api(
836-
api_implementation: APIInterface, api_options: APIOptions
916+
_api_implementation: APIInterface, api_options: APIOptions
837917
):
838-
_ = api_implementation
839918

840-
should_allow_accesss = await api_options.recipe_implementation.should_allow_access(
841-
api_options.request,
842-
api_options.config,
843-
default_user_context(api_options.request),
844-
)
845-
if should_allow_accesss is False:
846-
return send_non_200_response_with_message(
847-
&#34;Unauthorized access&#34;, 401, api_options.response
848-
)
919+
is_valid_key = validate_api_key(api_options.request, api_options.config)
849920

850-
return send_200_response({&#34;status&#34;: &#34;OK&#34;}, api_options.response)</code></pre>
921+
if is_valid_key:
922+
return send_200_response({&#34;status&#34;: &#34;OK&#34;}, api_options.response)
923+
return send_non_200_response_with_message(&#34;Unauthorised&#34;, 401, api_options.response)</code></pre>
851924
</details>
852925
</dd>
853926
</dl>
@@ -870,6 +943,8 @@ <h2>Index</h2>
870943
<ul>
871944
<li><code><a title="supertokens_python.recipe.dashboard.api.dashboard" href="dashboard.html">supertokens_python.recipe.dashboard.api.dashboard</a></code></li>
872945
<li><code><a title="supertokens_python.recipe.dashboard.api.implementation" href="implementation.html">supertokens_python.recipe.dashboard.api.implementation</a></code></li>
946+
<li><code><a title="supertokens_python.recipe.dashboard.api.signin" href="signin.html">supertokens_python.recipe.dashboard.api.signin</a></code></li>
947+
<li><code><a title="supertokens_python.recipe.dashboard.api.signout" href="signout.html">supertokens_python.recipe.dashboard.api.signout</a></code></li>
873948
<li><code><a title="supertokens_python.recipe.dashboard.api.userdetails" href="userdetails/index.html">supertokens_python.recipe.dashboard.api.userdetails</a></code></li>
874949
<li><code><a title="supertokens_python.recipe.dashboard.api.users_count_get" href="users_count_get.html">supertokens_python.recipe.dashboard.api.users_count_get</a></code></li>
875950
<li><code><a title="supertokens_python.recipe.dashboard.api.users_get" href="users_get.html">supertokens_python.recipe.dashboard.api.users_get</a></code></li>
@@ -881,6 +956,8 @@ <h2>Index</h2>
881956
<li><code><a title="supertokens_python.recipe.dashboard.api.api_key_protector" href="#supertokens_python.recipe.dashboard.api.api_key_protector">api_key_protector</a></code></li>
882957
<li><code><a title="supertokens_python.recipe.dashboard.api.handle_dashboard_api" href="#supertokens_python.recipe.dashboard.api.handle_dashboard_api">handle_dashboard_api</a></code></li>
883958
<li><code><a title="supertokens_python.recipe.dashboard.api.handle_email_verify_token_post" href="#supertokens_python.recipe.dashboard.api.handle_email_verify_token_post">handle_email_verify_token_post</a></code></li>
959+
<li><code><a title="supertokens_python.recipe.dashboard.api.handle_emailpassword_signin_api" href="#supertokens_python.recipe.dashboard.api.handle_emailpassword_signin_api">handle_emailpassword_signin_api</a></code></li>
960+
<li><code><a title="supertokens_python.recipe.dashboard.api.handle_emailpassword_signout_api" href="#supertokens_python.recipe.dashboard.api.handle_emailpassword_signout_api">handle_emailpassword_signout_api</a></code></li>
884961
<li><code><a title="supertokens_python.recipe.dashboard.api.handle_metadata_get" href="#supertokens_python.recipe.dashboard.api.handle_metadata_get">handle_metadata_get</a></code></li>
885962
<li><code><a title="supertokens_python.recipe.dashboard.api.handle_metadata_put" href="#supertokens_python.recipe.dashboard.api.handle_metadata_put">handle_metadata_put</a></code></li>
886963
<li><code><a title="supertokens_python.recipe.dashboard.api.handle_sessions_get" href="#supertokens_python.recipe.dashboard.api.handle_sessions_get">handle_sessions_get</a></code></li>

0 commit comments

Comments
 (0)