Known subclasses: nebius.aio.authorization.token.TokenProvider, nebius.aio.channel._RuntimeAuthorizationProvider
Factory abstraction that supplies an Authenticator.
Typical usage within the request lifecycle
Give a provider to the request constructor. Before it sends an RPC, the
request layer calls authenticator to get an
Authenticator.
The authenticator authorizes one request. It adds the required headers to
nebius.base.metadata.Metadata. After an authentication failure,
the request layer calls Authenticator.can_retry. If permitted, it
retries with the same authenticator.
The built-in channel calls the provider and its authenticators on one SDK event loop. Treat a stateful provider as owned by one SDK. Do not attach one instance to SDKs with different loops unless the implementation is thread-safe, loop-neutral, and explicitly supports concurrent use.
Example
Give a provider to the SDK through the credentials parameter:
from nebius.sdk import SDK
from nebius.aio.authorization import Authenticator, Provider
class MyAuthenticator(Authenticator):
async def authenticate(self, metadata, timeout=None, options=None):
metadata.add("Authorization", "Bearer my-static-token")
class MyProvider(Provider):
def authenticator(self):
return MyAuthenticator()
provider = MyProvider()
sdk = SDK(
credentials=provider,
user_agent_prefix="example-application/1.0",
)
| Method | authenticator |
Return a fresh per-request Authenticator instance. |
nebius.aio.authorization.token.TokenProvider, nebius.aio.channel._RuntimeAuthorizationProviderReturn a fresh per-request Authenticator instance.
| Returns | |
Authenticator | An authenticator instance. |