MinIO C++ SDK
creds.h
1 // MinIO C++ Library for Amazon S3 Compatible Cloud Storage
2 // Copyright 2022 MinIO, Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef _MINIO_CREDS_H
17 #define _MINIO_CREDS_H
18 
19 #include <string>
20 
21 namespace minio {
22 namespace creds {
27 class Credentials {
28  private:
29  std::string_view access_key_;
30  std::string_view secret_key_;
31  std::string_view session_token_;
32  unsigned int expiration_;
33 
34  public:
35  Credentials(const Credentials& creds);
36  Credentials(std::string_view access_key, std::string_view secret_key,
37  std::string_view session_token = "", unsigned int expiration = 0);
38  std::string AccessKey();
39  std::string SecretKey();
40  std::string SessionToken();
41  bool IsExpired();
42 }; // class Credentials
43 
47 class Provider {
48  public:
49  Provider() {}
50  virtual ~Provider() {}
51  virtual Credentials Fetch() = 0;
52 }; // class Provider
53 
57 class StaticProvider : public Provider {
58  private:
59  Credentials* creds_ = NULL;
60 
61  public:
62  StaticProvider(std::string_view access_key, std::string_view secret_key,
63  std::string_view session_token = "");
64  ~StaticProvider();
65  Credentials Fetch();
66 }; // class StaticProvider
67 } // namespace creds
68 } // namespace minio
69 
70 #endif // #ifndef _MINIO_CREDS_H
Definition: creds.h:27
Definition: creds.h:47
Definition: creds.h:57