flytekit
flytekit copied to clipboard
Support API Key Authentication
TL;DR
Adds support for API KEY authentication. Since not all OAuth Providers support API Keys, this implementation is client-side only.
Type
- [ ] Bug Fix
- [X] Feature
- [ ] Plugin
Are all requirements met?
- [X] Code completed
- [X] Smoke tested
- [ ] Unit tests added
- [ ] Code documentation added
- [ ] Any pending items have an associated Issue
Complete description
While API Keys are very prevalent for client side tools/libraries to access services, there aren't good standards around generating, maintaining, rotating, expiring them. This implementation makes use of ClientSecret OAuth2 flow, which is standard, to provide the convenience of API Key auth (a single string w/ minimum settings/knobs).
It assumes an API KEY provided is a base64 encoded json string:
{
"client_id": "abc",
"client_secret": "def"
}
Generating an API Key:
echo '{"client_id":"abc","client_secret":"def"}' | base64
With this change, a simple config file like:
admin:
endpoint: dns:///my-end-point
Is enough to invoke pyflyte like this:
FLYTE_CREDENTIALS_API_KEY=eyJjbGllbnRfaWQiOiJhYmMiLCJjbGllbnRfc2VjcmV0IjoiZGVmIn0K pyflyte run --remote my_wp.py wf
Tracking Issue
https://github.com/flyteorg/flyte/issues/
Follow-up issue
NA
OR
https://github.com/flyteorg/flyte/issues/
Codecov Report
Merging #1569 (9755738) into master (0a1f289) will decrease coverage by
0.11%. The diff coverage is33.33%.
@@ Coverage Diff @@
## master #1569 +/- ##
==========================================
- Coverage 71.27% 71.16% -0.11%
==========================================
Files 334 334
Lines 30502 30557 +55
Branches 5514 5526 +12
==========================================
+ Hits 21739 21747 +8
- Misses 8221 8261 +40
- Partials 542 549 +7
| Impacted Files | Coverage Δ | |
|---|---|---|
| flytekit/configuration/internal.py | 15.38% <0.00%> (-0.84%) |
:arrow_down: |
| flytekit/clients/auth_helper.py | 37.93% <28.57%> (-7.28%) |
:arrow_down: |
| flytekit/configuration/__init__.py | 35.54% <35.13%> (-1.76%) |
:arrow_down: |
| flytekit/clis/sdk_in_container/helpers.py | 84.84% <66.66%> (+0.97%) |
:arrow_up: |
| flytekit/clients/auth/authenticator.py | 52.03% <100.00%> (+0.39%) |
:arrow_up: |