Skip to content
Merged
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
74 changes: 74 additions & 0 deletions src/main/python/fusionauth/fusionauth_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,24 @@ def check_change_password_using_id(self, change_password_id):
.get() \
.go()

def check_change_password_using_id_and_ip_address(self, change_password_id, ip_address=None):
"""
Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
your password, you must obtain a Trust Token by completing a Two-Factor Step-Up authentication.

An HTTP status code of 400 with a general error code of [TrustTokenRequired] indicates that a Trust Token is required to make a POST request to this API.

Attributes:
change_password_id: The change password Id used to find the user. This value is generated by FusionAuth once the change password workflow has been initiated.
ip_address: (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
"""
return self.start_anonymous().uri('/api/user/change-password') \
.url_segment(change_password_id) \
.url_parameter('ipAddress', self.convert_true_false(ip_address)) \
.get() \
.go()

def check_change_password_using_jwt(self, encoded_jwt):
"""
Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
Expand All @@ -210,6 +228,24 @@ def check_change_password_using_jwt(self, encoded_jwt):
.get() \
.go()

def check_change_password_using_jwt_and_ip_address(self, encoded_jwt, ip_address=None):
"""
Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
your password, you must obtain a Trust Token by completing a Two-Factor Step-Up authentication.

An HTTP status code of 400 with a general error code of [TrustTokenRequired] indicates that a Trust Token is required to make a POST request to this API.

Attributes:
encoded_jwt: The encoded JWT (access token).
ip_address: (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
"""
return self.start_anonymous().uri('/api/user/change-password') \
.authorization("Bearer " + encoded_jwt) \
.url_parameter('ipAddress', self.convert_true_false(ip_address)) \
.get() \
.go()

def check_change_password_using_login_id(self, login_id):
"""
Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
Expand All @@ -226,6 +262,24 @@ def check_change_password_using_login_id(self, login_id):
.get() \
.go()

def check_change_password_using_login_id_and_ip_address(self, login_id, ip_address=None):
"""
Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
your password, you must obtain a Trust Request Id by completing a Two-Factor Step-Up authentication.

An HTTP status code of 400 with a general error code of [TrustTokenRequired] indicates that a Trust Token is required to make a POST request to this API.

Attributes:
login_id: The loginId (email or username) of the User that you intend to change the password for.
ip_address: (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
"""
return self.start().uri('/api/user/change-password') \
.url_parameter('loginId', self.convert_true_false(login_id)) \
.url_parameter('ipAddress', self.convert_true_false(ip_address)) \
.get() \
.go()

def check_change_password_using_login_id_and_login_id_types(self, login_id, login_id_types):
"""
Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
Expand All @@ -244,6 +298,26 @@ def check_change_password_using_login_id_and_login_id_types(self, login_id, logi
.get() \
.go()

def check_change_password_using_login_id_and_login_id_types_and_ip_address(self, login_id, login_id_types, ip_address=None):
"""
Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
your password, you must obtain a Trust Request Id by completing a Two-Factor Step-Up authentication.

An HTTP status code of 400 with a general error code of [TrustTokenRequired] indicates that a Trust Token is required to make a POST request to this API.

Attributes:
login_id: The loginId of the User that you intend to change the password for.
login_id_types: The identity types that FusionAuth will compare the loginId to.
ip_address: (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
"""
return self.start().uri('/api/user/change-password') \
.url_parameter('loginId', self.convert_true_false(login_id)) \
.url_parameter('loginIdTypes', self.convert_true_false(login_id_types)) \
.url_parameter('ipAddress', self.convert_true_false(ip_address)) \
.get() \
.go()

def client_credentials_grant(self, client_id=None, client_secret=None, scope=None):
"""
Make a Client Credentials grant request to obtain an access token.
Expand Down