Skip to content

Commit a82a191

Browse files
Merge branch '0.16' into fix/failing-test
2 parents 5d6a96e + 6620ea5 commit a82a191

18 files changed

+445
-101
lines changed

html/supertokens_python/constants.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ <h1 class="title">Module <code>supertokens_python.constants</code></h1>
4242
from __future__ import annotations
4343

4444
SUPPORTED_CDI_VERSIONS = [&#34;3.0&#34;]
45-
VERSION = &#34;0.15.3&#34;
45+
VERSION = &#34;0.16.0&#34;
4646
TELEMETRY = &#34;/telemetry&#34;
4747
USER_COUNT = &#34;/users/count&#34;
4848
USER_DELETE = &#34;/user/remove&#34;

html/supertokens_python/framework/django/django_request.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ <h1 class="title">Module <code>supertokens_python.framework.django.django_reques
5757
super().__init__()
5858
self.request = request
5959

60+
def get_original_url(self) -&gt; str:
61+
return self.request.get_raw_uri()
62+
6063
def get_query_param(
6164
self, key: str, default: Union[str, None] = None
6265
) -&gt; Union[str, None]:
@@ -126,6 +129,9 @@ <h2 class="section-title" id="header-classes">Classes</h2>
126129
super().__init__()
127130
self.request = request
128131

132+
def get_original_url(self) -&gt; str:
133+
return self.request.get_raw_uri()
134+
129135
def get_query_param(
130136
self, key: str, default: Union[str, None] = None
131137
) -&gt; Union[str, None]:
@@ -217,6 +223,19 @@ <h3>Methods</h3>
217223
return self.request.META.get(key.upper())</code></pre>
218224
</details>
219225
</dd>
226+
<dt id="supertokens_python.framework.django.django_request.DjangoRequest.get_original_url"><code class="name flex">
227+
<span>def <span class="ident">get_original_url</span></span>(<span>self) ‑> str</span>
228+
</code></dt>
229+
<dd>
230+
<div class="desc"></div>
231+
<details class="source">
232+
<summary>
233+
<span>Expand source code</span>
234+
</summary>
235+
<pre><code class="python">def get_original_url(self) -&gt; str:
236+
return self.request.get_raw_uri()</code></pre>
237+
</details>
238+
</dd>
220239
<dt id="supertokens_python.framework.django.django_request.DjangoRequest.get_path"><code class="name flex">
221240
<span>def <span class="ident">get_path</span></span>(<span>self) ‑> str</span>
222241
</code></dt>
@@ -348,6 +367,7 @@ <h4><code><a title="supertokens_python.framework.django.django_request.DjangoReq
348367
<li><code><a title="supertokens_python.framework.django.django_request.DjangoRequest.form_data" href="#supertokens_python.framework.django.django_request.DjangoRequest.form_data">form_data</a></code></li>
349368
<li><code><a title="supertokens_python.framework.django.django_request.DjangoRequest.get_cookie" href="#supertokens_python.framework.django.django_request.DjangoRequest.get_cookie">get_cookie</a></code></li>
350369
<li><code><a title="supertokens_python.framework.django.django_request.DjangoRequest.get_header" href="#supertokens_python.framework.django.django_request.DjangoRequest.get_header">get_header</a></code></li>
370+
<li><code><a title="supertokens_python.framework.django.django_request.DjangoRequest.get_original_url" href="#supertokens_python.framework.django.django_request.DjangoRequest.get_original_url">get_original_url</a></code></li>
351371
<li><code><a title="supertokens_python.framework.django.django_request.DjangoRequest.get_path" href="#supertokens_python.framework.django.django_request.DjangoRequest.get_path">get_path</a></code></li>
352372
<li><code><a title="supertokens_python.framework.django.django_request.DjangoRequest.get_query_param" href="#supertokens_python.framework.django.django_request.DjangoRequest.get_query_param">get_query_param</a></code></li>
353373
<li><code><a title="supertokens_python.framework.django.django_request.DjangoRequest.get_query_params" href="#supertokens_python.framework.django.django_request.DjangoRequest.get_query_params">get_query_params</a></code></li>

html/supertokens_python/framework/fastapi/fastapi_request.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ <h1 class="title">Module <code>supertokens_python.framework.fastapi.fastapi_requ
5656
super().__init__()
5757
self.request = request
5858

59+
def get_original_url(self) -&gt; str:
60+
return self.request.url.components.geturl()
61+
5962
def get_query_param(
6063
self, key: str, default: Union[str, None] = None
6164
) -&gt; Union[str, None]:
@@ -126,6 +129,9 @@ <h2 class="section-title" id="header-classes">Classes</h2>
126129
super().__init__()
127130
self.request = request
128131

132+
def get_original_url(self) -&gt; str:
133+
return self.request.url.components.geturl()
134+
129135
def get_query_param(
130136
self, key: str, default: Union[str, None] = None
131137
) -&gt; Union[str, None]:
@@ -218,6 +224,19 @@ <h3>Methods</h3>
218224
return self.request.headers.get(key, None)</code></pre>
219225
</details>
220226
</dd>
227+
<dt id="supertokens_python.framework.fastapi.fastapi_request.FastApiRequest.get_original_url"><code class="name flex">
228+
<span>def <span class="ident">get_original_url</span></span>(<span>self) ‑> str</span>
229+
</code></dt>
230+
<dd>
231+
<div class="desc"></div>
232+
<details class="source">
233+
<summary>
234+
<span>Expand source code</span>
235+
</summary>
236+
<pre><code class="python">def get_original_url(self) -&gt; str:
237+
return self.request.url.components.geturl()</code></pre>
238+
</details>
239+
</dd>
221240
<dt id="supertokens_python.framework.fastapi.fastapi_request.FastApiRequest.get_path"><code class="name flex">
222241
<span>def <span class="ident">get_path</span></span>(<span>self) ‑> str</span>
223242
</code></dt>
@@ -350,6 +369,7 @@ <h4><code><a title="supertokens_python.framework.fastapi.fastapi_request.FastApi
350369
<li><code><a title="supertokens_python.framework.fastapi.fastapi_request.FastApiRequest.form_data" href="#supertokens_python.framework.fastapi.fastapi_request.FastApiRequest.form_data">form_data</a></code></li>
351370
<li><code><a title="supertokens_python.framework.fastapi.fastapi_request.FastApiRequest.get_cookie" href="#supertokens_python.framework.fastapi.fastapi_request.FastApiRequest.get_cookie">get_cookie</a></code></li>
352371
<li><code><a title="supertokens_python.framework.fastapi.fastapi_request.FastApiRequest.get_header" href="#supertokens_python.framework.fastapi.fastapi_request.FastApiRequest.get_header">get_header</a></code></li>
372+
<li><code><a title="supertokens_python.framework.fastapi.fastapi_request.FastApiRequest.get_original_url" href="#supertokens_python.framework.fastapi.fastapi_request.FastApiRequest.get_original_url">get_original_url</a></code></li>
353373
<li><code><a title="supertokens_python.framework.fastapi.fastapi_request.FastApiRequest.get_path" href="#supertokens_python.framework.fastapi.fastapi_request.FastApiRequest.get_path">get_path</a></code></li>
354374
<li><code><a title="supertokens_python.framework.fastapi.fastapi_request.FastApiRequest.get_query_param" href="#supertokens_python.framework.fastapi.fastapi_request.FastApiRequest.get_query_param">get_query_param</a></code></li>
355375
<li><code><a title="supertokens_python.framework.fastapi.fastapi_request.FastApiRequest.get_query_params" href="#supertokens_python.framework.fastapi.fastapi_request.FastApiRequest.get_query_params">get_query_params</a></code></li>

html/supertokens_python/framework/flask/flask_request.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ <h1 class="title">Module <code>supertokens_python.framework.flask.flask_request<
5555
super().__init__()
5656
self.request = req
5757

58+
def get_original_url(self) -&gt; str:
59+
return self.request.url
60+
5861
def get_query_param(self, key: str, default: Union[str, None] = None):
5962
return self.request.args.get(key, default)
6063

@@ -133,6 +136,9 @@ <h2 class="section-title" id="header-classes">Classes</h2>
133136
super().__init__()
134137
self.request = req
135138

139+
def get_original_url(self) -&gt; str:
140+
return self.request.url
141+
136142
def get_query_param(self, key: str, default: Union[str, None] = None):
137143
return self.request.args.get(key, default)
138144

@@ -233,6 +239,19 @@ <h3>Methods</h3>
233239
return self.request.headers.get(key) # type: ignore</code></pre>
234240
</details>
235241
</dd>
242+
<dt id="supertokens_python.framework.flask.flask_request.FlaskRequest.get_original_url"><code class="name flex">
243+
<span>def <span class="ident">get_original_url</span></span>(<span>self) ‑> str</span>
244+
</code></dt>
245+
<dd>
246+
<div class="desc"></div>
247+
<details class="source">
248+
<summary>
249+
<span>Expand source code</span>
250+
</summary>
251+
<pre><code class="python">def get_original_url(self) -&gt; str:
252+
return self.request.url</code></pre>
253+
</details>
254+
</dd>
236255
<dt id="supertokens_python.framework.flask.flask_request.FlaskRequest.get_path"><code class="name flex">
237256
<span>def <span class="ident">get_path</span></span>(<span>self) ‑> str</span>
238257
</code></dt>
@@ -371,6 +390,7 @@ <h4><code><a title="supertokens_python.framework.flask.flask_request.FlaskReques
371390
<li><code><a title="supertokens_python.framework.flask.flask_request.FlaskRequest.form_data" href="#supertokens_python.framework.flask.flask_request.FlaskRequest.form_data">form_data</a></code></li>
372391
<li><code><a title="supertokens_python.framework.flask.flask_request.FlaskRequest.get_cookie" href="#supertokens_python.framework.flask.flask_request.FlaskRequest.get_cookie">get_cookie</a></code></li>
373392
<li><code><a title="supertokens_python.framework.flask.flask_request.FlaskRequest.get_header" href="#supertokens_python.framework.flask.flask_request.FlaskRequest.get_header">get_header</a></code></li>
393+
<li><code><a title="supertokens_python.framework.flask.flask_request.FlaskRequest.get_original_url" href="#supertokens_python.framework.flask.flask_request.FlaskRequest.get_original_url">get_original_url</a></code></li>
374394
<li><code><a title="supertokens_python.framework.flask.flask_request.FlaskRequest.get_path" href="#supertokens_python.framework.flask.flask_request.FlaskRequest.get_path">get_path</a></code></li>
375395
<li><code><a title="supertokens_python.framework.flask.flask_request.FlaskRequest.get_query_param" href="#supertokens_python.framework.flask.flask_request.FlaskRequest.get_query_param">get_query_param</a></code></li>
376396
<li><code><a title="supertokens_python.framework.flask.flask_request.FlaskRequest.get_query_params" href="#supertokens_python.framework.flask.flask_request.FlaskRequest.get_query_params">get_query_params</a></code></li>

html/supertokens_python/framework/request.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ <h1 class="title">Module <code>supertokens_python.framework.request</code></h1>
5353
self.wrapper_used = True
5454
self.request = None
5555

56+
@abstractmethod
57+
def get_original_url(self) -&gt; str:
58+
pass
59+
5660
@abstractmethod
5761
def get_query_param(
5862
self, key: str, default: Union[str, None] = None
@@ -127,6 +131,10 @@ <h2 class="section-title" id="header-classes">Classes</h2>
127131
self.wrapper_used = True
128132
self.request = None
129133

134+
@abstractmethod
135+
def get_original_url(self) -&gt; str:
136+
pass
137+
130138
@abstractmethod
131139
def get_query_param(
132140
self, key: str, default: Union[str, None] = None
@@ -230,6 +238,20 @@ <h3>Methods</h3>
230238
pass</code></pre>
231239
</details>
232240
</dd>
241+
<dt id="supertokens_python.framework.request.BaseRequest.get_original_url"><code class="name flex">
242+
<span>def <span class="ident">get_original_url</span></span>(<span>self) ‑> str</span>
243+
</code></dt>
244+
<dd>
245+
<div class="desc"></div>
246+
<details class="source">
247+
<summary>
248+
<span>Expand source code</span>
249+
</summary>
250+
<pre><code class="python">@abstractmethod
251+
def get_original_url(self) -&gt; str:
252+
pass</code></pre>
253+
</details>
254+
</dd>
233255
<dt id="supertokens_python.framework.request.BaseRequest.get_path"><code class="name flex">
234256
<span>def <span class="ident">get_path</span></span>(<span>self) ‑> str</span>
235257
</code></dt>
@@ -372,6 +394,7 @@ <h4><code><a title="supertokens_python.framework.request.BaseRequest" href="#sup
372394
<li><code><a title="supertokens_python.framework.request.BaseRequest.form_data" href="#supertokens_python.framework.request.BaseRequest.form_data">form_data</a></code></li>
373395
<li><code><a title="supertokens_python.framework.request.BaseRequest.get_cookie" href="#supertokens_python.framework.request.BaseRequest.get_cookie">get_cookie</a></code></li>
374396
<li><code><a title="supertokens_python.framework.request.BaseRequest.get_header" href="#supertokens_python.framework.request.BaseRequest.get_header">get_header</a></code></li>
397+
<li><code><a title="supertokens_python.framework.request.BaseRequest.get_original_url" href="#supertokens_python.framework.request.BaseRequest.get_original_url">get_original_url</a></code></li>
375398
<li><code><a title="supertokens_python.framework.request.BaseRequest.get_path" href="#supertokens_python.framework.request.BaseRequest.get_path">get_path</a></code></li>
376399
<li><code><a title="supertokens_python.framework.request.BaseRequest.get_query_param" href="#supertokens_python.framework.request.BaseRequest.get_query_param">get_query_param</a></code></li>
377400
<li><code><a title="supertokens_python.framework.request.BaseRequest.get_query_params" href="#supertokens_python.framework.request.BaseRequest.get_query_params">get_query_params</a></code></li>

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

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,20 @@ <h2 class="section-title" id="header-functions">Functions</h2>
158158
],
159159
user_context: Dict[str, Any],
160160
) -&gt; Optional[BaseResponse]:
161-
should_allow_access = await api_options.recipe_implementation.should_allow_access(
162-
api_options.request, api_options.config, user_context
163-
)
161+
should_allow_access = False
162+
163+
try:
164+
should_allow_access = (
165+
await api_options.recipe_implementation.should_allow_access(
166+
api_options.request, api_options.config, user_context
167+
)
168+
)
169+
except DashboardOperationNotAllowedError as _:
170+
return send_non_200_response_with_message(
171+
&#34;You are not permitted to perform this operation&#34;,
172+
403,
173+
api_options.response,
174+
)
164175

165176
if should_allow_access is False:
166177
return send_non_200_response_with_message(
@@ -1113,7 +1124,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
11131124
user_context: Dict[str, Any],
11141125
):
11151126

1116-
is_valid_key = validate_api_key(
1127+
is_valid_key = await validate_api_key(
11171128
api_options.request, api_options.config, user_context
11181129
)
11191130

html/supertokens_python/recipe/dashboard/api/validate_key.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ <h1 class="title">Module <code>supertokens_python.recipe.dashboard.api.validate_
6363
user_context: Dict[str, Any],
6464
):
6565

66-
is_valid_key = validate_api_key(
66+
is_valid_key = await validate_api_key(
6767
api_options.request, api_options.config, user_context
6868
)
6969

@@ -94,7 +94,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
9494
user_context: Dict[str, Any],
9595
):
9696

97-
is_valid_key = validate_api_key(
97+
is_valid_key = await validate_api_key(
9898
api_options.request, api_options.config, user_context
9999
)
100100

html/supertokens_python/recipe/dashboard/constants.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ <h1 class="title">Module <code>supertokens_python.recipe.dashboard.constants</co
3636
USER_SESSION_API = &#34;/api/user/sessions&#34;
3737
USER_PASSWORD_API = &#34;/api/user/password&#34;
3838
USER_EMAIL_VERIFY_TOKEN_API = &#34;/api/user/email/verify/token&#34;
39-
EMAIL_PASSWORD_SIGN_IN = &#34;/api/signin&#34;
40-
EMAIL_PASSSWORD_SIGNOUT = &#34;/api/signout&#34;
39+
SIGN_IN_API = &#34;/api/signin&#34;
40+
SIGN_OUT_API = &#34;/api/signout&#34;
4141
SEARCH_TAGS_API = &#34;/api/search/tags&#34;
4242
DASHBOARD_ANALYTICS_API = &#34;/api/analytics&#34;
4343
TENANTS_LIST_API = &#34;/api/tenants/list&#34;</code></pre>

html/supertokens_python/recipe/dashboard/exceptions.html

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ <h1 class="title">Module <code>supertokens_python.recipe.dashboard.exceptions</c
3030

3131

3232
class SuperTokensDashboardError(SuperTokensError):
33+
pass
34+
35+
36+
class DashboardOperationNotAllowedError(SuperTokensDashboardError):
3337
pass</code></pre>
3438
</details>
3539
</section>
@@ -42,6 +46,27 @@ <h1 class="title">Module <code>supertokens_python.recipe.dashboard.exceptions</c
4246
<section>
4347
<h2 class="section-title" id="header-classes">Classes</h2>
4448
<dl>
49+
<dt id="supertokens_python.recipe.dashboard.exceptions.DashboardOperationNotAllowedError"><code class="flex name class">
50+
<span>class <span class="ident">DashboardOperationNotAllowedError</span></span>
51+
<span>(</span><span>*args, **kwargs)</span>
52+
</code></dt>
53+
<dd>
54+
<div class="desc"><p>Common base class for all non-exit exceptions.</p></div>
55+
<details class="source">
56+
<summary>
57+
<span>Expand source code</span>
58+
</summary>
59+
<pre><code class="python">class DashboardOperationNotAllowedError(SuperTokensDashboardError):
60+
pass</code></pre>
61+
</details>
62+
<h3>Ancestors</h3>
63+
<ul class="hlist">
64+
<li><a title="supertokens_python.recipe.dashboard.exceptions.SuperTokensDashboardError" href="#supertokens_python.recipe.dashboard.exceptions.SuperTokensDashboardError">SuperTokensDashboardError</a></li>
65+
<li><a title="supertokens_python.exceptions.SuperTokensError" href="../../exceptions.html#supertokens_python.exceptions.SuperTokensError">SuperTokensError</a></li>
66+
<li>builtins.Exception</li>
67+
<li>builtins.BaseException</li>
68+
</ul>
69+
</dd>
4570
<dt id="supertokens_python.recipe.dashboard.exceptions.SuperTokensDashboardError"><code class="flex name class">
4671
<span>class <span class="ident">SuperTokensDashboardError</span></span>
4772
<span>(</span><span>*args, **kwargs)</span>
@@ -61,6 +86,10 @@ <h3>Ancestors</h3>
6186
<li>builtins.Exception</li>
6287
<li>builtins.BaseException</li>
6388
</ul>
89+
<h3>Subclasses</h3>
90+
<ul class="hlist">
91+
<li><a title="supertokens_python.recipe.dashboard.exceptions.DashboardOperationNotAllowedError" href="#supertokens_python.recipe.dashboard.exceptions.DashboardOperationNotAllowedError">DashboardOperationNotAllowedError</a></li>
92+
</ul>
6493
</dd>
6594
</dl>
6695
</section>
@@ -79,6 +108,9 @@ <h2>Index</h2>
79108
<li><h3><a href="#header-classes">Classes</a></h3>
80109
<ul>
81110
<li>
111+
<h4><code><a title="supertokens_python.recipe.dashboard.exceptions.DashboardOperationNotAllowedError" href="#supertokens_python.recipe.dashboard.exceptions.DashboardOperationNotAllowedError">DashboardOperationNotAllowedError</a></code></h4>
112+
</li>
113+
<li>
82114
<h4><code><a title="supertokens_python.recipe.dashboard.exceptions.SuperTokensDashboardError" href="#supertokens_python.recipe.dashboard.exceptions.SuperTokensDashboardError">SuperTokensDashboardError</a></code></h4>
83115
</li>
84116
</ul>

html/supertokens_python/recipe/dashboard/index.html

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ <h1 class="title">Module <code>supertokens_python.recipe.dashboard</code></h1>
4242

4343
from __future__ import annotations
4444

45-
from typing import Callable, Optional, Union
45+
from typing import Callable, Optional, List
4646

4747
from supertokens_python import AppInfo, RecipeModule
4848

@@ -54,11 +54,13 @@ <h1 class="title">Module <code>supertokens_python.recipe.dashboard</code></h1>
5454

5555

5656
def init(
57-
api_key: Union[str, None] = None,
57+
api_key: Optional[str] = None,
58+
admins: Optional[List[str]] = None,
5859
override: Optional[InputOverrideConfig] = None,
5960
) -&gt; Callable[[AppInfo], RecipeModule]:
6061
return DashboardRecipe.init(
6162
api_key,
63+
admins,
6264
override,
6365
)</code></pre>
6466
</details>
@@ -102,7 +104,7 @@ <h2 class="section-title" id="header-submodules">Sub-modules</h2>
102104
<h2 class="section-title" id="header-functions">Functions</h2>
103105
<dl>
104106
<dt id="supertokens_python.recipe.dashboard.init"><code class="name flex">
105-
<span>def <span class="ident">init</span></span>(<span>api_key: Union[strNone] = None, override: Optional[InputOverrideConfig] = None) ‑> Callable[[<a title="supertokens_python.supertokens.AppInfo" href="../../supertokens.html#supertokens_python.supertokens.AppInfo">AppInfo</a>], <a title="supertokens_python.recipe_module.RecipeModule" href="../../recipe_module.html#supertokens_python.recipe_module.RecipeModule">RecipeModule</a>]</span>
107+
<span>def <span class="ident">init</span></span>(<span>api_key: Optional[str] = None, admins: Optional[List[str]] = None, override: Optional[InputOverrideConfig] = None) ‑> Callable[[<a title="supertokens_python.supertokens.AppInfo" href="../../supertokens.html#supertokens_python.supertokens.AppInfo">AppInfo</a>], <a title="supertokens_python.recipe_module.RecipeModule" href="../../recipe_module.html#supertokens_python.recipe_module.RecipeModule">RecipeModule</a>]</span>
106108
</code></dt>
107109
<dd>
108110
<div class="desc"></div>
@@ -111,11 +113,13 @@ <h2 class="section-title" id="header-functions">Functions</h2>
111113
<span>Expand source code</span>
112114
</summary>
113115
<pre><code class="python">def init(
114-
api_key: Union[str, None] = None,
116+
api_key: Optional[str] = None,
117+
admins: Optional[List[str]] = None,
115118
override: Optional[InputOverrideConfig] = None,
116119
) -&gt; Callable[[AppInfo], RecipeModule]:
117120
return DashboardRecipe.init(
118121
api_key,
122+
admins,
119123
override,
120124
)</code></pre>
121125
</details>

0 commit comments

Comments
 (0)