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

wip: add JWT as possible AuthorizationMode #319

Closed
wants to merge 1 commit into from

Conversation

ericnorris
Copy link

@ericnorris ericnorris commented Aug 4, 2022

Summary

This is a proof-of-concept PR in order to start a discussion around allowing users to specify pre-signed JWTs in the SDK, with the end goal being for it to be possible to use pre-signed JWTs in the Okta Terraform provider.

I will update this description with a link to the matching PR in the Terraform provider once I have submitted it. See okta/terraform-provider-okta#1237.

As a reminder for context: we'd like to explore using the Okta Terraform provider in an environment where the private key is opaque to us, that is, we have a mechanism for signing JWTs with some private key, but we don't know the actual value of the private key, and so we cannot configure the provider (nor the SDK) with the private key directly.

The change to the SDK is relatively minor; instead of always generating the JWT the code can now optionally use the WithToken configuration option as the JWT. I'm not tied to the exact implementation below, and would be open to a new configuration option, etc.

Type of PR

  • Bug Fix (non-breaking fixes to existing functionality)
  • New Feature (non-breaking changes that add new functionality)
  • Documentation update
  • Test Updates
  • Other (Please describe the type)

Test Information

There are no tests for this as it is a proof-of-concept, but I would absolutely add tests in order to get this merged.

Signoff

  • I have submitted a CLA for this PR
  • Each commit message explains what the commit does
  • I have updated documentation to explain what my PR does
  • My code is covered by tests if required
  • I ran make fmt on my code
  • I did not edit any automatically generated files

This is a proof-of-concept commit to demonstrate adding the ability to
specify a JWT directly rather than either an access token or private
key.

When a JWT is configured, the Okta `RequestExecutor` class can skip the
JWT generation and go straight to exchanging the JWT for an access
token, which it then appends to the request.

This access token can then be cached normally, as it is in the
`PrivateKey` flow.
ericnorris added a commit to etsy/terraform-provider-okta that referenced this pull request Aug 4, 2022
This is a proof-of-concept commit to demonstrate adding the ability to
specify a JWT directly rather than either an access token or private
key.

This depends on okta/okta-sdk-golang#319.
@monde monde self-requested a review August 8, 2022 16:20
@monde
Copy link
Collaborator

monde commented Aug 8, 2022

As the API supports this, the SDK should as well. We need to write some tests around this PR and as well as explanation and usage documentation in the README.

@github-actions
Copy link

github-actions bot commented Sep 6, 2022

This PR has been marked stale because there has been no activity within the last 28 days. To keep this PR active, remove the stale label.

@github-actions github-actions bot added the stale label Sep 6, 2022
@monde monde added no-stalebot and removed stale labels Nov 30, 2022
@duytiennguyen-okta
Copy link
Contributor

This is now supported in v3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants