-
Notifications
You must be signed in to change notification settings - Fork 29
feat(icp4d): Add support for icp4d #17
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
Codecov Report
@@ Coverage Diff @@
## master #17 +/- ##
==========================================
+ Coverage 95.7% 95.75% +0.05%
==========================================
Files 7 9 +2
Lines 396 448 +52
==========================================
+ Hits 379 429 +50
- Misses 17 19 +2
Continue to review full report at Codecov.
|
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.
👍 looks good!
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.
This looks good! I left some comments on things that don't all necessarily need to change but I wanted to at least bring them up for discussion
URL = 'url' | ||
USERNAME = 'username' | ||
PASSWORD = 'password' | ||
IAM_APIKEY = 'iam_apikey' | ||
IAM_URL = 'iam_url' | ||
ICP4D_URL = 'icp4d_url' |
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'm curious about the reasoning behind giving ICP4D it's own URL. If I understand correctly, ICP4D has one URL and the tokens are retrieved from a certain endpoint on the same cluster as the service requests. Therefore, only one URL should needed (unlike IAM, which has a separate service entirely).
Is that correct @mediumTaj? Let me know if I'm missing something or if you have a reason for doing this in Python!
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 url for token exchange looks different from the endpoint for API calls. This was based on the test instance provided:
assistant = AssistantV1(
version='2018-07-10',
username='<username>',
password='<pwd>',
url='https://mycluster.icp:31843/assistant/cfg-default/instances/1559584393/api',
icp4d_url='https://mycluster.icp:31843',
authentication_type='icp4d')
assistant.disable_SSL_verification()
@dpopp07 @mediumTaj please let me know if I understood it wrong
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.
Oh, interesting. I hadn't seen that yet. Still, I wonder if there is a concrete way to parse the base URL from the service URL to use in the token manager. It seems redundant to pass in both of those when the base is the same. What do you think?
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.
My 2 cents... while it might be the case that the service endpoint and icp4d token service share a common part of their respective URLs, what happens when the architecture or configuration changes and that is no longer the case? It's probably best to let the user specify the service endpoint URL separate from the ICP4D token service url.
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 too agree with @padamstx to have a separate url for the two.
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.
Okay, after talking with Phil a bit, I am convinced on accepting two separate URLs. That said, how we specifically handle that might be worth some additional discussion. Let's follow up on this tomorrow
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.
Let's discuss this on the 6/5 standup call and make sure all SDK cores (and generator) are on the same page with this.
self.user_access_token = access_token | ||
self.time_to_live = None | ||
self.expire_time = None | ||
self.verify = None # to enable/ disable SSL verification |
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.
Disabling SSL should actually only be an option in the ICP4D token manager, not both. This is something I changed in the Node PR after initial comments - it was decided not to allow this in the IAM token manager at this point
if 200 <= response.status_code <= 299: | ||
return response.json() | ||
else: | ||
raise ApiException(response.status_code, http_response=response) |
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.
Oh I like how you did this with a shared request-launcher function!
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.
Changes look good, but let's wait until we've settled the URL issue across all the SDK cores prior to merging
URL = 'url' | ||
USERNAME = 'username' | ||
PASSWORD = 'password' | ||
IAM_APIKEY = 'iam_apikey' | ||
IAM_URL = 'iam_url' | ||
ICP4D_URL = 'icp4d_url' |
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.
Let's discuss this on the 6/5 standup call and make sure all SDK cores (and generator) are on the same page with this.
🎉 This PR is included in version 0.5.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Supports icp4d:
icp4d_access_token
,icp4d_url
andauthentication_type
as new params in the constructor of base classdisable_SSL_verification
is propagated to the the JWTTokenManagerICP4DTokenManager
andIAMTokenManager
now inherit fromJWTTokenManager