oauth2_service_token_factory

OAuth2 service token framework for authenticating internal API clients.

This module defines a generic OAuth2ServiceToken base class for retrieving and caching OAuth2 access tokens using client credentials. It also includes a OAuth2ServiceTokenFactory to construct and manage tokens for specific services, such as the Site Capabilities API.

Caching, scope extension, and audience targeting are supported, allowing reuse and fine-grained access control of service tokens.

Module Contents

Classes

OAuth2ServiceTokenFactory

Factory for OAuth2 token retrieval.

class oauth2_service_token_factory.OAuth2ServiceTokenFactory(site_capabilities_client_params=None, data_management_client_params=None, cache=None)

Factory for OAuth2 token retrieval.

logger
async get_data_management_service_token(audience=None, try_use_cache=True, additional_scopes=None, force_renew=False)

Get a service token specifically for the Data Management API.

This constructs a DataManagementServiceToken instance using the configured OAuth2 client and returns a valid access token.

async get_site_capabilities_service_token(audience=None, try_use_cache=True, additional_scopes=None, force_renew=False)

Get a service token specifically for the Site Capabilities API.

This constructs a SiteCapabilitiesServiceToken instance using the configured OAuth2 client and returns a valid access token.