Google Cloud Storage C++ Client 2.13.0
A C++ Client Library for Google Cloud Storage
Loading...
Searching...
No Matches
anonymous_credentials.h
1// Copyright 2018 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_OAUTH2_ANONYMOUS_CREDENTIALS_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_OAUTH2_ANONYMOUS_CREDENTIALS_H
17
18#include "google/cloud/storage/oauth2/credentials.h"
19#include "google/cloud/storage/version.h"
20#include <string>
21
22namespace google {
23namespace cloud {
24namespace storage {
25GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
26namespace oauth2 {
27
28/**
29 * A `Credentials` type representing "anonymous" Google OAuth2.0 credentials.
30 *
31 * This is only useful in two cases: (a) in testing, where you want to access
32 * a test bench without having to worry about authentication or SSL setup, and
33 * (b) when accessing publicly readable resources (e.g. a Google Cloud Storage
34 * object that is readable by the "allUsers" entity), which requires no
35 * authentication or authorization.
36 *
37 * @deprecated Prefer using the unified credentials documented in @ref guac
38 */
39class AnonymousCredentials : public Credentials {
40 public:
41 AnonymousCredentials() = default;
42
43 /**
44 * While other Credentials subclasses return a string containing an
45 * Authorization HTTP header from this method, this class always returns an
46 * empty string as its value.
47 */
48 StatusOr<std::string> AuthorizationHeader() override;
49};
50
51} // namespace oauth2
52GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
53} // namespace storage
54} // namespace cloud
55} // namespace google
56
57#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_OAUTH2_ANONYMOUS_CREDENTIALS_H
A Credentials type representing "anonymous" Google OAuth2.0 credentials.
Definition: anonymous_credentials.h:39
StatusOr< std::string > AuthorizationHeader() override
While other Credentials subclasses return a string containing an Authorization HTTP header from this ...
Interface for OAuth 2.0 credentials used to access Google Cloud services.
Definition: credentials.h:47
Authentication components for Google Cloud Storage.
Definition: anonymous_credentials.h:26
Contains all the Google Cloud Storage C++ client APIs.
Definition: auto_finalize.h:24