File tree Expand file tree Collapse file tree 7 files changed +226
-41
lines changed
Expand file tree Collapse file tree 7 files changed +226
-41
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2022 Salesforce, Inc.
3+ * All rights reserved.
4+ * SPDX-License-Identifier: BSD-3-Clause
5+ * For full license text, see the LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6+ */
7+
8+ #include " credentials.h"
9+
10+ Credentials::Credentials ()
11+ : m_Type(Type::None)
12+ {
13+ }
14+
15+ Credentials::Credentials (const std::string& username, const std::string& password)
16+ : m_Type(Type::UserNameAndPass)
17+ , m_Username(username)
18+ , m_PasswordOrToken(password)
19+ {
20+ }
21+
22+ Credentials::Credentials (const std::string& token)
23+ : m_Type(Type::Token)
24+ , m_Username()
25+ , m_PasswordOrToken(token)
26+ {
27+ }
28+
29+ Credentials::Type Credentials::GetType () const
30+ {
31+ return m_Type;
32+ }
33+
34+ const std::string& Credentials::GetUsername () const
35+ {
36+ return m_Username;
37+ }
38+
39+ const std::string& Credentials::GetPassword () const
40+ {
41+ return m_PasswordOrToken;
42+ }
43+
44+ const std::string& Credentials::GetToken () const
45+ {
46+ return m_PasswordOrToken;
47+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2022 Salesforce, Inc.
3+ * All rights reserved.
4+ * SPDX-License-Identifier: BSD-3-Clause
5+ * For full license text, see the LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6+ */
7+ #pragma once
8+
9+ #include < string>
10+
11+ class Credentials
12+ {
13+ public:
14+ enum class Type
15+ {
16+ None,
17+ UserNameAndPass,
18+ Token
19+ };
20+
21+ Credentials ();
22+ Credentials (const std::string& username, const std::string& password);
23+ Credentials (const std::string& token);
24+
25+ Type GetType () const ;
26+
27+ const std::string& GetUsername () const ;
28+ const std::string& GetPassword () const ;
29+ const std::string& GetToken () const ;
30+
31+ private:
32+ Type m_Type = Type::None;
33+
34+ const std::string m_Username;
35+ const std::string m_PasswordOrToken;
36+ };
You can’t perform that action at this time.
0 commit comments