imednet.auth package¶
Authentication helpers.
Submodules¶
imednet.auth.api_key module¶
API Key authentication strategy.
- class imednet.auth.api_key.ApiKeyAuth[source]¶
Bases:
objectAuthentication strategy using API Key and Security Key.
- __init__(api_key, security_key)[source]¶
Initialize the API Key authentication strategy.
- Parameters:
api_key (str) – The iMednet API key.
security_key (str) – The iMednet security key.
- Return type:
None
imednet.auth.credentials module¶
Explicit, in-memory credential capabilities; no persistent storage or renewal.
- class imednet.auth.credentials.CredentialSource[source]¶
Bases:
ProtocolRead a caller-owned credential snapshot; None permits environment fallback.
- get_credentials()[source]¶
Return current credentials without logging or persisting their contents.
- Return type:
Credentials | None
- class imednet.auth.credentials.Credentials[source]¶
Bases:
objectA credential snapshot whose representation never includes secret values.
- api_key: str | None = ...¶
- security_key: str | None = ...¶
- oidc_token: str | None = ...¶
- class imednet.auth.credentials.MemoryCredentialStore[source]¶
Bases:
objectCaller-owned ephemeral store, with explicit overwrite and deletion.
Reads return immutable snapshots. Clearing drops this store’s reference; Python does not guarantee zeroization of strings or revoke existing clients.
- __init__(credentials=None)[source]¶
Initialize a store without reading the environment or touching disk.
- Parameters:
credentials (Credentials | None) –
- Return type:
None
- get_credentials()[source]¶
Return the current immutable snapshot.
- Return type:
Credentials | None
- set_credentials(credentials)[source]¶
Replace the snapshot for future client construction.
- Parameters:
credentials (Credentials) –
- Return type:
None
imednet.auth.oidc module¶
OIDC authentication strategy.
- class imednet.auth.oidc.OIDCAuth[source]¶
Bases:
objectAuthentication strategy using OIDC token.
- __init__(token, *, public_key=None, jwks_url=None, jwks=None, audience=None, algorithms=None, issuer=None, leeway=0.0)[source]¶
Initialize the OIDC authentication strategy.
- Parameters:
token (str) – The OIDC bearer token to use for authentication.
public_key (str | bytes | Any | None) – Optional cryptographic public key or secret for verification.
jwks_url (str | None) – Optional JWKS endpoint URL to fetch verification keys.
jwks (dict[str, Any] | None) – Optional in-memory JWKS dictionary.
audience (str | list[str] | None) – Optional expected audience or list of audiences.
algorithms (list[str] | None) – Optional list of allowed algorithms.
issuer (str | None) – Optional expected issuer.
leeway (float) – Clock skew leeway in seconds for time-based claims.
- Return type:
None
- property claims: dict[str, Any]¶
Return a read-only copy of currently active verified JWT claims.
- get_headers()[source]¶
Return the Authorization header or raise an ImednetError on invalid/expired tokens.
- Return type:
dict[str, str]
imednet.auth.strategy module¶
Authentication strategy protocol.