Support token type in bearer auth policy - #7175
Support token type in bearer auth policy#7175ROHIT SINGHAL (rohitsinghal4u) wants to merge 1 commit into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR extends Azure::Core::Credentials::AccessToken with an optional TokenType field and updates BearerTokenAuthenticationPolicy to use that value as the Authorization header scheme (defaulting to Bearer when empty), enabling future PoP/MSI token binding scenarios while keeping existing behavior unchanged by default.
Changes:
- Added
AccessToken::TokenType(empty =>"Bearer"). - Updated
BearerTokenAuthenticationPolicyto emitAuthorization: <TokenType> <Token>when provided. - Added a unit test validating the non-default token type behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| sdk/core/azure-core/inc/azure/core/credentials/credentials.hpp | Adds AccessToken::TokenType to carry an auth scheme/token type for Authorization header construction. |
| sdk/core/azure-core/src/http/bearer_token_authentication_policy.cpp | Uses TokenType (or defaults to Bearer) when setting the authorization header. |
| sdk/core/azure-core/test/ut/bearer_token_authentication_policy_test.cpp | Adds coverage for emitting Authorization with a non-default token type. |
| /** | ||
| * @brief Token type used in the Authorization header. Empty means "Bearer". | ||
| * | ||
| */ | ||
| std::string TokenType; | ||
| }; |
| request.SetHeader( | ||
| "authorization", (token.TokenType.empty() ? "Bearer" : token.TokenType) + " " + token.Token); | ||
| } |
|
Hi ROHIT SINGHAL (@rohitsinghal4u). Thank you for your interest in helping to improve the Azure SDK experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment. Otherwise, we'll close this out in 7 days. |
Adds an optional AccessToken TokenType field and updates BearerTokenAuthenticationPolicy to use it when setting the Authorization header. This is a Core prerequisite for PoP/MSI token binding flows while preserving Bearer as the default.\n\nValidation:\n- Not run locally: no C++ compiler is installed on this machine (cl, g++, clang++ unavailable).\n- CMake and Ninja were installed successfully.