Skip to content
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

quilt3: add credential process #4157

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions api/python/quilt3/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,20 @@
)


def cmd_get_credentials():
# TODO: check that the user is logged in
# TODO: do not refresh credentials if they are still valid?
session._refresh_credentials()
creds = session._load_credentials()
print(json.dumps({

Check warning on line 232 in api/python/quilt3/main.py

View check run for this annotation

Codecov / codecov/patch/informational

api/python/quilt3/main.py#L230-L232

Added lines #L230 - L232 were not covered by tests
"Version": 1,
"AccessKeyId": creds["access_key"],
"SecretAccessKey": creds["secret_key"],
"SessionToken": creds["token"],
"Expiration": creds["expiry_time"],
}))


def create_parser():
parser = argparse.ArgumentParser(allow_abbrev=False)
parser.add_argument(
Expand Down Expand Up @@ -481,6 +495,11 @@
)
push_p.set_defaults(func=cmd_push)

# get-credentials
shorthelp = "Get temporary AWS credentials for the current user" # TODO
get_credentials_p = subparsers.add_parser("get-credentials", description=shorthelp, help=shorthelp, allow_abbrev=False)
get_credentials_p.set_defaults(func=cmd_get_credentials)

return parser


Expand Down
Loading