Class AnonymousCredentials (2.21.0)

A Credentials type representing "anonymous" Google OAuth2.0 credentials.

This is only useful in two cases: (a) in testing, where you want to access a test bench without having to worry about authentication or SSL setup, and (b) when accessing publicly readable resources (e.g. a Google Cloud Storage object that is readable by the "allUsers" entity), which requires no authentication or authorization.

Constructors

AnonymousCredentials()

Functions

virtual AuthorizationHeader()

While other Credentials subclasses return a string containing an Authorization HTTP header from this method, this class always returns an empty string as its value.

Returns
TypeDescription
StatusOr< std::string >

virtual SignBlob(SigningAccount const &, std::string const &) const

Try to sign string_to_sign using service_account.

Some Credentials types can locally sign a blob, most often just on behalf of an specific service account. This function returns an error if the credentials cannot sign the blob at all, or if the service account is a mismatch.

Parameters
NameDescription
service_account SigningAccount const &
string_to_sign std::string const &
Returns
TypeDescription
StatusOr< std::vector< std::uint8_t > >

virtual AccountEmail() const

Return the account's email associated with these credentials, if any.

Returns
TypeDescription
std::string

virtual KeyId() const

Return the account's key_id associated with these credentials, if any.

Returns
TypeDescription
std::string