api.client (version 2.0.0)
index
/home/pitbulk/proyectos/onelogin-python-sdk/src/onelogin/api/client.py

OneLoginClient class
 
Copyright (c) 2021, OneLogin, Inc.
All rights reserved.
 
OneLoginClient class of the OneLogin's Python SDK.

 
Modules
       
base64
datetime
requests
dateutil.tz

 
Classes
       
__builtin__.object
OneLoginClient

 
class OneLoginClient(__builtin__.object)
    The OneLoginClient makes the API calls to the Onelogin's platform described
at https://developers.onelogin.com/api-docs/1/getting-started/dev-overview.
 
  Methods defined here:
__init__(self, client_id, client_secret, region='us', max_results=1000, default_timeout=(10, 60), subdomain=None, api_configuration={})
Create a new instance of OneLoginClient.
 
:param client_id: API Credentials client_id
:type client_id: string
:param client_secret: API Credentials client_secret
:type client_secret: string
:param region: OneLogin region, either us or eu
:type region: string
:param max_results: Maximum number of results returned by list operations
:type max_results: int
:param default_timeout: a request timeout
See http://docs.python-requests.org/en/master/user/advanced/#timeouts
:type default_timeout: (float, float)
:param subdomain: If the subdomain is provided, API calls gonna be done using the subdomain instead the region
:type subdomain: string
:param api_configuration: allows to define the api endpoint version to be used
:type api_configuration: dict
activate_factor(self, user_id, device_id, expires_in=None, custom_message=None)
Triggers an SMS or Push notification containing a One-Time Password (OTP)
that can be used to authenticate a user with the Verify Factor call.
 
:param user_id: Set to the id of the user.
:type user_id: integer
 
:param device_id: Set to the device_id of the MFA device.
:type device_id: integer
 
:param expires_in: Default 120. Valid range 120-900  (V2 Only)
:type number: int
 
:param custom_message: Only applies to SMS factor (V2 only)
: type custom_message: string
 
:return: Info with User Id, Device Id, and otp_device
:rtype: FactorEnrollmentResponse
 
See https://developers.onelogin.com/api-docs/1/multi-factor-authentication/activate-factor Activate an Authentication Factor documentation
    https://developers.onelogin.com/api-docs/1/multi-factor-authentication/activate-factor
add_role_admins(self, role_id, admin_ids)
Add admins to a role.
 
:param role_id: Id of the role
:type role_id: int
 
:param admin_ids: List of admin ids
:type admin_ids: integer array
 
Returns a list of ids of the assigned admins to a role.
:return: admin id list
:rtype: list[int]
 
See https://developers.onelogin.com/api-docs/2/roles/add-role-admins Add Role Admins documentation
add_role_users(self, role_id, user_ids)
Add users to a role.
 
:param role_id: Id of the role
:type role_id: int
 
:param user_ids: List of user ids
:type user_ids: integer array
 
Returns a list of ids of the assigned users to a role.
:return: user id list
:rtype: list[int]
 
See https://developers.onelogin.com/api-docs/2/roles/add-role-users Add Role Users documentation
add_to_resource_operation(self, url, ids, version_id)
app_rule_sort(self, app_id, app_rule_ids)
Update order of app rule
 
:param app_id: Id of the App
:type app_id: int
 
:param app_rule_ids: ordered list of app_rule_ids
:type app_rule_ids: list
 
Returns the list of processed app rule ids
:return: app_rule_id list
:rtype: list[int]
 
See https://developers.onelogin.com/api-docs/2/app-rules/bulk-sort Bulk Sort documentation
assign_role_to_user(self, user_id, role_ids)
Assigns Roles to User
 
:param user_id: Id of the user
:type user_id: int
 
:param role_ids: List of role ids to be added
:type user_params: integer array
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/1/users/assign-role-to-user Assign Role to User documentation
assign_roles_to_privilege(self, privilege_id, role_ids)
Assign one or more roles to a privilege.
 
:param privilege_id: The id of the privilege.
:type privilege_id: string
 
:param role_ids: The ids of the roles to be assigned.
:type role_ids: list
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/1/privileges/assign-role Assign Roles documentation
assign_users_to_privilege(self, privilege_id, user_ids)
Assign one or more users to a privilege.
 
:param privilege_id: The id of the privilege.
:type privilege_id: string
 
:param user_ids: The ids of the users to be assigned.
:type user_ids: list
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/1/privileges/assign-users Assign Users documentation
clean_error(self)
Clean any previous error registered at the client.
create_app(self, app_params)
Creates an app
 
:param app_params: App data (connector_id, name, description, visible, policy_id, configuration,
                             tab_id, visible, brand_id, role_ids, notes)
:type app_params: dict
 
Returns the created app
:return: app
:rtype: OneLoginApp
 
See https://developers.onelogin.com/api-docs/2/apps/create-app Create App documentation
create_app_rule(self, app_id, app_rule_params)
Creates a app rule
 
:param app_id: Id of the app
:type app_id: int
 
:param app_rule_params: App Rule data (name, enabled, match, position,
                                       conditions[source, operator, value],
                                       actions[action, value, expression,scriplet, macro])
:type app_rule_params: dict
 
Returns the created app rule
:return: app_rule
:rtype: AppRule
 
See https://developers.onelogin.com/api-docs/2/app-rules/create-rule Create App Rule documentation
create_brand(self, brand_params)
Creates accound brand
 
:param brand_params: Brand data (name, enabled, custom_support_enabled, custom_color,
                                 custom_accent_color, custom_masking_color, custom_masking_opacity,
                                 enable_custom_label_for_login_screen, custom_label_text_for_login_screen,
                                 login_instruction_title, login_instruction, hide_onelogin_footer,
                                 mfa_enrollment_message, background, logo)
:type brand_params: dict
 
Returns the created brand
:return: brand
:rtype: Brand
 
See https://developers.onelogin.com/api-docs/2/branding/create-account-brand Create Account Brand documentation
create_env_var(self, env_var_params)
Creates an environment variable
 
:param env_var_params: Smart Hook data (name, value)
:type env_var_params: dict
 
Returns the created environment variable
:return: environment variable
:rtype: SmartHookEnv
 
See https://developers.onelogin.com/api-docs/2/hooks/create-environment-variable Create Environment Variable documentation
create_event(self, event_params)
Create an event in the OneLogin event log.
 
:param event_params: Event data (event_type_id, account_id, actor_system,
                                 actor_user_id, actor_user_name, app_id,
                                 assuming_acting_user_id, custom_message,
                                 directory_sync_run_id, group_id, group_name,
                                 ipaddr, otp_device_id, otp_device_name,
                                 policy_id, policy_name, role_id, role_name,
                                 user_id, user_name)
:type event_params: dict
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/1/events/create-event Create Event documentation
create_mapping(self, mapping_params)
Creates Mapping
 
:param mapping_params: Mapping data (name, enabled, match, position
                                  conditions[source, operator,value],
                                  actions[action, value])
:type mapping_params: dict
 
Returns the mapping
:return: mapping
:rtype: Mapping
 
See https://developers.onelogin.com/api-docs/2/user-mappings/create-mapping Create Mapping documentation
create_operation(self, url, data)
create_privilege(self, name, version, statements)
Creates a Privilege
 
:param name: The name of the privilege.
:type name: string
 
:param version: The version for the privilege schema. Set to 2018-05-18.
:type version: string
 
:param statements: A list of statements. Statement object or a dict with the keys Effect, Action and Scope
:type statements: list[Statement] or list[dict]
 
Returns the created privilege
:return: privilege
:rtype: Privilege
 
See https://developers.onelogin.com/api-docs/1/privileges/create-privilege Create Privilege documentation
create_resource(self, resource_cls, url, data, query_params, version_id)
create_risk_rule(self, risk_rule_params)
Creates a risk rule
 
:param risk_rule_params: Risk Rule data (name, type, target, filters, source)
:type risk_rule_params: dict
 
Returns the created risk rule
:return: risk_rule
:rtype: RiskRule
 
See https://developers.onelogin.com/api-docs/2/vigilance/create-rule Create a Rule documentation
create_role(self, role_params)
Create a role
 
:param role_params: Role data (name, apps, users, admins)
:type role_params: dict
 
Returns the role id
:return: role
:rtype: int
 
See https://developers.onelogin.com/api-docs/2/roles/create-role Create Role documentation
create_session_login_token(self, query_params, allowed_origin='')
Generates a session login token in scenarios in which MFA may or may not be required.
A session login token expires two minutes after creation.
 
:param query_params: Query Parameters (username_or_email, password, subdomain, return_to_url,
                                       ip_address, browser_id)
:type query_params: dict
 
:param allowed_origin: Custom-Allowed-Origin-Header. Required for CORS requests only.
                       Set to the Origin URI from which you are allowed to send a request
                       using CORS.
:type allowed_origin: string
 
Returns a session token
:return: return the object if success
:rtype: SessionTokenInfo/SessionTokenMFAInfo
 
See https://developers.onelogin.com/api-docs/1/users/create-session-login-token Create Session Login Token documentation
create_smart_hook(self, smart_hook_params)
Creates a hook
 
:param smart_hook_params: Smart Hook data (type, disabled, timeout, env_vars,
                                           runtime, context_version, retries,
                                           risk_enabled, mfa_device_info_enabled,
                                           location_enabled, packages, function)
:type smart_hook_params: dict
 
Returns the created hook
:return: smart_hook
:rtype: SmartHook
 
See https://developers.onelogin.com/api-docs/2/hooks/create-hook Create a Hook documentation
create_user(self, user_params, mappings=None, validate_policy=None)
Creates an user
 
:param user_params: User data (firstname, lastname, email, username, company,
                               department, directory_id, distinguished_name,
                               external_id, group_id, invalid_login_attempts,
                               locale_code, manager_ad_id, member_of,
                               openid_name, phone, samaccountname, title,
                               userprincipalname)
                           v2 (password_confirmation, password_algorithm, salt, role_ids
                               state, status, trusted_idp_id)
:type user_params: dict
 
:param mappings: Controls how mappings will be applied to the user on creation
                [async, sync, disabled]
:type mappings: string
 
:param validate_policy: Validate password against user policy?
:type validate_policy: bool
 
Returns the created user
:return: user
:rtype: User
 
See https://developers.onelogin.com/api-docs/1/users/create-user Create User documentation
    https://developers.onelogin.com/api-docs/2/users/create-user
delete_app(self, app_id)
Deletes an app
 
:param app_id: Id of the app to be deleted
:type app_id: int
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/2/apps/delete-app Delete App documentation
delete_app_parameter(self, app_id, parameter_id)
Deletes an App Parameter
 
:param app_id: Id of the App
:type app_id: int
 
:param parameter_id: Id of the parameter to be deleted
:type parameter_id: int
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/2/apps/delete-parameter Delete App Parameter documentation
delete_app_rule(self, app_id, app_rule_id)
Deletes a app rule
 
:param app_id: Id of the app
:type app_id: int
 
:param app_rule_id: Id of the app rule
:type app_rule_id: int
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/2/app-rules/delete-rule Delete App Rule documentation
delete_brand(self, brand_id)
Deletes Account Brand
 
:param brand_id: Id of the brand to be deleted
:type brand_id: int
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/2/branding/delete-account-brand Deletes Account Brand documentation
delete_env_var(self, env_var_id)
Deletes an environment variable
 
:param env_var_id: Id of the environment variable
:type env_var_id: string
 
:return: true if action succeed
:rtype: bool
 
See https://developers.onelogin.com/api-docs/2/hooks/delete-environment-variable Delete Environment Variable documentation
delete_mapping(self, mapping_id)
Deletes mapping
 
:param mapping_id: Id of the mapping to be deleted
:type mapping_id: int
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/2/user-mappings/delete-mapping Delete Mapping documentation
delete_privilege(self, privilege_id)
Deletes a Privilege
 
:param privilege_id: The id of the privilege you want to delete.
:type privilege_id: string
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/1/privileges/delete-privilege Delete Privilege documentation
delete_resource(self, url, version_id)
delete_risk_rule(self, risk_rule_id)
Deletes a risk rule
 
:param risk_rule_id: Id of the risk rule
:type risk_rule_id: int
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/2/vigilance/delete-rule Delete a Rule documentation
delete_role(self, role_id)
Deletes a role
 
:param role_id: Id of the role to be deleted
:type role_id: int
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/2/roles/update-role Delete Role by ID documentation
delete_smart_hook(self, smart_hook_id)
Deletes a hook
 
:param smart_hook_id: The id of the Smart Hook.
:type smart_hook_id: string
 
:return: true if action succeed
:rtype: bool
 
See https://developers.onelogin.com/api-docs/2/hooks/delete-hook Delete a Hook documentation
delete_user(self, user_id)
Deletes an user
 
:param user_id: Id of the user to be deleted
:type user_id: int
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/1/users/delete-user Delete User by ID documentation
dryrun_mapping(self, mapping_id, user_ids)
Performs a User Mappings dry run
 
:param mapping_id: Id of the mapping to be deleted
:type mapping_id: int
 
:param user_ids: List of user IDs tested against the mapping conditions to verify that the mapping would be applied
:type user_ids: list[int]
 
Returns
:return: list of {User,mapped}
:rtype: dict
 
See https://developers.onelogin.com/api-docs/2/user-mappings/dry-run-mapping Dry Run Mapping documentation
enroll_factor(self, user_id, factor_id, display_name, number=None, verified=False, expires_in=None, custom_message=None)
Enroll a user with a given authentication factor.
 
:param user_id: Set to the id of the user.
:type user_id: integer
 
:param factor_id: The identifier of the factor to enroll the user with.
:type factor_id: integer
 
:param display_name: A name for the users device.
:type display_name: string
 
:param number: The phone number of the user in E.164 format.. (V1 only)
:type number: string
 
:param verified: Default false. Pre-verified and can be immediately activated.
                                (OL Voice requires verified = true)
:type number: bool
 
:param expires_in: Default 120. Valid range 120-900  (V2 Only)
:type number: int
 
:param custom_message: Only applies to SMS factor (V2 only)
: type custom_message: string
 
:return: MFA device
:rtype: OTP_Device
 
See https://developers.onelogin.com/api-docs/1/multi-factor-authentication/enroll-factor Enroll an Authentication Factor documentation
    https://developers.onelogin.com/api-docs/2/multi-factor-authentication/enroll-factor
execute_call(self, method, url, headers=None, params=None, json=None)
generate_invite_link(self, email)
Generates an invite link for a user that you have already created in your OneLogin account.
 
:param email: Set to the email address of the user that you want to generate an invite link for.
:type email: string
 
Returns the invitation link
:return: link
:rtype: str
 
See https://developers.onelogin.com/api-docs/1/invite-links/generate-invite-link Generate Invite Link documentation
generate_mfa_token(self, user_id, expires_in=259200, reusable=False)
Use to generate a temporary MFA token that can be used in place of other MFA tokens for a set time period.
For example, use this token for account recovery.
 
:param user_id: Id of the user
:type user_id: int
 
:param expires_in: Set the duration of the token in seconds.
                  (default: 259200 seconds = 72h) 72 hours is the max value.
:type expires_in: int
 
:param reusable: Defines if the token reusable. (default: false) If set to true, token can be used for multiple apps, until it expires.
:type reusable: bool
 
Returns a mfa token
:return: return the object if success
:rtype: MFAToken
 
See https://developers.onelogin.com/api-docs/1/multi-factor-authentication/generate-mfa-token Generate MFA Token documentation
get_access_token(self)
Generates an access token and refresh token that you may use to
call Onelogin's API methods.
 
Returns the generated OAuth Token info
:return: OAuth Token info
:rtype: OneLoginToken
 
See https://developers.onelogin.com/api-docs/1/oauth20-tokens/generate-tokens Generate Tokens documentation.
get_app(self, app_id)
Gets App by ID.
 
:param app_id: Id of the app
:type app_id: int
 
Returns the app identified by the id
:return: app
:rtype: OneLoginApp
 
See https://developers.onelogin.com/api-docs/2/apps/get-app
get_app_action_values(self, app_id, action_value)
Gets a list of possible values to set using a given action.
 
:param app_id: Id of the App
:type app_id: int
 
:param action_value: Value for the selected action (A Mapping Action).
:type action_value: string
 
Returns the list of values
:return: value list
:rtype: list[dict]
 
See https://developers.onelogin.com/api-docs/2/app-rules/list-action-values List Action values documentation
get_app_actions(self, app_id)
Gets a list of the actions that can be applied when an App Rule run
 
:param app_id: Id of the App
:type app_id: int
 
Returns the list of actions
:return: action list
:rtype: list[dict]
 
See https://developers.onelogin.com/api-docs/2/app-rules/list-actions List Actions documentation
get_app_condition_operators(self, app_id, condition_value)
Gets a list of possible operators for a given condition value.
 
:param app_id: Id of the App
:type app_id: int
 
:param condition_value: Value for the selected condition (An App Condition).
:type condition_value: string
 
Returns the list of operators
:return: operator list
:rtype: list[dict]
 
See https://developers.onelogin.com/api-docs/2/app-rules/list-condition-operators List Conditions Operators documentation
get_app_condition_values(self, app_id, condition_value)
Gets a list of possible values to compare to a condition type.
 
:param app_id: Id of the App
:type app_id: int
 
:param condition_value: Value for the selected condition (An App Condition).
:type condition_value: string
 
Returns the list of values
:return: value list
:rtype: list[dict]
 
See https://developers.onelogin.com/api-docs/2/app-rules/list-condition-values List Condition Values documentation
get_app_conditions(self, app_id)
Gets a list of App Conditions types that can be used to match users when app rules are run.
 
:param app_id: Id of the App
:type app_id: int
 
Returns the list of conditions
:return: condition list
:rtype: list[dict]
 
See https://developers.onelogin.com/api-docs/2/app-rules/list-conditions List Conditions documentation
get_app_rule(self, app_id, app_rule_id)
Gets App Rule by ID.
 
:param app_id: Id of the app
:type app_id: int
 
:param app_rule_id: Id of the app rule
:type app_rule_id: int
 
Returns the app rule identified by the id
:return: app_rule
:rtype: AppRule
 
See https://developers.onelogin.com/api-docs/2/app-rules/get-rule Get App Rule documentation
get_app_rules(self, app_id, query_parameters=None)
Gets a list of app rules.
 
:param app_id: Id of the App
:type app_id: int
 
:param query_parameters: Parameters to filter the result of the list
                         (enabled, has_condition, has_condition_type,
                          has_action, has_action_type)
:type query_parameters: dict
 
Returns the list of app rules
:return: app rules list
:rtype: list[AppRule]
 
See https://developers.onelogin.com/api-docs/2/app-rules/list-rules List Rules documentation
get_app_users(self, app_id, query_parameters=None, max_results=None)
Gets a list of all users related to an App.
 
:param app_id: Id of the App
:type app_id: int
 
:param query_parameters: Parameters to filter the result of the list
:type query_parameters: dict
 
:param max_results: Limit the number of apps returned (optional)
:type max_results: int
 
Returns the list of users
:return: user list
:rtype: list[User]
 
See https://developers.onelogin.com/api-docs/2/apps/list-users List App Users documentation
get_apps(self, query_parameters=None, max_results=None)
Gets a list of all Apps in a OneLogin account.
 
:param query_parameters: Parameters to filter the result of the list
:type query_parameters: dict
 
:param max_results: Limit the number of apps returned (optional)
:type max_results: int
 
Returns the list of apps
:return: app list
:rtype: list[OneLoginApp]
 
See https://developers.onelogin.com/api-docs/1/apps/get-apps Get Apps documentation
    https://developers.onelogin.com/api-docs/2/apps/list-apps
get_authorized_headers(self, bearer=True, headers=None)
get_brand(self, brand_id)
Gets Brand by ID.
 
:param brand_id: Id of the brand
:type brand_id: int
 
Returns the brand identified by the id
:return: brand
:rtype: Brand
 
See https://developers.onelogin.com/api-docs/2/branding/get-account-brand Get Account Brand documentation
get_brand_apps(self, brand_id, max_results=None)
Get Apps Associated with Account Brand.
 
:param brand_id: Id of the brand
:type brand_id: int
 
:param max_results: Limit the number of apps returned (optional)
:type max_results: int
 
Returns a list of Apps of a brand.
:return: app list
:rtype: list[OneloginApp]
 
See https://developers.onelogin.com/api-docs/2/branding/get-apps-associated-with-account-brand Get Apps Associated with Account Brand documentation
get_brands(self, query_parameters=None, max_results=None)
Get a list of account brands
 
:param query_parameters: Parameters to filter the result of the list
:type query_parameters: dict
 
:param max_results: Limit the number of brands returned (optional)
:type max_results: int
 
Returns the list of brands
:return: brand list
:rtype: list[Brand]
 
See https://developers.onelogin.com/api-docs/2/branding/list-account-brands List Account Brands documentation
get_connectors(self, query_parameters=None, max_results=None)
Gets a list of all Connectors in a OneLogin account.
 
:param query_parameters: Parameters to filter the result of the list
:type query_parameters: dict
 
:param max_results: Limit the number of connectors returned (optional)
:type max_results: int
 
Returns the list of connectors
:return: conector list
:rtype: list[Connector]
 
See https://developers.onelogin.com/api-docs/2/connectors/list-connectors List Connectors documentation
get_custom_attributes(self)
Gets a list of all custom attribute fields (also known as custom user fields) that have been defined for OL account.
 
Returns the custom attributes of the account
:return: custom attribute list
:rtype: list[str]
 
See https://developers.onelogin.com/api-docs/1/users/get-custom-attributes Get Custom Attributes documentation
get_email_settings(self)
Get Email Settings Config
 
 
Returns a dict with email settings
:return: email_settings
:rtype: dict
 
See https://developers.onelogin.com/api-docs/2/branding/get-email-settings Get Email Settings Config documentation
get_embed_apps(self, token, email)
Lists apps accessible by a OneLogin user.
 
:param token: Provide your embedding token.
:type token: string
 
:param email: Provide the email of the user for which you want to return a list of embeddable apps.
:type email: string
 
Returns the embed apps
:return: A list of Apps
:rtype: list[App]
 
See https://developers.onelogin.com/api-docs/1/embed-apps/get-apps-to-embed-for-a-user Get Apps to Embed for a User documentation
get_enrolled_factors(self, user_id)
Return a list of authentication factors registered to a particular user for multifactor authentication (MFA)
 
:param user_id: Set to the id of the user.
:type user_id: integer
 
:return: OTP_Device list
:rtype: list[OTP_Device]
 
See https://developers.onelogin.com/api-docs/1/multi-factor-authentication/enrolled-factors Get Enrolled Authentication Factors documentation
    https://developers.onelogin.com/api-docs/2/multi-factor-authentication/enrolled-factors
get_env_var(self, env_var_id)
Return a single Smart Hook Environment Variable
 
:param env_var_id: Id of the environment variable
:type env_var_id: string
 
Returns the requested environment variable
:return: environment variable
:rtype: SmartHookEnv
 
See https://developers.onelogin.com/api-docs/2/hooks/get-environment-variable Get Environment Variable documentation
get_env_vars(self, max_results=None)
Gets a list of environment variables.
 
:param max_results: Limit the number of smart hooks returned (optional)
:type max_results: int
 
Returns the list of smart hooks
:return: environment variables list
:rtype: list[SmartHookEnv]
 
See https://developers.onelogin.com/api-docs/2/hooks/list-environment-variables List Environment Variables documentation
get_event(self, event_id)
Gets Event by ID.
 
:param role_id: Id of the Event
:type role_id: int
 
Returns the result of the operation
:return: event
:rtype: Event
 
See https://developers.onelogin.com/api-docs/1/events/get-event-by-id Get Event by ID documentation
get_event_types(self)
List of all OneLogin event types available to the Events API.
 
Returns the list of event type
:return: event type list
:rtype: list[EventType]
 
See https://developers.onelogin.com/api-docs/1/events/event-types Get Event Types documentation
get_events(self, query_parameters=None, max_results=None)
Gets a list of Event resources.
 
:param query_parameters: Parameters to filter the result of the list
:type query_parameters: dict
 
:param max_results: Limit the number of events returned (optional)
:type max_results: int
 
Returns the list of events
:return: event list
:rtype: list[Event]
 
See https://developers.onelogin.com/api-docs/1/events/get-events Get Events documentation
get_factors(self, user_id)
Returns a list of authentication factors that are available for user enrollment via API.
 
:param user_id: Set to the id of the user.
:type user_id: integer
 
:return: AuthFactor list
:rtype: list[AuthFactor]
 
See https://developers.onelogin.com/api-docs/1/multi-factor-authentication/available-factors Get Available Authentication Factors documentation
    https://developers.onelogin.com/api-docs/2/multi-factor-authentication/available-factors
get_group(self, group_id)
Gets Group by ID.
 
:param role_id: Id of the group
:type role_id: int
 
Returns the group identified by the id
:return: group
:rtype: Group
 
See https://developers.onelogin.com/api-docs/1/groups/get-group-by-id Get Group by ID documentation
get_groups(self, max_results=None)
Gets a list of Group resources (element of groups limited with the max_results parameter, or client attribute).
 
:param max_results: Limit the number of groups returned (optional)
:type max_results: int
 
Returns the list of groups
:return: group list
:rtype: list[Group]
 
See https://developers.onelogin.com/api-docs/1/groups/get-groups Get Groups documentation
get_headers(self, bearer=True)
get_mapping(self, mapping_id)
Gets Mapping by ID.
 
:param mapping_id: Id of the Mapping
:type mapping_id: int
 
Returns the mapping identified by the id
:return: mapping
:rtype: Mapping
 
See https://developers.onelogin.com/api-docs/2/user-mappings/get-mapping Get Mapping documentation
get_mapping_action_values(self, action_value)
Gets a list of possible values to set using a given action.
 
:param action_value: Value for the selected action (A Mapping Action).
:type action_value: string
 
Returns the list of values
:return: value list
:rtype: list[dict]
 
See https://developers.onelogin.com/api-docs/2/user-mappings/list-action-values List Action values documentation
get_mapping_actions(self)
Gets a list of the actions that can be applied when a mapping runs.
 
Returns the list of actions
:return: action list
:rtype: list[dict]
 
See https://developers.onelogin.com/api-docs/2/user-mappings/list-actions List Actions documentation
get_mapping_condition_operators(self, condition_value)
Gets a list of possible operators for a given condition value.
 
:param condition_value: Value for the selected condition (A Mapping Condition).
:type condition_value: string
 
Returns the list of operators
:return: operator list
:rtype: list[dict]
 
See https://developers.onelogin.com/api-docs/2/user-mappings/list-condition-operators List Conditions Operators documentation
get_mapping_condition_values(self, condition_value)
Gets a list of possible values to compare to a condition type.
 
:param condition_value: Value for the selected condition (A Mapping Condition).
:type condition_value: string
 
Returns the list of values
:return: value list
:rtype: list[dict]
 
See https://developers.onelogin.com/api-docs/2/user-mappings/list-condition-values List Condition Values documentation
get_mapping_conditions(self)
Gets a list of Mapping Conditions types that can be used to match users when mappings are run.
 
Returns the list of conditions
:return: condition list
:rtype: list[dict]
 
See https://developers.onelogin.com/api-docs/2/user-mappings/list-conditions List Conditions documentation
get_mappings(self, query_parameters=None)
Gets a list of Mapping resources.
 
:param query_parameters: Parameters to filter the result of the list
:type query_parameters: dict
 
Returns the list of mappings
:return: role list
:rtype: list[Mapping]
 
See https://developers.onelogin.com/api-docs/2/user-mappings/list-mappings List Mappings documentation
get_privilege(self, privilege_id)
Get a Privilege
 
:param privilege_id: The id of the privilege.
:type privilege_id: string
 
Returns the privilege identified by the id
:return: privilege
:rtype: Privilege
 
See https://developers.onelogin.com/api-docs/1/privileges/get-privilege Get Privilege documentation
get_privileges(self)
Gets a list of the Privileges created in an account.
 
Returns the list of privileges
:return: privileges list
:rtype: list[Privilege]
 
See https://developers.onelogin.com/api-docs/1/privileges/list-privileges List Privileges documentation
get_rate_limits(self)
Gets current rate limit details about an access token.
 
Returns the rate limit info
:return: rate limit info
:rtype: RateLimit
 
See https://developers.onelogin.com/api-docs/1/oauth20-tokens/get-rate-limit Get Rate Limit documentation
get_risk_rule(self, risk_rule_id)
Gets Risk Rule by ID.
 
:param risk_rule_id: Id of the risk rule
:type risk_rule_id: int
 
Returns the risk rule identified by the id
:return: risk_rule
:rtype: RiskRule
 
See https://developers.onelogin.com/api-docs/2/vigilance/get-rule Get a Rule documentation
get_risk_rules(self)
Gets a list of risk rules.
 
Returns the list of risk rules
:return: risk rule list
:rtype: list[RiskRule]
 
See https://developers.onelogin.com/api-docs/2/vigilance/get-rules List Rules documentation
get_risk_score(self, track_event_params)
Gets a Risk Score
 
:param track_event_params: Event data (verb, ip, user_agent, user[id, name, authenticated],
                                 source[id,name], session[id], device[id], fp, published)
                     user id data needs to be in the format: {instance region}_{OneLogin User Id}
:type track_event_params: dict
 
Returns the risk score
:return: risk_score
:rtype: RiskScore
 
See https://developers.onelogin.com/api-docs/2/vigilance/verify Get a Risk Score documentation
get_risk_score_insights(self, query_parameters=None)
Get Score Insights.
 
:param query_parameters: Parameters to filter the result of the list
:type query_parameters: dict
 
Returns the risk score insight info
:return: risk_score_insights
:rtype: RiskScoreInsights
 
See https://developers.onelogin.com/api-docs/2/vigilance/get-scores Get Score Insights documentation
get_role(self, role_id)
Gets Role by ID.
 
:param role_id: Id of the Role
:type role_id: int
 
Returns the role identified by the id
:return: role
:rtype: Role
 
See https://developers.onelogin.com/api-docs/1/roles/get-role-by-id Get Role by ID documentation
    https://developers.onelogin.com/api-docs/2/roles/get-role
get_role_admins(self, role_id, name=None, include_unassigned=None, max_results=None)
Gets a list of role administrators.
 
:param role_id: Id of the role
:type role_id: int
 
:param name: Filters on first name, last name, username, and email address. (optional)
:type name: string
 
:param include_unassigned: Include admins that aren't assigned to the role. (optional)
:type include_unassigned: bool
 
:param max_results: Limit the number of admins returned (optional)
:type max_results: int
 
Returns a list of AssignedAdmin of a role.
:return: app list
:rtype: list[AssignedAdmin]
 
See https://developers.onelogin.com/api-docs/2/roles/get-role-admins Get Role Admins documentation
get_role_apps(self, role_id, assigned=True, max_results=None)
Gets a list of App assigned to a role.
 
:param role_id: Id of the role
:type role_id: int
 
:param assigned: Defaults to true. Returns all apps assigned to the role, or the opposite (optional)
:type assigned: bool
 
:param max_results: Limit the number of apps returned (optional)
:type max_results: int
 
Returns a list of App assigned to a role.
:return: app list
:rtype: list[App]
 
See https://developers.onelogin.com/api-docs/2/roles/get-role-apps Get Role Apps documentation
get_role_users(self, role_id, name=None, include_unassigned=None, max_results=None)
Gets a list of role users.
 
:param role_id: Id of the role
:type role_id: int
 
:param name: Filters on first name, last name, username, and email address. (optional)
:type name: string
 
:param include_unassigned: Include admins that aren't assigned to the role. (optional)
:type include_unassigned: bool
 
:param max_results: Limit the number of users returned (optional)
:type max_results: int
 
Returns a list of AssignedUser of a role.
:return: app list
:rtype: list[AssignedUser]
 
See https://developers.onelogin.com/api-docs/2/roles/get-role-users Get Role Users documentation
get_roles(self, query_parameters=None, max_results=None)
Gets a list of Role resources.
 
:param query_parameters: Parameters to filter the result of the list
:type query_parameters: dict
 
:param max_results: Limit the number of roles returned (optional)
:type max_results: int
 
Returns the list of roles
:return: role list
:rtype: list[Role]
 
See https://developers.onelogin.com/api-docs/1/roles/get-roles Get Roles documentation
    https://developers.onelogin.com/api-docs/2/roles/list-roles
get_roles_assigned_to_privilege(self, privilege_id, max_results=None)
Gets a list of the roles assigned to a privilege.
 
:param privilege_id: The id of the privilege.
:type privilege_id: string
 
:param max_results: Limit the number of roles returned (optional)
:type max_results: int
 
Returns the list of roles
:return: role_ids list
:rtype: list[int]
 
See https://developers.onelogin.com/api-docs/1/privileges/get-roles Get Assigned Roles documentation
get_saml_assertion(self, username_or_email, password, app_id, subdomain, ip_address=None)
Generates a SAML Assertion.
 
:param username_or_email: username or email of the OneLogin user accessing the app
:type username_or_email: string
 
:param password: Password of the OneLogin user accessing the app
:type password: string
 
:param app_id: App ID of the app for which you want to generate a SAML token
:type app_id: integer
 
:param subdomain: subdomain of the OneLogin account related to the user/app
:type subdomain: string
 
:param ip_address: whitelisted IP address that needs to be bypassed (some MFA scenarios).
:type ip_address: string
 
Returns a SAMLEndpointResponse object with an encoded SAMLResponse
:return: true if success
:rtype: SAMLEndpointResponse
 
See https://developers.onelogin.com/api-docs/1/saml-assertions/generate-saml-assertion Generate SAML Assertion documentation
    https://developers.onelogin.com/api-docs/2/saml-assertions/generate-saml-assertion
get_saml_assertion_verifying(self, app_id, device_id, state_token, otp_token=None, url_endpoint=None, do_not_notify=False)
Verify a one-time password (OTP) value provided for a second factor when multi-factor authentication (MFA) is required for SAML authentication.
 
:param app_id: App ID of the app for which you want to generate a SAML token
:type app_id: integer
 
:param devide_id: Provide the MFA device_id you are submitting for verification.
:type subdomain: integer
 
:param state_token: Provide the state_token associated with the MFA device_id you are submitting for verification.
:type state_token: string
 
:param otp_token: Provide the OTP value for the MFA factor you are submitting for verification.
:type otp_token: string
 
:param url_endpoint: Specify an url where return the response.
:type url_endpoint: string
 
:param do_not_notify: When verifying MFA via Protect Push, set this to true to stop additional push notifications being sent to the OneLogin Protect device
:type do_not_notify: bool
 
Returns a SAMLEndpointResponse object with an encoded SAMLResponse
:return: true if success
:rtype: SAMLEndpointResponse
 
See https://developers.onelogin.com/api-docs/1/saml-assertions/verify-factor Verify Factor documentation
    https://developers.onelogin.com/api-docs/2/saml-assertions/verify-factor
get_session_token_verified(self, device_id, state_token, otp_token=None, allowed_origin='', do_not_notify=False)
Verify a one-time password (OTP) value provided for multi-factor authentication (MFA).
 
:param device_id: Provide the MFA device_id you are submitting for verification.
:type device_id: string
 
:param state_token: Provide the state_token associated with the MFA device_id you are submitting for verification.
:type state_token: string
 
:param otp_token: Provide the OTP value for the MFA factor you are submitting for verification.
:type otp_token: string
 
:param allowed_origin: Required for CORS requests only. Set to the Origin URI from which you are allowed to send a request using CORS.
:type allowed_origin: string
 
:param do_not_notify: When verifying MFA via Protect Push, set this to true to stop additional push notifications being sent to the OneLogin Protect device.
:type do_not_notify: bool
 
Returns a session token
:return: return the object if success
:rtype: SessionTokenInfo
 
See https://developers.onelogin.com/api-docs/1/users/verify-factor Verify Factor documentation
get_smart_hook(self, smart_hook_id)
Gets Smart Hook
 
:param smart_hook_id: Id of the smart_hook
:type smart_hook_id: string
 
Returns the requested smart_hook
:return: smart_hook
:rtype: SmartHook
 
See https://developers.onelogin.com/api-docs/2/smart-hooks/get-hook Get a Hook documentation
get_smart_hook_logs(self, smart_hook_id, query_parameters=None, max_results=None)
Gets a list of smart hook logs.
 
:param smart_hook_id: The id of the Smart Hook.
:type smart_hook_id: string
 
:param query_parameters: Parameters to filter the result of the list
:type query_parameters: dict
 
:param max_results: Limit the number of smart hook logs returned (optional)
:type max_results: int
 
Returns the list of smart hook logs
:return: smart hook log list
:rtype: list[SmartHookLog]
 
See https://developers.onelogin.com/api-docs/2/hooks/get-hook-logs Get Hook Logs documentation
get_smart_hooks(self, query_parameters=None, max_results=None)
Gets a list of hooks.
 
:param query_parameters: Parameters to filter the result of the list
:type query_parameters: dict
 
:param max_results: Limit the number of smart hooks returned (optional)
:type max_results: int
 
Returns the list of smart hooks
:return: smart hooks list
:rtype: list[SmartHook]
 
See https://developers.onelogin.com/api-docs/2/hooks/list-hooks List Hooks documentation
get_url(self, base, obj_id=None, extra_id=None, version_id=None)
get_user(self, user_id)
Gets User by ID.
 
:param user_id: Id of the user
:type user_id: int
 
Returns the user identified by the id
:return: user
:rtype: User
 
See https://developers.onelogin.com/api-docs/1/users/get-user-by-id Get User by ID documentation
    https://developers.onelogin.com/api-docs/2/users/get-user
get_user_apps(self, user_id, ignore_visibility=None)
Gets a list of apps accessible by a user, not including personal apps.
 
:param user_id: Id of the user
:type user_id: int
 
:param ignore_visibility Defaults to `false`. When `true` will all apps that are assigned to a user regardless of their portal visibility setting.
:type ignore_visibility bool
 
Returns the apps user identified by the id
:return: App list of the user
:rtype: list[UserApp]
 
See https://developers.onelogin.com/api-docs/1/users/get-apps-for-user Get Apps for a User documentation
    https://developers.onelogin.com/api-docs/2/users/get-user-apps
get_user_roles(self, user_id)
Gets a list of role IDs that have been assigned to a user.
 
:param user_id: Id of the user
:type user_id: int
 
Returns the role ids of the user identified by the id
:return: role ids
:rtype: list[int]
 
See https://developers.onelogin.com/api-docs/1/users/get-roles-for-user Get Roles for a User documentation
get_users(self, query_parameters=None, max_results=None)
Gets a list of User resources.
 
:param query_parameters: Parameters to filter the result of the list
:type query_parameters: dict
 
:param max_results: Limit the number of users returned (optional)
:type max_results: int
 
Returns the list of users
:return: users list
:rtype: list[User]
 
See https://developers.onelogin.com/api-docs/1/users/get-users Get Users documentation
    https://developers.onelogin.com/api-docs/2/users/list-users
get_users_assigned_to_privilege(self, privilege_id, max_results=None)
Gets a list of the users assigned to a privilege.
 
:param privilege_id: The id of the privilege.
:type privilege_id: string
 
:param max_results: Limit the number of users returned (optional)
:type max_results: int
 
Returns the list of users
:return: user_ids list
:rtype: list[int]
 
See https://developers.onelogin.com/api-docs/1/privileges/get-users Get Assigned Users documentation
get_version_id(self, base)
is_expired(self)
lock_user(self, user_id, minutes)
Use this call to lock a user's account based on the policy assigned to
the user, for a specific time you define in the request, or until you
unlock it.
 
:param user_id: Id of the user to be locked.
:type user_id: int
 
:param minutes: Set to the number of minutes for which you want to lock the user account. (0 to delegate on policy)
:type minutes: int
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/1/users/lock-user-account Lock User Account documentation
log_user_out(self, user_id)
Log a user out of any and all sessions.
 
:param user_id: Id of the user to be logged out
:type user_id: int
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/1/users/log-user-out Log User Out documentation
mapping_sort(self, mapping_ids)
Update order of mappings
 
:param mapping_ids: ordered list of mapping_ids
:type mapping_ids: list
 
Returns the list of processed mapping ids
:return: mapping_id list
:rtype: list[int]
 
See https://developers.onelogin.com/api-docs/2/user-mappings/bulk-sort Bulk Sort documentation
prepare_token(self)
process_login(self, url, headers, data)
process_token_response(self, response)
regenerate_token(self)
Refreshing tokens provides a new set of access and refresh tokens.
 
Returns the refreshed OAuth Token info
:return: OAuth Token info
:rtype: OneLoginToken
 
See https://developers.onelogin.com/api-docs/1/oauth20-tokens/refresh-tokens Refresh Tokens documentation
remove_factor(self, user_id, device_id)
Remove an enrolled factor from a user.
 
:param user_id: Set to the id of the user.
:type user_id: integer
 
:param device_id: The device_id of the MFA device.
:type device_id: integer
 
:return: true if action succeed
:rtype: bool
 
See https://developers.onelogin.com/api-docs/1/multi-factor-authentication/remove-factor Remove a Factor documentation
    https://developers.onelogin.com/api-docs/2/multi-factor-authentication/remove-factor
remove_from_resource_operation(self, url, ids, version_id)
remove_role_admins(self, role_id, admin_ids)
Remove admins from a role.
 
:param role_id: Id of the role
:type role_id: int
 
:param admin_ids: List of admin ids
:type admin_ids: integer array
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/2/roles/remove-role-admins Remove Role Admins documentation
remove_role_from_privilege(self, privilege_id, role_id)
Removes one role from the privilege.
 
:param privilege_id: The id of the privilege.
:type privilege_id: string
 
:param role_id: The id of the role to be removed.
:type role_id: int
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/1/privileges/remove-role Remove Role documentation
remove_role_from_user(self, user_id, role_ids)
Remove Role from User
 
:param user_id: Id of the user
:type user_id: int
 
:param role_ids: List of role ids to be removed
:type role_ids: integer array
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/1/users/remove-role-from-user Remove Role from User documentation
remove_role_users(self, role_id, user_ids)
Remove users from a role.
 
:param role_id: Id of the role
:type role_id: int
 
:param user_ids: List of admin ids
:type user_ids: integer array
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/2/roles/remove-role-users Remove Role Users documentation
remove_stored_token(self)
remove_user_from_privilege(self, privilege_id, user_id)
Removes one user from the privilege.
 
:param privilege_id: The id of the privilege.
:type privilege_id: string
 
:param user_id: The id of the user to be removed.
:type user_id: int
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/1/privileges/remove-user Remove User documentation
reset_email_settings(self)
Reset Email Settings Config
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/2/branding/reset-email-settings Reset Email Settings Config documentation
retrieve_list(self, url, version_id)
retrieve_resource(self, resource_cls, url, version_id)
retrieve_resource_list(self, resource_cls, url, params, index, version_id)
retrieve_resources(self, resource_cls, url, query_parameters, max_results=None, version_id=1)
retrieve_saml_assertion(self, url, data, version_id)
revoke_token(self)
Revokes an access token and refresh token pair.
 
See https://developers.onelogin.com/api-docs/1/oauth20-tokens/revoke-tokens Revoke Tokens documentation
send_invite_link(self, email, personal_email=None)
Sends an invite link to a user that you have already created in your OneLogin account.
 
:param email: Set to the email address of the user that you want to send an invite link for.
:type email: string
 
:param personal_email: If you want to send the invite email to an email other than the
                       one provided in email, provide it here. The invite link will be
                       sent to this address instead.
:type personal_email: string
 
Returns the result of the operation
:return: True if the mail with the link was sent
:rtype: bool
 
See https://developers.onelogin.com/api-docs/1/invite-links/send-invite-link Send Invite Link documentation
set_custom_attribute_to_user(self, user_id, custom_attributes)
Set Custom Attribute Value
 
:param user_id: Id of the user
:type user_id: int
 
:param custom_attributes: Provide one or more key value pairs composed of the custom attribute field shortname and the value that you want to set the field to.
:type custom_attributes: dict
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/1/users/set-custom-attribute Set Custom Attribute Value documentation
set_operation(self, url, ids, version_id)
set_password_using_clear_text(self, user_id, password, password_confirmation, validate_policy=False)
Sets Password by ID Using Cleartext
 
:param user_id: Id of the user
:type user_id: int
 
:param password: Set to the password value using cleartext.
:type password: string
 
:param password_confirmation: Ensure that this value matches the password value exactly.
:type password_confirmation: string
 
:param validate_policy: Defaults to false. This will validate the password against the users OneLogin password policy..
:type validate_policy: boolean
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/1/users/set-password-in-cleartext Set Password by ID Using Cleartext documentation
set_password_using_hash_salt(self, user_id, password, password_confirmation, password_algorithm, password_salt=None)
Set Password by ID Using Salt and SHA-256
 
:param user_id: Id of the user
:type user_id: int
 
:param password: Set to the password value using a SHA-256-encoded value.
:type password: string
 
:param password_confirmation: Ensure that this value matches the password value exactly.
:type password_confirmation: string
 
:param password_algorithm: Set to salt+sha256.
:type password_algorithm: string
 
:param password_salt: (Optional) To provide your own salt value.
:type password_salt: string
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/1/users/set-password-using-sha-256 Set Password by ID Using Salt and SHA-256 documentation
set_role_apps(self, role_id, app_ids, max_results=None)
Assign applications to a role.
 
:param role_id: Id of the role
:type role_id: int
 
:param app_ids: List of app ids
:type app_ids: integer array
 
Returns a list of App assigned to a role.
:return: app id list
:rtype: list[int]
 
See https://developers.onelogin.com/api-docs/2/roles/set-role-apps Set Role Apps documentation
set_state_to_user(self, user_id, state)
Set the State for a user.
 
:param user_id: Id of the user
:type user_id: int
 
:param state: Set to the state value. Valid values: 0-3
:type state: int
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/1/users/set-state Set User State documentation
set_timeout(self, timeout=None)
Changes the timeout used when placing requests with the execute_call method
:param timeout: a request timeout
See http://docs.python-requests.org/en/master/user/advanced/#timeouts
submit_operation(self, url, data)
track_event(self, track_event_params)
Tracks an Event
 
:param track_event_params: Event data (verb, ip, user_agent, user[id, name, authenticated],
                                 source[id,name], session[id], device[id], fp, published)
                     user id data needs to be in the format: {instance region}_{OneLogin User Id}
:type track_event_params: dict
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/2/vigilance/train Track an Event documentation
update_app(self, app_id, app_params)
Updates an app
 
:param app_id: Id of the app
:type app_id: int
 
:param app_params: App data (connector_id, name, description, visible, policy_id, configuration,
                             tab_id, visible, brand_id, role_ids, notes)
:type app_params: dict
 
Returns the modified app
:return: app
:rtype: OneLoginApp
 
See https://developers.onelogin.com/api-docs/2/apps/update-app Update an App documentation
update_app_rule(self, app_id, app_rule_id, app_rule_params)
Updates an app rule
 
:param app_id: Id of the app
:type app_id: int
 
:param app_rule_id: Id of the app rule
:type app_rule_id: int
 
:param app_rule_params: App Rule data (name, enabled, match, position,
                                       conditions[source, operator, value],
                                       actions[action, value, expression,scriplet, macro])
:type app_rule_params: dict
 
Returns the modified app rule
:return: app_rule
:rtype: AppRule
 
See https://developers.onelogin.com/api-docs/2/app-rules/update-rule Update App Rule documentation
update_brand(self, brand_id, brand_params)
Updates accound brand
 
:param brand_id: Id of the brand
:type brand_id: int
 
:param brand_params: Brand data (name, enabled, custom_support_enabled, custom_color,
                                 custom_accent_color, custom_masking_color, custom_masking_opacity,
                                 enable_custom_label_for_login_screen, custom_label_text_for_login_screen,
                                 login_instruction_title, login_instruction, hide_onelogin_footer,
                                 mfa_enrollment_message, background, logo)
:type brand_params: dict
 
Returns the modified brand
:return: brand
:rtype: Brand
 
See https://developers.onelogin.com/api-docs/2/branding/update-account-brand Update Account Brand documentation
update_email_settings(self, email_settings)
Update Email Settings Config
 
Returns if the action succeed
:return: true if success
:rtype: bool
 
See https://developers.onelogin.com/api-docs/2/branding/update-email-settings Update Email Settings Config documentation
update_env_var(self, env_var_id, value)
Updates an environment variable
 
:param env_var_id: Id of the environment variable
:type env_var_id: string
 
:param env_var_params: Environment variable data (name, value)
:type env_var_params: dict
 
Returns the modified environment variable
:return: environment variable
:rtype: SmartHookEnv
 
See https://developers.onelogin.com/api-docs/2/hooks/update-environment-variable Update Environment Variable documentation
update_mapping(self, mapping_id, mapping_params)
Updates Mapping
 
:param mapping_id: Id of the mapping
:type mapping_id: int
 
:param mapping_params: Mapping data (name, enabled, match, position
                                  conditions[source, operator,value],
                                  actions[action, value])
:type mapping_params: dict
 
Returns the mapping
:return: mapping
:rtype: Mapping
 
Returns the modified mapping
:return: mapping
:rtype: Mapping
 
See https://developers.onelogin.com/api-docs/2/user-mappings/update-mapping Update Mapping documentation
update_operation(self, url, data)
update_privilege(self, privilege_id, name, version, statements)
Updates a Privilege
 
:param privilege_id: The id of the privilege you want to update.
:type privilege_id: string
 
:param name: The name of the privilege.
:type name: string
 
:param version: The version for the privilege schema. Set to 2018-05-18.
:type version: string
 
:param statements: A list of statements. Statement object or a dict with the keys Effect, Action and Scope
:type statements: list[Statement] or list[dict]
 
Returns the modified privilege
:return: privilege
:rtype: Privilege
 
See https://developers.onelogin.com/api-docs/1/privileges/update-privilege Update Privilege documentation
update_resource(self, resource_cls, url, data, query_params, version_id)
update_risk_rule(self, risk_rule_id, risk_rule_params)
Updates a risk rule
 
:param risk_rule_id: Id of the risk rule
:type risk_rule_id: int
 
:param risk_rule_params: Risk Rule data (name, type, target, filters, source)
:type risk_rule_params: dict
 
Returns the modified risk rule
:return: risk_rule
:rtype: RiskRule
 
See https://developers.onelogin.com/api-docs/2/vigilance/update-rule Update a Rule documentation
update_role(self, role_id, role_params)
Updates a role
 
:param role_id: Id of the role
:type role_id: int
 
:param role_params: Role data (name)
:type role_params: dict
 
Returns the role id of the modified role
:return: role_id
:rtype: int
 
See https://developers.onelogin.com/api-docs/2/roles/update-role Update Role by ID documentation
update_smart_hook(self, smart_hook_id, smart_hook_params)
Updates a hook
 
:param smart_hook_id: Id of the smart hook
:type smart_hook_id: int
 
:param smart_hook_params: Smart Hook data (type, disabled, timeout, env_vars,
                                           runtime, context_version, retries,
                                           risk_enabled, mfa_device_info_enabled,
                                           location_enabled, packages, function)
:type smart_hook_params: dict
 
Returns the modified hook
:return: smart_hook
:rtype: SmartHook
 
See https://developers.onelogin.com/api-docs/2/hooks/update-hook Update a Hook documentation
update_user(self, user_id, user_params, mappings=None, validate_policy=None)
Updates an user
 
:param user_id: Id of the user
:type user_id: int
 
:param user_params: User data (firstname, lastname, email, username, company,
                               department, directory_id, distinguished_name,
                               external_id, group_id, invalid_login_attempts,
                               locale_code, manager_ad_id, member_of,
                               openid_name, phone, samaccountname, title,
                               userprincipalname)
                           v2 (password_confirmation, password_algorithm, salt, role_ids
                               state, status, trusted_idp_id)
:type user_params: dict
 
:param mappings: Controls how mappings will be applied to the user on creation
                [async, sync, disabled]
:type mappings: string
 
:param validate_policy: Validate password against user policy?
:type validate_policy: bool
 
Returns the modified user
:return: user
:rtype: User
 
See https://developers.onelogin.com/api-docs/1/users/update-user Update User by ID documentation
    https://developers.onelogin.com/api-docs/2/users/update-user
validate_user(self, validate_user_params)
Validates a User
 
:param validate_user_params: Smart MFA User data (user_identifier, email, phone, context, risk_threshold,
                                                  firstname, lastname, expires_in)
:type validate_user_params: dict
 
Returns a mfa validation response
:return: smart_mfa
:rtype: SmartMFA
 
See https://developers.onelogin.com/api-docs/2/smart-mfa/validate-user Validate a User documentation
verify_enroll_factor_otp(self, user_id, registration_id, otp)
Verify enrollment for OneLogin SMS, OneLogin Email, OneLogin Protect and Authenticator authentication factors.
 
:param user_id: Set to the id of the user.
:type user_id: integer
 
:param registration_id: uuid of the registration process (enroll factor)
:type registration_id: string
 
:param otp: One-Time-Password
:type otp: string
 
 
:return: Enrollment status
:rtype: MFACheckStatus
 
See https://developers.onelogin.com/api-docs/2/multi-factor-authentication/enroll-factor-verify-otp Verify Enrollment of Authentication Factors documentation
verify_enroll_factor_poll(self, user_id, registration_id)
Verify enrollment for OneLogin Voice & Protect Push authentication factors.
 
:param user_id: Set to the id of the user.
:type user_id: integer
 
:param registration_id: uuid of the registration process (enroll factor)
:type registration_id: string
 
:return: Enrollment status
:rtype: MFACheckStatus
 
See https://developers.onelogin.com/api-docs/2/multi-factor-authentication/enroll-factor-verify-poll Verify Enrollment of OneLogin Voice & Protect documentation
verify_factor(self, user_id, device_id, otp_token=None, state_token=None)
Authenticates a one-time password (OTP) code provided by a multifactor authentication (MFA) device.
 
:param user_id: Set to the id of the user.
:type user_id: integer
 
:param device_id: Set to the device_id of the MFA device.
:type device_id: integer
 
:param otp_token: OTP code provided by the device or SMS message sent to user.
                  When a device like OneLogin Protect that supports Push has
                  been used you do not need to provide the otp_token.
:type otp_token: string
 
:param state_token: The state_token is returned after a successful request
                    to Enroll a Factor or Activate a Factor.
                    MUST be provided if the needs_trigger attribute from
                    the proceeding calls is set to true.
:type state_token: string
 
:return: true if action succeed
:rtype: bool
 
See https://developers.onelogin.com/api-docs/1/multi-factor-authentication/verify-factor Verify an Authentication Factor documentation
verify_factor_otp(self, user_id, verification_id, otp, device_id=None)
Verify an OTP code provided by SMS, Email, OneLogin Protect or Authenticator
 
:param user_id: Set to the id of the user.
:type user_id: integer
 
:param verification_id: uuid of the verification process (activate factor)
:type verification_id: string
 
:param otp: One-Time-Password
:type otp: string
 
:param device_id: The device_id of the enrolled factors (No required on OL SMS and OL Email)
:type device_id: int
 
:return: Enrollment status
:rtype: MFACheckStatus
 
See https://developers.onelogin.com/api-docs/2/multi-factor-authentication/verify-factor Verify an Authentication Factor documentation
verify_factor_poll(self, user_id, verification_id)
Verify completion of OneLogin Push or OneLogin Voice factors.
 
:param user_id: Set to the id of the user.
:type user_id: integer
 
:param verification_id: uuid of the verification process (activate factor)
:type verification_id: string
 
:return: Enrollment status
:rtype: MFACheckStatus
 
See https://developers.onelogin.com/api-docs/2/multi-factor-authentication/verify-factor-poll Verify an Authentication Factor documentation
verify_token(self, state_token, otp_token)
Verify MFA Token
 
:param state_token: The state_token value returned from the Validate a User endpoint
:type state_token: string
 
:param state_token: The MFA token that was sent to the user via Email or SMS using the Validate a User endpoint
:type state_token: string
 
:return: true if action succeed
:rtype: bool
 
See https://developers.onelogin.com/api-docs/2/smart-mfa/verify-token Verify MFA Token documentation

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
CUSTOM_USER_AGENT = 'onelogin-python-sdk 2.0.0'
api_configuration = {'app': 1, 'app_rule': 2, 'assertion': 2, 'branding': 2, 'connector': 2, 'custom_login': 1, 'event': 1, 'group': 1, 'invite': 1, 'mfa': 2, ...}
client_id = None
client_secret = None

 
Data
        __version__ = '2.0.0'