SCAutolib.utils

This module provides a set of additional helping functions that are used across the library. These functions are based on library demands and are not aimed to cover some general use-cases or specific corner cases.

Functions

ca_factory(path=None, cnf=None, card_data=None, ca_name=None, create=False)[source]

Create CA object. If certain CA object was created in previous run of SCAutolib and it was serialized and saved in .json file, then such CA object would be initialized based on the file. If create param is True new CA object will be created regardless the presence of the .json file.

Parameters:
  • path (Path) – path to the CA directory

  • cnf (OpensslCnf object) – object representing openssl cnf file

  • card_data (dict) – dictionary with various attributes of the card as PIN, cardholder, slot, etc.

  • ca_name (str) – name of CA that identifies CA file to be loaded if create parameter is set to False

  • create (bool) – indicator to create new CA. If it’s false existing CA files will be loaded

Returns:

CA object

Return type:

SCAutolib.models.CA object

dump_to_json(obj)[source]

Store serialised object to the JSON file.

ipa_factory()[source]

Create a new IPAServerCA object.

Returns:

object of IPAServerCA

Return type:

SCAutolib.models.CA.IPAServerCA

load_token(card_name=None, update_sssd=False)[source]

Load card with given name from JSON file. This function is intended to load card objects to tests during pytest configuration. If update_sssd param is True sssd.conf file will be updated based on card data

Parameters:
  • card_name (str) – name of the card to be loaded

  • update_sssd (bool) – indicates if sssd.conf matchrule should be updated based on card data

:type update_sssd bool

Returns:

card object

Return type:

Card

load_user(username, **kwargs)[source]

Load user with given username from JSON file.

Parameters:

username (str) – username of the user

Returns:

user object

Return type:

BaseUser