azure-identity
Loading...
Searching...
No Matches
client_secret_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/identity/detail/client_credential_core.hpp"
13
14#include <azure/core/credentials/credentials.hpp>
15#include <azure/core/credentials/token_credential_options.hpp>
16#include <azure/core/url.hpp>
17
18#include <memory>
19#include <string>
20#include <vector>
21
22namespace Azure { namespace Identity {
23 namespace _detail {
24 class TokenCredentialImpl;
25 } // namespace _detail
26
31 struct ClientSecretCredentialOptions final : public Core::Credentials::TokenCredentialOptions
32 {
43 std::string AuthorityHost = _detail::DefaultOptionValues::GetAuthorityHost();
44
50 std::vector<std::string> AdditionallyAllowedTenants;
51 };
52
58 class ClientSecretCredential final : public Core::Credentials::TokenCredential {
59 private:
60 _detail::TokenCache m_tokenCache;
61 _detail::ClientCredentialCore m_clientCredentialCore;
62 std::unique_ptr<_detail::TokenCredentialImpl> m_tokenCredentialImpl;
63 std::string m_requestBody;
64
66 std::string tenantId,
67 std::string const& clientId,
68 std::string const& clientSecret,
69 std::string const& authorityHost,
70 std::vector<std::string> additionallyAllowedTenants,
71 Core::Credentials::TokenCredentialOptions const& options);
72
73 public:
83 std::string tenantId,
84 std::string const& clientId,
85 std::string const& clientSecret,
86 ClientSecretCredentialOptions const& options);
87
97 std::string tenantId,
98 std::string const& clientId,
99 std::string const& clientSecret,
100 Core::Credentials::TokenCredentialOptions const& options
101 = Core::Credentials::TokenCredentialOptions());
102
108
119 Core::Credentials::AccessToken GetToken(
120 Core::Credentials::TokenRequestContext const& tokenRequestContext,
121 Core::Context const& context) const override;
122 };
123
124}} // namespace Azure::Identity
Client Secret Credential authenticates with the Azure services using a Tenant ID, Client ID and a cli...
Definition client_secret_credential.hpp:58
~ClientSecretCredential() override
Destructs ClientSecretCredential.
Core::Credentials::AccessToken GetToken(Core::Credentials::TokenRequestContext const &tokenRequestContext, Core::Context const &context) const override
Gets an authentication token.
Definition client_secret_credential.cpp:68
Options for token authentication.
Definition client_secret_credential.hpp:32
std::vector< std::string > AdditionallyAllowedTenants
For multi-tenant applications, specifies additional tenants for which the credential may acquire toke...
Definition client_secret_credential.hpp:50
std::string AuthorityHost
Authentication authority URL.
Definition client_secret_credential.hpp:43
Token cache.