Google Cloud Storage C++ Client  1.42.0
A C++ Client Library for Google Cloud Storage
Public Member Functions | List of all members
google::cloud::storage::oauth2::AnonymousCredentials Class Reference

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

#include <google/cloud/storage/oauth2/anonymous_credentials.h>

Public Member Functions

 AnonymousCredentials ()=default
 
StatusOr< std::string > AuthorizationHeader () override
 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. More...
 
virtual StatusOr< std::vector< std::uint8_t > > SignBlob (SigningAccount const &service_account, std::string const &string_to_sign) const
 Try to sign string_to_sign using service_account. More...
 
virtual std::string AccountEmail () const
 Return the account's email associated with these credentials, if any. More...
 
virtual std::string KeyId () const
 Return the account's key_id associated with these credentials, if any. More...
 

Detailed Description

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.

Definition at line 37 of file anonymous_credentials.h.

Constructor & Destructor Documentation

◆ AnonymousCredentials()

google::cloud::storage::oauth2::AnonymousCredentials::AnonymousCredentials ( )
default

Member Function Documentation

◆ AccountEmail()

virtual std::string google::cloud::storage::oauth2::Credentials::AccountEmail ( ) const
inlinevirtualinherited

◆ AuthorizationHeader()

StatusOr<std::string> google::cloud::storage::oauth2::AnonymousCredentials::AuthorizationHeader ( )
overridevirtual

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.

Implements google::cloud::storage::oauth2::Credentials.

◆ KeyId()

virtual std::string google::cloud::storage::oauth2::Credentials::KeyId ( ) const
inlinevirtualinherited

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

Reimplemented in google::cloud::storage::oauth2::ServiceAccountCredentials< HttpRequestBuilderType, ClockType >.

Definition at line 70 of file credentials.h.

◆ SignBlob()

virtual StatusOr<std::vector<std::uint8_t> > google::cloud::storage::oauth2::Credentials::SignBlob ( SigningAccount const &  service_account,
std::string const &  string_to_sign 
) const
virtualinherited

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.

Reimplemented in google::cloud::storage::oauth2::ServiceAccountCredentials< HttpRequestBuilderType, ClockType >.