-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add check for unset correlation ID when configuring request headers #2435
Merged
Merged
Changes from 2 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
a28a3f7
Add check for empty correlation ID when setting request headers, upda…
rmccahill 046593a
Update changelog
rmccahill 9fe242c
Update empty header test naming
rmccahill 428f2ab
Merge branch 'dev' into robert/empty-correlation-id-fixes
rmccahill f221e24
Update changelog
rmccahill 73f34ff
Merge branch 'dev' into robert/empty-correlation-id-fixes
Yuki-YuXin 2e760ac
Add argument to pass MSAL consumer test
Yuki-YuXin c1d5a3f
Merge branch 'dev' into robert/empty-correlation-id-fixes
Yuki-YuXin b653ea6
Merge branch 'dev' into robert/empty-correlation-id-fixes
Yuki-YuXin e631037
Revert changes to trigger error log
Yuki-YuXin fed453c
getThreadCorrelationId
Yuki-YuXin c731847
getThreadCorrelationId UNSET
Yuki-YuXin 3391582
Inside nativeAuthResponseHandler.getSignInInitiateResultFromHttpRespo…
Yuki-YuXin 5976371
Merge branch 'dev' into robert/empty-correlation-id-fixes
Yuki-YuXin 2685650
Modify the test
Yuki-YuXin d0a2618
Modify the remaining test
Yuki-YuXin abc1279
Modify the remaining test
Yuki-YuXin 4cf05aa
Remove tests related with the request header nativeAuthRequestProvide…
Yuki-YuXin a9f32fe
Put dev version header into this branch
Yuki-YuXin 77d3dd3
Only keep the minor changes
Yuki-YuXin acc8421
Merge branch 'dev' into robert/empty-correlation-id-fixes
Yuki-YuXin b4a923f
Revert "Remove tests related with the request header nativeAuthReques…
Yuki-YuXin c30e22e
"UNSET" -> UUID.randomUUID().toString() in getThreadCorrelationId()
Yuki-YuXin 8181c6f
Revert "Modify the remaining test"
Yuki-YuXin 3c74bb2
Revert "Modify the test"
Yuki-YuXin f0c1be5
Revert "Modify the remaining test"
Yuki-YuXin af209cc
Merge branch 'dev' into robert/empty-correlation-id-fixes
Yuki-YuXin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,7 @@ import com.microsoft.identity.common.java.nativeauth.providers.requests.signup.S | |
import com.microsoft.identity.common.java.nativeauth.providers.requests.signup.SignUpContinueRequest | ||
import com.microsoft.identity.common.java.nativeauth.providers.requests.signup.SignUpStartRequest | ||
import com.microsoft.identity.common.java.platform.Device | ||
import com.microsoft.identity.common.java.util.StringUtil | ||
import java.util.TreeMap | ||
|
||
/** | ||
|
@@ -310,7 +311,11 @@ class NativeAuthRequestProvider(private val config: NativeAuthOAuth2Configuratio | |
//region helpers | ||
private fun getRequestHeaders(correlationId: String): Map<String, String?> { | ||
val headers: MutableMap<String, String?> = TreeMap() | ||
headers[AuthenticationConstants.AAD.CLIENT_REQUEST_ID] = correlationId | ||
|
||
if (correlationId != "UNSET") { | ||
headers[AuthenticationConstants.AAD.CLIENT_REQUEST_ID] = correlationId | ||
} | ||
|
||
Yuki-YuXin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
headers[AuthenticationConstants.SdkPlatformFields.PRODUCT] = DiagnosticContext.INSTANCE.requestContext[AuthenticationConstants.SdkPlatformFields.PRODUCT] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this code change is wrong. And the one on the line below. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have no idea why the changes here. If that's wrong, I will revert it back. |
||
headers[AuthenticationConstants.SdkPlatformFields.VERSION] = Device.getProductVersion() | ||
headers.putAll(Device.getPlatformIdParameters()) | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The string 'UNSET' should be used from a constant file.
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.
Having a look at the rest of the codebase and "UNSET" seems to be used in place instead of being used as a constant value. I'd rather stick with the convention here, given that it's a straightforward name and something that doesn't have a specific meaning or is used outside of the context of the SDK.