request.authentication.base

Provides base authentication class using the Composite pattern for modular authentication.

Module Contents

class request.authentication.base.AuthenticationComponent[source]

Bases: abc.ABC

Abstract base class for authentication components.

abstractmethod authenticate(context)[source]

Authenticate a request using specific logic.

Parameters:

context (request.request_context.BaseRequestContext)

Return type:

devices.models.DeviceModel | None

class request.authentication.base.ClientCertificateAuthentication(*, domain_credential_only=True)[source]

Bases: AuthenticationComponent, trustpoint.logger.LoggerMixin

Handles authentication via client certificates.

Parameters:

domain_credential_only (bool)

domain_credential_only: bool = True[source]
authenticate(context)[source]

Authenticate using the client certificate from the context.

Parameters:

context (request.request_context.BaseRequestContext)

Return type:

None

class request.authentication.base.IDevIDAuthentication[source]

Bases: AuthenticationComponent, trustpoint.logger.LoggerMixin

Handles authentication via IDevID certificates.

authenticate(context)[source]

Authenticate the request using the IDevID mechanism.

Parameters:

context (request.request_context.BaseRequestContext)

Return type:

None

class request.authentication.base.CompositeAuthentication[source]

Bases: AuthenticationComponent, trustpoint.logger.LoggerMixin

Composite authenticator for grouping and executing multiple authentication methods.

components: list[AuthenticationComponent] = [][source]
add(component)[source]

Add an authentication component to the composite.

Parameters:

component (AuthenticationComponent)

Return type:

None

remove(component)[source]

Remove an authentication component from the composite.

Parameters:

component (AuthenticationComponent)

Return type:

None

authenticate(context)[source]

Authenticate the request using all registered components.

Parameters:

context (request.request_context.BaseRequestContext)

Return type:

None