azure-identity
Loading...
Searching...
No Matches
azure_pipelines_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
12#include "azure/identity/detail/client_credential_core.hpp"
14
15#include <azure/core/credentials/token_credential_options.hpp>
16#include <azure/core/http/http.hpp>
17#include <azure/core/internal/http/pipeline.hpp>
18
19#include <string>
20#include <vector>
21
22namespace Azure { namespace Identity {
23 namespace _detail {
24 class ClientAssertionCredentialImpl;
25 } // namespace _detail
26
31 struct AzurePipelinesCredentialOptions final : public Core::Credentials::TokenCredentialOptions
32 {
43 std::string AuthorityHost = _detail::DefaultOptionValues::GetAuthorityHost();
44
50 std::vector<std::string> AdditionallyAllowedTenants;
51 };
52
57 class AzurePipelinesCredential final : public Core::Credentials::TokenCredential {
58 private:
59 std::string m_serviceConnectionId;
60 std::string m_systemAccessToken;
61 std::unique_ptr<Azure::Core::Http::_internal::HttpPipeline> m_httpPipeline;
62 std::string m_oidcRequestUrl;
63 std::unique_ptr<_detail::ClientAssertionCredentialImpl> m_clientAssertionCredentialImpl;
64
65 std::string GetAssertion(Core::Context const& context) const;
66 Azure::Core::Http::Request CreateOidcRequestMessage() const;
67 std::string GetOidcTokenResponse(
68 std::unique_ptr<Azure::Core::Http::RawResponse> const& response,
69 std::string responseBody) const;
70
71 public:
85 std::string tenantId,
86 std::string clientId,
87 std::string serviceConnectionId,
88 std::string systemAccessToken,
89 AzurePipelinesCredentialOptions const& options = {});
90
96
105 Core::Credentials::AccessToken GetToken(
106 Core::Credentials::TokenRequestContext const& tokenRequestContext,
107 Core::Context const& context) const override;
108 };
109
110}} // namespace Azure::Identity
Credential which authenticates using an Azure Pipelines service connection.
Definition azure_pipelines_credential.hpp:57
Core::Credentials::AccessToken GetToken(Core::Credentials::TokenRequestContext const &tokenRequestContext, Core::Context const &context) const override
Gets an authentication token.
Definition azure_pipelines_credential.cpp:204
~AzurePipelinesCredential() override
Destructs AzurePipelinesCredential.
Client Assertion Credential and options.
Options for Azure Pipelines credential.
Definition azure_pipelines_credential.hpp:32
std::string AuthorityHost
Authentication authority URL.
Definition azure_pipelines_credential.hpp:43
std::vector< std::string > AdditionallyAllowedTenants
For multi-tenant applications, specifies additional tenants for which the credential may acquire toke...
Definition azure_pipelines_credential.hpp:50
Token cache.