Nike-Inc / gimme-aws-creds

A CLI that utilizes Okta IdP via SAML to acquire temporary AWS credentials
Apache License 2.0
920 stars 262 forks source link

Support for Okta Identity Engine #392

Closed epierce closed 1 year ago

epierce commented 1 year ago

Description

This change adds support Okta Identity Engine domains. Since OIE has much more complicated login policies and has dropped support for the sessionToken parameter when requesting a SAML response, we have to use the device authorization flow and request a Web SSO token to exchange for the SAML response. This login flow mirrors the one used by okta-aws-cli. The main difference from okta-aws-cli's implementation is that I stuck with using the OKTA_API_KEY environment variable instead of using the okta.apps.read scope to access the Apps API. The client calls a metadata endpoint on the target Okta domain and determines if it is a classic or OIE domain and selects the correct login flow, so no changes to the config file are needed.

In addition, I also added an expiration time (x_security_token_expires) to the AWS credentials file to match the existing feature in saml2aws.

Finally, I updated the tests to use pytest since nose does not support Python 3.10+ and dropped support for Python 3.6 since there were incompatibilities with some of the libraries we use.

Please note: This change does not support non-interactive logins, which not currently possible with OIE. Once Okta has a solution for non-interactive logins, support for that will be added.

Related Issue

345

365

329

Motivation and Context

OIE support in gimme-aws-creds is a requirement before we can migrate to OIE.

How Has This Been Tested?

Tested against an OIE and classic domains. All existing functionality on the classic domain is still working.

Screenshots (if appropriate):

N/A

Types of changes

Checklist: