azure-identity
Loading...
Searching...
No Matches
managed_identity_credential.hpp
Go to the documentation of this file.
1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
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
17namespace Azure { namespace Identity {
18 namespace _detail {
19 class ManagedIdentitySource;
20 }
21
22 // This will move to Azure::Core.
26 class ResourceIdentifier final {
27 std::string m_resourceId;
28
29 public:
35 explicit ResourceIdentifier(std::string const& resourceId) : m_resourceId(resourceId){};
36
42 std::string ToString() const { return m_resourceId; }
43 };
44
52 class ManagedIdentityCredential final : public Core::Credentials::TokenCredential {
53 private:
54 std::unique_ptr<_detail::ManagedIdentitySource> m_managedIdentitySource;
55
56 public:
62
70 std::string const& clientId = std::string(),
71 Azure::Core::Credentials::TokenCredentialOptions const& options
72 = Azure::Core::Credentials::TokenCredentialOptions());
73
82 ResourceIdentifier const& resourceId,
83 Azure::Core::Credentials::TokenCredentialOptions const& options = {});
84
91 Azure::Core::Credentials::TokenCredentialOptions const& options);
92
103 Core::Credentials::AccessToken GetToken(
104 Core::Credentials::TokenRequestContext const& tokenRequestContext,
105 Core::Context const& context) const override;
106 };
107
108}} // namespace Azure::Identity
Attempts authentication using a managed identity that has been assigned to the deployment environment...
Definition managed_identity_credential.hpp:52
Core::Credentials::AccessToken GetToken(Core::Credentials::TokenRequestContext const &tokenRequestContext, Core::Context const &context) const override
Gets an authentication token.
Definition managed_identity_credential.cpp:70
~ManagedIdentityCredential() override
Destructs TokenCredential.
An Azure Resource Manager resource identifier.
Definition managed_identity_credential.hpp:26
std::string ToString() const
The string representation of this resource identifier.
Definition managed_identity_credential.hpp:42
ResourceIdentifier(std::string const &resourceId)
Constructs a resource identifier.
Definition managed_identity_credential.hpp:35