gravitino.auth.oauth2_token_provider.OAuth2TokenProvider

class gravitino.auth.oauth2_token_provider.OAuth2TokenProvider(uri: str)

Bases: AuthDataProvider

OAuth2TokenProvider will request the access token from the authorization server and then provide the access token for every request.

__init__(uri: str)

Methods

__init__(uri)

close()

Closes the OAuth2TokenProvider and releases any underlying resources.

get_token_data()

Acquire the data of token for authentication.

has_token_data()

Judge whether AuthDataProvider can provide token data.

validate()

Validate the OAuth2TokenProvider

close()

Closes the OAuth2TokenProvider and releases any underlying resources.

get_token_data() bytes | None

Acquire the data of token for authentication. The client will set the token data as HTTP header Authorization directly. So the return value should ensure token data contain the token header (eg: Bearer, Basic) if necessary.

Returns:

the token data is used for authentication.

has_token_data() bool

Judge whether AuthDataProvider can provide token data.

Returns:

true if the AuthDataProvider can provide token data otherwise false.

abstract validate()

Validate the OAuth2TokenProvider