Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@
"mypy-type-checker.importStrategy": "fromEnvironment",
"isort.importStrategy": "fromEnvironment",
"black-formatter.importStrategy": "fromEnvironment",
"workbench.colorCustomizations": {
"activityBar.background": "#121D85",
"titleBar.activeBackground": "#1A28BA",
"titleBar.activeForeground": "#F9FAFE"
},
}
7 changes: 7 additions & 0 deletions descope/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def __init__(
self,
stepup: bool = False,
mfa: bool = False,
revoke_other_sessions: Optional[None] = None,
custom_claims: Optional[dict] = None,
template_options: Optional[
dict
Expand All @@ -119,6 +120,8 @@ def __init__(
self.stepup = stepup
self.customClaims = custom_claims
self.mfa = mfa
if revoke_other_sessions is not None:
self.revokeOtherSessions = revoke_other_sessions
if template_options is not None:
self.templateOptions = template_options

Expand Down Expand Up @@ -149,11 +152,13 @@ def validate_refresh_token_provided(
class SignUpOptions:
def __init__(
self,
revoke_other_sessions: Optional[None] = None,
custom_claims: Optional[dict] = None,
template_options: Optional[
dict
] = None, # for providing messaging template options (templates that are being sent via email / text message)
):
self.revoke_other_sessions = revoke_other_sessions
self.customClaims = custom_claims
self.templateOptions = template_options

Expand All @@ -165,4 +170,6 @@ def signup_options_to_dict(signup_options: Optional[SignUpOptions] = None) -> di
res["customClaims"] = signup_options.customClaims
if signup_options.templateOptions is not None:
res["templateOptions"] = signup_options.templateOptions
if signup_options.revoke_other_sessions is not None:
res["revokeOtherSessions"] = signup_options.revoke_other_sessions
return res
16 changes: 13 additions & 3 deletions tests/test_enchantedlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,11 @@ def test_sign_in(self):
enchantedlink.sign_in(
"[email protected]",
"http://test.me",
LoginOptions(stepup=True, template_options={"blue": "bla"}),
LoginOptions(
stepup=True,
template_options={"blue": "bla"},
revoke_other_sessions=True,
),
refresh_token=refresh_token,
)
mock_post.assert_called_with(
Expand All @@ -179,6 +183,7 @@ def test_sign_in(self):
"stepup": True,
"customClaims": None,
"templateOptions": {"blue": "bla"},
"revokeOtherSessions": True,
"mfa": False,
},
},
Expand Down Expand Up @@ -298,7 +303,9 @@ def test_sign_up(self):
"[email protected]",
"http://test.me",
None,
SignUpOptions(template_options={"bla": "blue"}),
SignUpOptions(
template_options={"bla": "blue"}, revoke_other_sessions=True
),
)
mock_post.assert_called_with(
f"{common.DEFAULT_BASE_URL}{EndpointsV1.sign_up_auth_enchantedlink_path}/email",
Expand All @@ -312,7 +319,10 @@ def test_sign_up(self):
"URI": "http://test.me",
"user": {"email": "[email protected]"},
"email": "[email protected]",
"loginOptions": {"templateOptions": {"bla": "blue"}},
"loginOptions": {
"templateOptions": {"bla": "blue"},
"revokeOtherSessions": True,
},
},
allow_redirects=False,
verify=True,
Expand Down
Loading