Skip to main content

Utility to obtain saml api jwt from OKTA

Project description

okta-saml - Retrieve Saml-Enabled API credentials from Okta

Authenticates a user against Okta and then uses the resulting SAML assertion to retrieve temporary credentials for saml-enabled APIs.

when the command line is run with desired arguments (described below), upon successful login, the attributes in the SAML assertion will be used obtain a jwt token for the associated API and scope.

Required OKTA Setup

Create a SAML App integration with default settings. Add attributes to the SAML definition for ClientID and ClientSecret, and the desired Scope in the Audience. These should contain the values from the client credential flow application you want to associate with your API's auth server and related Scope. Create scope in your auth server as-needed.

The embed link on your SAML app will be used for the app-link value in your ~/.okta-saml file.

Associate your users/groups in the authserver access policies as-needed - one of those must include the intermediary client credential flow app that your saml attributes refer to.

Disclaimer

Okta is a registered trademark of Okta, Inc. and this tool has no affiliation with or sponsorship by Okta, Inc.

Installation

  • > python3 -m pip install . --upgrade
  • Execute okta-saml --config and follow the steps to configure your Okta profile OR
  • Configure okta-saml via the ~/.okta-saml file with the following parameters:
[default]
base-url = <your_okta_org>.okta.com
app-link = <app_link_from_okta> # Found in Okta's configuration for your SAML Application link.
profile  = <saml_profile_to_store_credentials> # Sets your temporary credentials to a profile in `.saml/credentials`. Overridden by `--profile` command line flag

## The remaining parameters are optional.
## You may be prompted for them, if they're not included here.
username = <your_okta_username>
password = <your_okta_password> # Only save your password if you know what you are doing!

Usage

okta-saml --profile <saml_profile>

  • Subsequent executions will first check if the credentials are still valid and skip Okta authentication if so.
  • Multiple Okta profiles are supported, but if none are specified, then default will be used.
  • Selections for saml api are saved to the ~/.okta-saml file.

Example

okta-saml --profile default

Optional flags:

  • --profile or -p Sets your temporary credentials to a profile in .saml/credentials. If omitted and not configured in ~/.okta-saml, credentials will output to console.
  • --username or -U Okta username.
  • --password or -P Okta password.
  • --force or -f Ignores result of JWT expiration check and gets new credentials from OKTA. Used in conjunction with --profile.
  • --verbose or -v More verbose output.
  • --debug or -d Very verbose output. Useful for debugging.
  • --cache or -c Cache the acquired credentials to ~/.okta-credentials.cache (only if --profile is unspecified)
  • --okta-profile or -o Use a Okta profile, other than default in .okta-saml. Useful for multiple Okta tenants.
  • --config Add/Create new Okta profile configuration.
  • --version or -V Outputs version number then exits.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

okta_saml-0.0.2.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

okta_saml-0.0.2-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file okta_saml-0.0.2.tar.gz.

File metadata

  • Download URL: okta_saml-0.0.2.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for okta_saml-0.0.2.tar.gz
Algorithm Hash digest
SHA256 4528574c4a0dd1c6affd4757706038f15b70d3b19ddfde5a4a637be735366324
MD5 4d1e8169bf02f8cee6f3e5f466f49706
BLAKE2b-256 00dc688187d22dbe6af7eea5aa5ccfe2fca1b566324715c526d0530148e49ff0

See more details on using hashes here.

File details

Details for the file okta_saml-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: okta_saml-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for okta_saml-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f89c2d981afdf1faaa1e5bb08a8acbe5fffd0551607fa77b6f465177fdc4f44b
MD5 b7cea942221ee3392a17c647808bca20
BLAKE2b-256 c10ee9764a1d7faef45cb22b48cb561442eef143fac6d915cb1ffc9e05bdb635

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page