azure-identity
environment_credential.hpp
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // SPDX-License-Identifier: MIT
3 
9 #pragma once
10 
11 #include <azure/core/credentials/credentials.hpp>
12 #include <azure/core/credentials/token_credential_options.hpp>
13 
14 #include <memory>
15 #include <string>
16 #include <vector>
17 
18 namespace Azure { namespace Identity {
23  struct EnvironmentCredentialOptions final : public Core::Credentials::TokenCredentialOptions
24  {
30  std::vector<std::string> AdditionallyAllowedTenants;
31  };
32 
48  class EnvironmentCredential final : public Core::Credentials::TokenCredential {
49  private:
50  std::unique_ptr<TokenCredential> m_credentialImpl;
51 
52  explicit EnvironmentCredential(
53  Core::Credentials::TokenCredentialOptions const& options,
54  std::vector<std::string> const& additionallyAllowedTenants);
55 
56  public:
62  Core::Credentials::TokenCredentialOptions const& options
63  = Core::Credentials::TokenCredentialOptions());
64 
69  explicit EnvironmentCredential(EnvironmentCredentialOptions const& options);
70 
79  Core::Credentials::AccessToken GetToken(
80  Core::Credentials::TokenRequestContext const& tokenRequestContext,
81  Core::Context const& context) const override;
82  };
83 
84 }} // namespace Azure::Identity
Environment Credential initializes an Azure credential, based on the system environment variables bei...
Definition: environment_credential.hpp:48
Core::Credentials::AccessToken GetToken(Core::Credentials::TokenRequestContext const &tokenRequestContext, Core::Context const &context) const override
Gets an authentication token.
Definition: environment_credential.cpp:143
EnvironmentCredential(Core::Credentials::TokenCredentialOptions const &options=Core::Credentials::TokenCredentialOptions())
Constructs an Environment Credential.
Azure SDK abstractions.
Definition: azure_cli_credential.hpp:22
Options for token authentication.
Definition: environment_credential.hpp:24
std::vector< std::string > AdditionallyAllowedTenants
For multi-tenant applications, specifies additional tenants for which the credential may acquire toke...
Definition: environment_credential.hpp:30