nat.authentication.oauth2.oauth2_auth_code_flow_provider#

Classes#

OAuth2AuthCodeFlowProvider

Base class for authenticating to API services.

Module Contents#

class OAuth2AuthCodeFlowProvider(
config: nat.authentication.oauth2.oauth2_auth_code_flow_provider_config.OAuth2AuthCodeFlowProviderConfig,
)#

Bases: nat.authentication.interfaces.AuthProviderBase[nat.authentication.oauth2.oauth2_auth_code_flow_provider_config.OAuth2AuthCodeFlowProviderConfig]

Base class for authenticating to API services. This class provides an interface for authenticating to API services.

Initialize the AuthProviderBase with the given configuration.

Args:

config (AuthProviderBaseConfig): Configuration items for authentication.

_authenticated_tokens: dict[str, nat.data_models.authentication.AuthResult]#
_context#
async _attempt_token_refresh(
user_id: str,
auth_result: nat.data_models.authentication.AuthResult,
) nat.data_models.authentication.AuthResult | None#
async authenticate(
user_id: str | None = None,
) nat.data_models.authentication.AuthResult#

Perform the authentication process for the client.

This method handles the necessary steps to authenticate the client with the target API service, which may include obtaining tokens, refreshing credentials, or completing multi-step authentication flows.

Raises:

NotImplementedError: Must be implemented by subclasses.