diff --git a/.vscode/settings.json b/.vscode/settings.json index 6cbd45641..be31b4ea4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -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" + }, } diff --git a/descope/common.py b/descope/common.py index 828096e4a..c85013637 100644 --- a/descope/common.py +++ b/descope/common.py @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/tests/test_enchantedlink.py b/tests/test_enchantedlink.py index 4939feb5d..8f5757c20 100644 --- a/tests/test_enchantedlink.py +++ b/tests/test_enchantedlink.py @@ -162,7 +162,11 @@ def test_sign_in(self): enchantedlink.sign_in( "dummy@dummy.com", "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( @@ -179,6 +183,7 @@ def test_sign_in(self): "stepup": True, "customClaims": None, "templateOptions": {"blue": "bla"}, + "revokeOtherSessions": True, "mfa": False, }, }, @@ -298,7 +303,9 @@ def test_sign_up(self): "dummy@dummy.com", "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", @@ -312,7 +319,10 @@ def test_sign_up(self): "URI": "http://test.me", "user": {"email": "dummy@dummy.com"}, "email": "dummy@dummy.com", - "loginOptions": {"templateOptions": {"bla": "blue"}}, + "loginOptions": { + "templateOptions": {"bla": "blue"}, + "revokeOtherSessions": True, + }, }, allow_redirects=False, verify=True,