Features

This section describes all features that are shipped with this package.

Scenario Features

Server Scenario Features

class balderhub.auth.lib.scenario_features.server.AuthenticationForConfig(**kwargs)

Bases: Feature

This feature class represents the authentication rule configuration for a server device.

get_resource_rules_that_require_authentication() ResourceRuleList

Returns the list of resource rules, that require authentication.

Returns:

the resource rule list

get_resource_rules_that_require_no_authentication() ResourceRuleList

Returns the list of resource rules, that require NO authentication.

Returns:

the resource rule list

property resolved_resources_that_require_authentication

returns the list of resolved resource rules, that require authentication

property resolved_resources_that_require_no_authentication

returns the list of resolved resource rules, that require NO authentication

property unresolved_resources_that_require_authentication

returns the list of unresolved resource rules, that require authentication

property unresolved_resources_that_require_no_authentication

returns the list of unresolved resource rules, that require NO authentication

class balderhub.auth.lib.scenario_features.server.ExistenceForConfig(**kwargs)

Bases: Feature

This feature class represents the existence rule configuration for a server device.

get_resource_rules_that_exist() ResourceRuleList

Returns the list of resource rules, that exist.

Returns:

the resource rule list

get_resource_rules_that_not_exist() ResourceRuleList

Returns the list of resource rules, that do NOT exist.

Returns:

the resource rule list

property resolved_resources_that_exists

returns the list of resolved resource rules, that exist

property resolved_resources_that_not_exist

returns the list of resolved resource rules, that do NOT exist

property unresolved_resources_that_exists

returns the list of unresolved resource rules, that exist

property unresolved_resources_that_not_exist

returns the list of unresolved resource rules, that do NOT exist

Client Role Setup Features

class balderhub.auth.lib.scenario_features.client.role.BaseRoleFeature(**kwargs)

Bases: Feature

base class for a role to authenticate

class balderhub.auth.lib.scenario_features.client.role.TokenRoleFeature(**kwargs)

Bases: BaseRoleFeature

config feature that provides a basic token as authentication method

property token: str
Returns:

returns the valid token to authenticate

class balderhub.auth.lib.scenario_features.client.role.UserRoleFeature(**kwargs)

Bases: BaseRoleFeature

config feature that provides a user/password authentification

property password: str
Returns:

the valid password for this user role

property username: str
Returns:

the valid username of this user role

Client Scenario Features

class balderhub.auth.lib.scenario_features.client.AuthenticationFeature(**kwargs)

Bases: Feature

This is the base feature class to authenticate the user device.

authenticate()

authenticates the user

property is_authenticated: bool

returns True if the user is authenticated, False otherwise

unauthenticate()

unauthenticates the user

class balderhub.auth.lib.scenario_features.client.AuthenticationStateMachine(**kwargs)

Bases: StateMachine

This is the feature class representing an authentication state machine.

class State(value)

Bases: State

The states for the authentication state machine.

change_state_to(state: State)

Changes the current state of the authentication state machine to the given state.

Parameters:

state – the state to change to

property current_state

returns the current state of the authentication state machine

class balderhub.auth.lib.scenario_features.client.HasPermissionsForConfig(**kwargs)

Bases: Feature

This feature class represents the permission rule configuration for a user device.

get_resource_rules_with_permissions() ResourceRuleList

Returns the list of resource rules, the user has permissions.

Returns:

the resource rule list

get_resource_rules_without_permissions() ResourceRuleList

Returns the list of resource rules, the user has NO permissions

Returns:

the resource rule list

property resolved_resources_with_permissions

returns the list of resolved resource rules, the user has permissions

property resolved_resources_without_permissions

returns the list of resolved resource rules, the user has NO permissions

property unresolved_resources_with_permissions

returns the list of unresolved resource rules, the user has permissions

property unresolved_resources_without_permissions

returns the list of unresolved resource rules, the user has NO permissions

class balderhub.auth.lib.scenario_features.client.IsUnauthenticatedFeature(**kwargs)

Bases: Feature

autonomous feature defining that the device is an unauthenticated device

class balderhub.auth.lib.scenario_features.client.OperationHandlingFeature(**kwargs)

Bases: Feature

This is the base feature class for handling operations.

cleanup_operation(operation: Operation) None

Cleans up the given operation.

Parameters:

operation – the operation to clean up

enter_operation(operation: Operation) bool

Enters the given operation.

Parameters:

operation – the operation to enter

Returns:

True if the operation was entered successfully, False otherwise

leave_operation(operation: Operation) bool

Leaves the given operation.

Parameters:

operation – the operation to leave

Returns:

True if the operation was left successfully, False otherwise

prepare_operation(operation: Operation) None

Prepares the given operation.

Parameters:

operation – the operation to prepare

class balderhub.auth.lib.scenario_features.client.UnresolvedResourceParameterConfig(**kwargs)

Bases: Feature

This is a configuration feature that provides parameters for resolving unresolved resources.

get_parameters_for(resource_rule) list[balderhub.auth.lib.utils.unresolved_resource.UnresolvedResource.Parameter]

Returns a list of parameters that should be used to resolve the given unresolved resource rule.

Parameters:

resource_rule – the resource rule that contains the unresolved resource

Returns:

a list of parameters for resolving the unresolved resource

class balderhub.auth.lib.scenario_features.client.UserLoginFeature(**kwargs)

Bases: Feature

This login feature can be assigned to devices that do provide a basic login handling.

insert_password(password: str) None

Inserts the password for login

Parameters:

password – the password to insert

insert_username(username: str) None

Inserts the username for login

Parameters:

username – the username to insert

is_already_logged_in()
Returns:

returns True if someone is already logged in, otherwise False

submit_login() None

Executes the login

Setup Features

Server Setup Features

class balderhub.auth.lib.setup_features.server.AuthenticationForConfig(**kwargs)

Bases: AuthenticationForConfig

Basic Setup implementation of balderhub.auth.lib.scenario_features.server.AuthenticationForConfig. It provides an implementation of AuthenticationForConfig.get_resource_rules_that_require_no_authentication(), by subtracting the rule set of the rules that require auth from the existing rules.

get_resource_rules_that_require_authentication() ResourceRuleList

Returns the list of resource rules, that require authentication.

Returns:

the resource rule list

get_resource_rules_that_require_no_authentication() ResourceRuleList

Returns the list of resource rules, that require NO authentication.

Returns:

the resource rule list

Client Setup Features

class balderhub.auth.lib.setup_features.client.AuthenticationStateMachine(**kwargs)

Bases: AuthenticationStateMachine

Manages and transitions between authentication states.

The AuthenticationStateMachine class serves as a high-level abstraction for handling authentication states such as authenticated and unauthenticated. It ensures state transitions are valid and performs the necessary actions to switch between states.

It provides a setup-level implementation of balderhub.auth.lib.scenario_features.client.AuthenticationStateMachine.

change_state_to(state: State)

Changes the current state of the authentication state machine to the given state.

Parameters:

state – the state to change to

property current_state

returns the current state of the authentication state machine

class balderhub.auth.lib.setup_features.client.HasPermissionsForConfig(**kwargs)

Bases: HasPermissionsForConfig

Basic Setup implementation of balderhub.auth.lib.scenario_features.client.HasPermissionsForConfig. It provides an implementation of HasPermissionsForConfig.get_resource_rules_without_permissions(), by subtracting the rule set of the rules that require permissions from the rules that require authentication.

class Server

Bases: VDevice

VDevice representing the server.

get_resource_rules_with_permissions() ResourceRuleList

Returns the list of resource rules, the user has permissions.

Returns:

the resource rule list

get_resource_rules_without_permissions() ResourceRuleList

Returns the list of resource rules, the user has NO permissions

Returns:

the resource rule list