pyeudiw.trust package

Subpackages

Submodules

pyeudiw.trust.anchors_loader module

pyeudiw.trust.dynamic module

class pyeudiw.trust.dynamic.CombinedTrustEvaluator(handlers: list[TrustHandlerInterface], db_engine: DBEngine, mode: Literal['update_first', 'cache_first'] = 'update_first')[source]

Bases: BaseLogger

A trust evaluator that combines multiple trust models.

build_metadata_endpoints(backend_name: str, entity_uri: str) list[tuple[str, Callable[[Context, Any], Response]]][source]
static from_config(config: dict, db_engine: DBEngine, default_client_id: str, mode: Literal['update_first', 'cache_first'] = 'update_first') CombinedTrustEvaluator[source]

Create a CombinedTrustEvaluator from a configuration.

Parameters:
  • config (dict) – The configuration

  • db_engine (DBEngine) – The database engine

Returns:

The CombinedTrustEvaluator

Return type:

CombinedTrustEvaluator

get_jwt_header_trust_parameters(issuer: str | None = None, force_update: bool = False) dict[str, Any][source]

Get the trust parameters of a certain issuer according to some trust model.

Parameters:

issuer (str) – The issuer

Returns:

The trust parameters

Return type:

list[dict]

get_metadata(issuer: str | None = None, force_update: bool = False) dict[source]

Yields a dictionary of metadata about an issuer, according to some trust model.

Parameters:
  • issuer (str) – The issuer

  • force_update (bool) – If the metadata should be updated even if it is already present in the cache

Returns:

The metadata

Return type:

dict

get_policies(issuer: str | None = None, force_update: bool = False) dict[str, any][source]

Get the policies of a certain issuer according to some trust model.

Parameters:

issuer (str) – The issuer

Returns:

The policies

Return type:

dict[str, any]

get_public_keys(issuer: str | None = None, static_trust_materials: dict = {}, force_update: bool = False) list[dict][source]

Yields a list of public keys for an issuer, according to some trust model. If trust materials are provided, they are used to derive the public keys. If not, the public keys are derived from a trust model that does not require trust materials to attest the trust.

Parameters:
  • issuer (str) – The issuer

  • static_trust_materials (dict) – The static trust materials

  • force_update (bool) – If the public keys should be updated even if they are already present in the cache

Returns:

The public keys

Return type:

list[dict]

has_client_id(client_id: str) bool[source]

Check if the trust source has a client id.

Parameters:

issuer (str) – The issuer

Returns:

If the trust source has a client id

Return type:

bool

is_revoked(issuer: str | None = None, force_update: bool = False) bool[source]

Yield if the trust toward the issuer was revoked according to some trust model; This asusmed that the isser exists, is valid, but is not trusted.

Parameters:

issuer (str) – The issuer

Returns:

If the trust toward the issuer was revoked

Return type:

bool

revoke(issuer: str | None = None) None[source]

Revoke the trust toward the issuer according to some trust model.

Parameters:

issuer (str) – The issuer

pyeudiw.trust.exceptions module

exception pyeudiw.trust.exceptions.InvalidAnchor[source]

Bases: Exception

exception pyeudiw.trust.exceptions.InvalidJwkMetadataException[source]

Bases: Exception

exception pyeudiw.trust.exceptions.InvalidTrustType[source]

Bases: Exception

exception pyeudiw.trust.exceptions.MissingProtocolSpecificJwks[source]

Bases: Exception

exception pyeudiw.trust.exceptions.MissingTrustType[source]

Bases: Exception

exception pyeudiw.trust.exceptions.NoCriptographicMaterial[source]

Bases: Exception

exception pyeudiw.trust.exceptions.NoMetadata[source]

Bases: Exception

exception pyeudiw.trust.exceptions.NoTrustChainProvided[source]

Bases: Exception

exception pyeudiw.trust.exceptions.TrustConfigurationError[source]

Bases: Exception

exception pyeudiw.trust.exceptions.UnknownTrustAnchor[source]

Bases: Exception

pyeudiw.trust.interface module

class pyeudiw.trust.interface.TrustEvaluator[source]

Bases: object

TrustEvaluator is an interface that defined the expected behaviour of a class that, as the very core, can: (1) obtain the cryptographic material of an issuer, which might or might not be trusted according to some trust model (2) obtain the meta information about an issuer that is defined according to some trust model

build_metadata_endpoints(base_path: str) list[tuple[str, Callable[[Context, Any], Response]]][source]

Return metadata endpoints for this trust evaluator (e.g. keys, config, policies).

Each item must be a tuple (regex: str, handler: Callable[[Context, Any], Response]) compatible with satosa.backend.BackendModule.register_endpoints.

base_path is the module base path and can be used when building the routes. Return an empty list if there are no endpoints to expose.

get_jwt_header_trust_parameters() dict[source]
get_metadata(issuer: str) dict[source]

yields a dictionary of metadata about an issuer, according to some trust model.

get_policies(issuer: str) dict[source]
get_public_keys(issuer: str) list[dict][source]

yields the public cryptographic material of the issuer

Returns:

a list of jwk(s); note that those key are _not_ necessarely identified by a kid claim

initialize_istance(issuer: str) None[source]

Initialize the cryptographic material of the issuer, according to some trust model.

is_revoked(issuer: str) bool[source]

yield if the trust toward the issuer was revoked according to some trust model; this asusmed that the isser exists, is valid, but is not trusted.

Module contents