Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def enroll_factor(self, user_id, factor_enroll_request, update_phone=None):
"""Enroll a user into a factor
:param user_id: target user id
:type user_id: str
:param factor_enroll_request: the details to enroll the user
:type factor_enroll_request: FactorEnrollRequest
:param update_phone: whether to update the user's phone during enrollment
:type update_phone: bool
:rtype: Factor
"""
params = {
'updatePhone': update_phone
}
response = ApiClient.post_path(self, '/{0}/factors'.format(user_id), factor_enroll_request, params=params)
return Utils.deserialize(response.text, Factor)
def update_app_instance_by_id(self, id, app_instance):
"""Update an app, defined by an id
:param id: the target app id
:type id: str
:param app_instance: the data to update the target app
:type app_instance: AppInstance
:rtype: AppInstance
"""
response = ApiClient.put_path(self, '/{0}'.format(id), app_instance)
return Utils.deserialize(response.text, AppInstance)
:rtype: AuthResult
"""
request = {
'username': username,
'password': password,
'relayState': relay_state,
'context': context
}
params = {
'force_mfa': force_mfa,
'response_type': response_type
}
response = ApiClient.post_path(self, '/', request, params=params)
return Utils.deserialize(response.text, AuthResult)
:param old_password: the user's old password
:type old_password: str
:param new_password: the desired new password
:type new_password: str
:return: None or LoginCredentials
"""
data = {
'oldPassword': {
'value': old_password
},
'newPassword': {
'value': new_password
}
}
response = ApiClient.post_path(self, '/{0}/credentials/change_password'.format(uid), data)
return Utils.deserialize(response.text, LoginCredentials)
"""Create a user
:param user: the data to create a user
:type user: User
:param activate: whether to activate the user
:type activate: bool
:rtype: User
"""
if activate is None:
response = ApiClient.post_path(self, '/', user)
else:
params = {
'activate': activate
}
response = ApiClient.post_path(self, '/', user, params=params)
return Utils.deserialize(response.text, User)
def validate_session(self, id):
"""Validate a session
:param id: the target session id
:rtype: Session
"""
response = ApiClient.get_path(self, '/{0}'.format(id))
return Utils.deserialize(response.text, Session)