-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Low-Code: added SessionTokenAuthenticator #19716
Low-Code: added SessionTokenAuthenticator #19716
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.
@@ -115,3 +119,103 @@ def token(self) -> str: | |||
auth_string = f"{self._username.eval(self.config)}:{self._password.eval(self.config)}".encode("utf8") | |||
b64_encoded = base64.b64encode(auth_string).decode("utf8") | |||
return f"Basic {b64_encoded}" | |||
|
|||
|
|||
cacheSessionTokenAuthenticator = TTLCache(maxsize=1000, ttl=86400) |
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.
can you add a comment on how those values were chosen for posterity? Is it worth parameterizing them?
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.
done
@darynaishchenko please run format on the files before merging because some files are not properly formatted |
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.
small adjustment on the version since its a new component feature, but otherwise looks good to me!
airbyte-cdk/python/CHANGELOG.md
Outdated
@@ -1,5 +1,8 @@ | |||
# Changelog | |||
|
|||
## 0.9.6 |
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.
Given that this is a net new feature, we should bump the minor version to 0.10.0
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.
done
@girarda @brianjlai could you help me with it please. I'm doing this steps from README
But I get type checks errors in files which I didn't change. Is this ok, or I do something wrong? |
73f318a
to
6505267
Compare
@darynaishchenko what are the type check errors you're seeing? |
done |
It's not relevant, I fixed checks. thanks |
if response.ok: | ||
json_response = response.json() | ||
self.logger.info( | ||
f"Connection check for source successful for {json_response['common_name']} login at {json_response['last_login']}" |
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.
These two fields need to be configurable because the endpoints won't always return responses with "common_name" and "last_login" fields
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.
alternatively, it would be fine not to log this much details here
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.
done
username = self._username.eval(self.config) | ||
password = self._password.eval(self.config) | ||
session_token_response_key = self._session_token_response_key.eval(self.config) | ||
api_url = f"{self._api_url.eval(self.config)}session" |
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 path will need to be configurable. This could be done by adding a field "login_url", which could be configured as
"session"
in the case of metabase
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.
done
def is_valid_session_token(self) -> bool: | ||
try: | ||
response = requests.get( | ||
f"{self._api_url.eval(self.config)}user/current", headers={self.auth_header: self._session_token.eval(self.config)} |
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 path will need to be configurable. This could be done by adding a field "validate_session_url", which could be configured as
"/user/current"
in the case of metabase
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.
done
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.
It seems like the stylesheet changes are purely about whitespace, could you revert them?
081815e
to
6713da8
Compare
thanks, fixed |
101302b
to
a4346c6
Compare
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 is great!
/publish-cdk dry-run=false
|
This auth method will be used in source-metabase #19236