-
Notifications
You must be signed in to change notification settings - Fork 235
Add Support for Custom Saml Bearer in HttpRequest Headers #3273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…aml bearer headers are supported
@microsoft-github-policy-service agree company="Microsoft" |
Couple of questions:
|
This is the error when using Add() instead of TryAddWithoutValidation()
if(authorizationHeader.StartsWith("https://schemas.microsoft.com/saml-bearer"))
{
httpRequestMessage.Headers.TryAddWithoutValidation(Authorization, authorizationHeader);
}
else
{
httpRequestMessage.Headers.Add(Authorization, authorizationHeader)
} or try
{
httpRequestMessage.Headers.Add(Authorization, authorizationHeader)
}
catch(FormatException)
{
httpRequestMessage.Headers.TryAddWithoutValidation(Authorization, authorizationHeader);
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @sthanu98
Add Support for Saml Authorization Scheme in HttpRequest Headers
Summary of the changes (Less than 80 chars)
Description
This PR introduces a change to the way authorization headers are added to HTTP requests, specifically to support SAML tokens. The change ensures that custom SAML authorization schemes are correctly added using TryAddWithoutValidation. This approach allows for more flexible handling of SAML tokens, even when they might not pass standard validation.
Changes:
Replaced the below line to improve compatibility with custom SAML authorization schemes.
with
Added unit tests to validate the new behavior and ensure headers are correctly added in various scenarios.
Fixes #3269