-
Notifications
You must be signed in to change notification settings - Fork 28
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
Support AUTH_TYPE_CERT_PEM and AUTH_TYPE_NONE #305
Conversation
Signed-off-by: pem70 <[email protected]>
Signed-off-by: pem70 <[email protected]>
Signed-off-by: pem70 <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #305 +/- ##
==========================================
+ Coverage 89.82% 89.90% +0.07%
==========================================
Files 53 53
Lines 2694 2713 +19
==========================================
+ Hits 2420 2439 +19
Misses 274 274
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
TL;DR: Changes LGTM! 😋
After testing the AUTH_TYPE_NONE, I'm wondering if we should update the sample SDK. I was able to use some of that code to test this functionality and it works! 🥳
from zowe.core_for_zowe_sdk.sdk_api import SdkApi
sample = SdkApi({"host": "jsonplaceholder.typicode.com"}, "/")
custom_args = sample._create_custom_request_arguments()
custom_args["json"] = {"title": "foo", "body": "bar", "userId": 10}
custom_args["url"] = f"{sample._request_endpoint}/posts"
response_json = sample.request_handler.perform_request("POST", custom_args, expected_code=[201])
print(response_json)
Tested with a local instance of the APIML (using this instructions) and...
I can't seems to be able to use certificates as a valid authentication mechanism.
😢
While trying to resolve this, I found a few other places where we may need to make changes in order to pass certs properly to the requests.Session()
object.
And keep in mind that we would also want to make sure not to validate certs if rejectUnauthorized is False. 😋
Here are some pointers that may help in resolving the certificate support issue:
- The sdk_api needs to handle the authType
cert-pem
(same as with the other auth types) - The format of how certs should be passed is kind of specific (tuple instead of multiple params)
- See
requests#sessions.py#request()
for more details:param cert: (optional) if String, path to ssl client cert file (.pem).
If Tuple, ('cert', 'key') pair.
- See
Signed-off-by: pem70 <[email protected]>
Signed-off-by: pem70 <[email protected]>
Signed-off-by: pem70 <[email protected]>
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.
Left a small comment, but otherwise, the functionality LGTM! 😋
Co-authored-by: Fernando Rijo Cedeno <[email protected]> Signed-off-by: Peizhao Mei <[email protected]>
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! 😋
What It Does
Supports for
AUTH_TYPE_CERT_PEM
andAUTH_TYPE_NONE
insession
addressed in [#291] and [#296]How to Test
Review Checklist
I certify that I have:
Additional Comments