oktalib.entities package

Submodules

oktalib.entities.core module

Main code for core.

class oktalib.entities.core.Entity(okta_instance, data)[source]

Bases: object

The core object of okta.

property created_at

The date and time of the group’s creation.

Returns:

The datetime object of when the group was created

Return type:

datetime

property id

The id of the entity.

Returns:

The internal id of the entity

Return type:

basestring

property last_updated_at

The date and time of the entity’s last update.

Returns:

The datetime object of when the entity was last updated

Return type:

datetime

property url

The url of the entity.

Returns:

None in the core entity.

All objects inheriting from this would either expose this from their data or construct and overwrite this.

oktalib.entities.entities module

Main code for entities.

class oktalib.entities.entities.AdminRole(okta_instance, data)[source]

Bases: Entity

Models the admin role object of okta.

property assignment_type

The assignment type of the role.

Returns:

The assignment type the role

Return type:

string

property created

The date and time when the role was created.

Returns:

The datetime object of when the role was created

Return type:

datetime

property id

The id of the role.

Returns:

The id of the role

Return type:

string

property label

The label of the role.

Returns:

The label of the role

Return type:

string

property last_updated

The date and time of the role when it was last updated.

Returns:

The datetime object of when the role was last updated

Return type:

datetime

property status

The status of the role.

Returns:

The status of the role

Return type:

string

property type

The type of the role.

Returns:

The name of the type of the role

Return type:

string

class oktalib.entities.entities.Application(okta_instance, data)[source]

Bases: Entity

Models the apps in okta.

property accessibility

The accessibility of the application.

Returns:

The accessibility of the application

Return type:

dictionary

activate()[source]

Activates the application.

Returns:

True on success, False otherwise

Return type:

bool

add_group_by_id(group_id)[source]

Adds a group to the application.

Parameters:

group_id – The id of the group to add

Returns:

True on success, False otherwise

add_group_by_name(group_name)[source]

Adds a group to the application.

Parameters:

group_name – The name of the group to add

Returns:

True on success, False otherwise

assign_group_to_saml_user_roles(group_id, role, saml_roles)[source]

Assigns an okta group to an okta application with saml user roles.

Parameters:
  • group_id – The id of the group to be associated

  • role – The aws role that okta uses to assume SAML roles in other accounts

  • saml_roles – the SAML Roles to be assumed

Returns:

The status of the assignment( True or False )

Return type:

Bool

property credentials

The credentials of the application.

Returns:

The credentials of the application

Return type:

dictionary

deactivate()[source]

Deactivates the application.

Returns:

True on success, False otherwise

Return type:

bool

property features

The features of the application.

Returns:

The features of the application

Return type:

dictionary

get_associated_saml_roles()[source]

Returns the Saml IAM Roles associated with the application.

Returns:

List of saml iam roles

Return type:

list

get_group_assignment_by_group_name(name)[source]

Retrieves a group assignment by a group name.

Parameters:

name – The name of the group assignment to retrieve.

Returns:

The matching group assignment if found else None.

Return type:

group_assignment (GroupAssignment)

get_user_assignment_by_email(email)[source]

Retrieves a user assignment by a user email.

Parameters:

email – The email of the user assignment to retrieve.

Returns:

The matching user assignment if found else None.

Return type:

user_assignment (UserAssignment)

property group_assignments

The group assignments to the application.

Returns:

A generator of group assignments for application

Return type:

generator

property groups

The groups of the application.

Returns:

A generator of Group objects for the groups of the application

Return type:

generator

property label

The label of the application.

Returns:

The label of the application

Return type:

basestring

property name

The name of the application.

Returns:

The name of the application

Return type:

basestring

property notification_settings

The notification settings of the application.

Returns:

The notification settings of the application

Return type:

dictionary

remove_group_by_id(group_id)[source]

Removes a group from the application.

Parameters:

group_id – The id of the group to remove

Returns:

True on success, False otherwise

remove_group_by_name(group_name)[source]

Removes a group from the application.

Parameters:

group_name – The name of the group to remove

Returns:

True on success, False otherwise

property settings

The settings of the application.

Returns:

The settings of the application

Return type:

dictionary

property sign_on_mode

The sign on mode of the application.

Returns:

The sign on mode of the application

Return type:

basestring

property sign_on_settings

The sign on settings of the application.

Returns:

The sign on settings of the application

Return type:

dictionary

property status

The status of the application.

Returns:

The status of the application

Return type:

basestring

property url

The url of the application.

Returns:

The url of the application

Return type:

string

property user_assignments

The user assignments to the application.

Returns:

A generator of user assignments for application

Return type:

generator

property users

The users of the application.

Returns:

A generator of User objects for the users of the application

Return type:

generator

property visibility

The visibility of the application.

Returns:

The visibility of the application

Return type:

dictionary

class oktalib.entities.entities.Group(okta_instance, data)[source]

Bases: Entity

Models the group object of okta.

add_to_application_with_label(application_label)[source]

Adds the group to an application.

Parameters:

application_label – The label of the application to add the group to

Returns:

True on success, False otherwise

add_user_by_id(id_)[source]

Adds a user to the group.

Parameters:

id – The id of the user to add

Returns:

True on success, False otherwise

add_user_by_login(login)[source]

Adds a user to the group.

Parameters:

login – The login of the user to add

Returns:

True on success, False otherwise

property applications

The applications of the group.

Returns:

A generator of Application objects for the applications of the group

Return type:

generator

delete()[source]

Deletes the group from okta.

Returns:

True on success, False otherwise

Return type:

bool

property description

The description of the group.

Returns:

The description of the group

Return type:

string

property last_membership_updated_at

The date and time of the group’s last membership update.

Returns:

The datetime object of when the group’s memberships were last updated

Return type:

datetime

property name

The name of the group.

Returns:

The name of the group

Return type:

string

property object_classes

The classes of the group.

Returns:

The tuple of the classes of the group

Return type:

tuple

property profile

The profile of the group.

Returns:

The profile of the group

Return type:

dict

remove_from_application_with_label(application_label)[source]

Removes the group from an application.

Parameters:

application_label – The label of the application to remove the group from

Returns:

True on success, False otherwise

remove_user_by_id(id_)[source]

Remove a user from the group.

Parameters:

id – The id of the user to remove

Returns:

True on success, False otherwise

remove_user_by_login(login)[source]

Removes a user from the group.

Parameters:

login – The login of the user to remove

Returns:

True on success, False otherwise

property type

The type of the group.

Returns:

The name of the type of the group

Return type:

string

property url

The url of the group.

Returns:

The url of the group

Return type:

string

property users

The users of the group.

Returns:

A generator of User objects for the users of the group

Return type:

generator

class oktalib.entities.entities.GroupAssignment(okta_instance, data)[source]

Bases: Group

Models the group assignment object of okta for apps.

property priority

The priority of the group assignment.

Returns:

The priority of the group.

Return type:

int

property profile_role

Profile role.

property profile_saml_roles

Profile saml roles.

class oktalib.entities.entities.User(okta_instance, data)[source]

Bases: Entity

Models the user object of okta.

activate()[source]

Activate the user.

Returns:

True on success, False otherwise

property activated_at

The date and time of the users’s activation.

Returns:

The datetime object of when the user was activated

Return type:

datetime

property city

The city of the user.

Returns:

The city of the user

Return type:

string

property contry_code

The contry code of the user.

Returns:

The country code of the user

Return type:

string

property credentials

The credentials of the user.

Returns:

The credentials of the user

Return type:

dictionary

deactivate()[source]

Deactivate the user.

Returns:

True on success, False otherwise

delete()[source]

Deletes the user from okta.

Returns:

True on success, False otherwise

Return type:

bool

property department

The department of the user.

Returns:

The department of the user

Return type:

string

property display_name

The display name of the user.

Returns:

The display name of the user

Return type:

string

property email

The email of the user.

Returns:

The email of the user

Return type:

string

property employee_number

The employee number of the user.

Returns:

The employee number of the user

Return type:

string

expire_password()[source]

Expires the user’s password.

Returns:

True on success, False otherwise

property first_name

The first name of the user.

Returns:

The first name of the user

Return type:

string

property groups

Lists the groups the user is a member of.

Returns:

A generator of Group objects for which the user is member of

Return type:

generator

property last_login_at

The date and time of the users’s last login.

Returns:

The datetime object of when the user last logged in

Return type:

datetime

property last_name

The last name of the user.

Returns:

The last name of the user

Return type:

string

property locale

The locale of the user.

Returns:

The locale of the user

Return type:

string

property login

The login of the user.

Returns:

The login of the user

Return type:

string

property manager

The manager of the user.

Returns:

The manager of the user

Return type:

string

property mobile_phone

The mobile phone of the user.

Returns:

The mobile phone of the user

Return type:

string

property organization

The organization of the user.

Returns:

The organization of the user

Return type:

string

property password_changed_at

The date and time of the users’s last password change.

Returns:

The datetime object of when the user last changed password

Return type:

datetime

property primary_phone

The primary phone of the user.

Returns:

The primary phone of the user

Return type:

string

reset_password()[source]

Resets the user’s password.

Returns:

True on success, False otherwise

property roles

Lists the admin roles the user has.

Returns:

A generator of roles objects for which the user is member of

Return type:

generator

property second_email

The second email of the user.

Returns:

The second email of the user

Return type:

string

set_password(password)[source]

Set a password for the user.

Returns:

True on success, False otherwise

set_temporary_password()[source]

Sets a temporary password for the user.

Returns:

Password on success, None otherwise

Return type:

string

property status

The status of the user.

Returns:

The status of the user

Return type:

string

property status_changed_at

The date and time of the users’s status change.

Returns:

The datetime object of when the user had last changed status

Return type:

datetime

property street_address

The street address of the user.

Returns:

The street address of the user

Return type:

string

suspend()[source]

Suspends the user.

Returns:

True on success, False otherwise

property title

The title of the user.

Returns:

The title of the user

Return type:

string

unlock()[source]

Unlocks the user.

Returns:

True on success, False otherwise

unsuspend()[source]

Unsuspends the user.

Returns:

True on success, False otherwise

update_password(old_password, new_password)[source]

Changes the user’s password.

Returns:

True on success, False otherwise

update_profile(new_profile)[source]

Update a user’s profile in okta.

Parameters:

new_profile – A object with attributes to change (example: {‘profile’: {‘firstName’: ‘Test’}})

Returns:

True or False depending on success

Return type:

Bool

update_security_question(password, question, answer)[source]

Changes the user’s security question and answer.

Returns:

True on success, False otherwise

property url

The url of the user.

Returns:

The url of the user

Return type:

string

property zip_code

The zip code of the user.

Returns:

The zip code of the user

Return type:

string

class oktalib.entities.entities.UserAssignment(okta_instance, data)[source]

Bases: User

Models the user assignment object of okta for apps.

property email

The email of the user.

Returns:

The email of the user.

Return type:

email (str)

property group

The group that the user assignment refers to.

Returns:

The group that the user assignment refers to.

Return type:

group (Group)

property profile_role

Profile role.

property profile_saml_roles

Profile saml roles.

Module contents

entities package.

Import all parts from entities here