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.1.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: okta_saml-0.0.1.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.3

File hashes

Hashes for okta_saml-0.0.1.tar.gz
Algorithm Hash digest
SHA256 442ab3d7494a662f84a4ced4f95b728fbd74679977a6c047c182e450eeb9bf1d
MD5 7828b19796889afeaed740f9b1068b49
BLAKE2b-256 80e68cc62f0455ce74ed74e353a0b16c187e73f25479e8a359d0a764859846e5

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for okta_saml-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e007802030ef74b0d0cf2b2b31dc3e3684bddfffefc28b828cd8c68064255922
MD5 2cd090e9a211987334ba1a53466e043e
BLAKE2b-256 d23e3f76af150d0aad54a45e7275676348781e8543d55ffbf09f760bc5ab0f3a

See more details on using hashes here.

Supported by

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