-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat: record the name of the integration being used to auth requests #10
base: master
Are you sure you want to change the base?
Conversation
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.
Hi Adam,
Thank you for your contribution to this module. If you don't mind, I would ask you to also increase the package version to 1.1.0
this way I can release the code after merging.
Do you think this would be needed for versions before Magento v2.4.4 (actually magento/framework 103.0.4)? In that case we might have to branch the changes from release 0.1.1 and create the 0.2.0
version instead.
$data = explode(',', $requestHeader['data']); | ||
$data = array_map(function($keyValue){ | ||
list($key, $value) = explode('=', $keyValue); | ||
return [ | ||
'key' => $key, | ||
'value' => trim($value, '"') | ||
]; | ||
}, $data); | ||
$data = array_combine( | ||
array_column($data, 'key'), | ||
array_column($data, 'value') | ||
); | ||
$consumerKey = $data['oauth_consumer_key']; |
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.
I would prefer an approach that uses existing methods for parsing the data (and in the end using less code). Do you think something in this direction would produce the same effect?
$data = explode(',', $requestHeader['data']); | |
$data = array_map(function($keyValue){ | |
list($key, $value) = explode('=', $keyValue); | |
return [ | |
'key' => $key, | |
'value' => trim($value, '"') | |
]; | |
}, $data); | |
$data = array_combine( | |
array_column($data, 'key'), | |
array_column($data, 'value') | |
); | |
$consumerKey = $data['oauth_consumer_key']; | |
$consumerKey = array_reduce( | |
explode(',', $requestHeader['data']), | |
function($key, $keyValue) { | |
parse_str($keyValue, $data); | |
return $key ?: (array_key_exists('oauth_consumer_key', $data) ? trim(reset($data), '"') : null); | |
}); |
Hey @vladflonta , Sorry missed your response, I'll try and pick this up this week |
When you have multiple integrations it isn't easy to distinguish requests between them.
This adds the integration name to the log file.