oktalib package

Submodules

oktalib.oktalib module

Main code for oktalib.

class oktalib.oktalib.Okta(host, token)[source]

Bases: object

Models the api of okta.

applications

The applications configured in okta.

Returns:The generator of applications configured in okta
Return type:generator
assign_group_to_application(application_label, group_name)[source]

Assigns a group to an application.

Parameters:
  • application_label – The label of the application to assign the group to
  • group_name – The group name to assign to the application
Returns:

True on success, False otherwise

create_group(name, description)[source]

Creates a group in okta.

Parameters:
  • name – The name of the group to create
  • description – The description of the group to create
Returns:

The created group object on success, None otherwise

create_user(first_name, last_name, email, login, password=None, enabled=True)[source]

Creates a user in okta.

Parameters:
  • first_name – The first name of the user
  • last_name – The last name of the user
  • email – The email of the user
  • login – The login of the user
  • password – The password of the user
  • enabled – A flag whether the user should be enabled or not Defaults to True
Returns:

The created user on success, None otherwise

Return type:

User

delete_group(name)[source]

Deletes a group from okta.

Parameters:name – The name of the group to delete
Returns:True on success, False otherwise
Return type:bool
Raises:InvalidGroup – The group provided as argument does not exist.
get_application_by_id(id_)[source]

Retrieves an application by id.

Parameters:id – The id of the application to retrieve
Returns:Application Object
get_application_by_label(label)[source]

Retrieves an application by label.

Parameters:label – The label of the application to retrieve
Returns:Application Object
get_group_by_id(group_id)[source]

Retrieves the group (of any type) by id.

Parameters:group_id – The id of the group to retrieve
Returns:The group if a match is found else None
Return type:Group
get_group_by_name(name)[source]

Retrieves the first group (of any type) by name.

Parameters:name – The name of the group to retrieve
Returns:The group if a match is found else None
Return type:Group
get_group_type_by_name(name, group_type='OKTA_GROUP')[source]

Retrieves the group type of okta by name.

Parameters:
  • group_type – The type of okta group to retrieve
  • name – The name of the group to retrieve
Returns:

The group if a match is found else None

Return type:

Group

get_user_by_login(login)[source]

Retrieves a user by login.

Parameters:login – The login to match the user with
Returns:The user if found, None otherwise
Return type:User
groups

The groups configured in okta.

Returns:The generator of groups configured in okta
Return type:generator
remove_group_from_application(application_label, group_name)[source]

Removes a group from an application.

Parameters:
  • application_label – The label of the application to remove the group from
  • group_name – The name of the group to remove from the application
Returns:

True on success, False otherwise

search_groups_by_name(name)[source]

Retrieves the groups (of any type) by name.

Parameters:name – The name of the groups to retrieve
Returns:A list of groups if a match is found else an empty list
Return type:list
search_users(value)[source]

Retrieves a list of users by looking into name, last name and email.

Parameters:value – The value to match with
Returns:The users if found, empty list otherwise
Return type:list
search_users_by_email(email)[source]

Retrieves a list of users by email.

Parameters:email – The email to match the user with
Returns:The users if found, empty list otherwise
Return type:list
users

The users configured in okta.

Returns:The generator of users configured in okta
Return type:generator

oktalib.oktalibexceptions module

Custom exception code for oktalib.

exception oktalib.oktalibexceptions.ApiLimitReached[source]

Bases: Exception

The api limits are close to being reached.

exception oktalib.oktalibexceptions.AuthFailed[source]

Bases: Exception

The authentication was not possible. Invalid token maybe.

exception oktalib.oktalibexceptions.InvalidApplication[source]

Bases: Exception

The application provided is invalid.

exception oktalib.oktalibexceptions.InvalidGroup[source]

Bases: Exception

The group provided is invalid.

exception oktalib.oktalibexceptions.InvalidUser[source]

Bases: Exception

The user provided is invalid.

exception oktalib.oktalibexceptions.ServerError[source]

Bases: Exception

A server has responded with an error code.

exception oktalib.oktalibexceptions.UnableToUpdate[source]

Bases: Exception

Could not update use property.

Module contents

oktalib package.

Import all parts from oktalib here