feat: Add multi-profile support for managing multiple Okta organizations#664
Open
dan-redcupit wants to merge 1 commit intookta:masterfrom
Open
feat: Add multi-profile support for managing multiple Okta organizations#664dan-redcupit wants to merge 1 commit intookta:masterfrom
dan-redcupit wants to merge 1 commit intookta:masterfrom
Conversation
This feature allows MSPs, MSSPs, and developers to manage credentials for
multiple Okta organizations using named profiles, similar to AWS CLI profiles.
New features:
- `okta login --profile-name <name>` to create/update named profiles
- `okta profiles list` to list all configured profiles
- `okta profiles use <name>` to switch the active profile
- `okta profiles show [name]` to display profile details
- `okta profiles delete <name>` to remove a profile
- `okta --profile <name> <command>` for one-off commands with a specific profile
- `OKTA_CLI_PROFILE` environment variable support
Configuration format:
```yaml
okta:
profiles:
default:
orgUrl: https://dev-123456.okta.com
token: 00abc...
acme-corp:
orgUrl: https://acme.okta.com
token: 00xyz...
activeProfile: default
```
Backward compatibility:
- Automatically migrates legacy single-profile format on first use
- Legacy format continues to be readable without migration
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
a77b038 to
88699e5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds multi-profile support to the Okta CLI, enabling users to manage credentials for multiple Okta organizations using named profiles. This is particularly valuable for:
New Commands
okta login --profile-name <name>- Create or update a named profileokta profiles list- List all configured profiles with active indicatorokta profiles use <name>- Switch the active profileokta profiles show [name]- Display profile details (token masked)okta profiles delete <name>- Remove a profileNew Global Option
okta --profile <name> <command>- Run any command with a specific profile (one-off)OKTA_CLI_PROFILEenvironment variable - Set profile for shell sessionConfiguration Format
Backward Compatibility
okta.client.orgUrl/token) is automatically migrated on first writeExample Usage
Test plan
DefaultProfileConfigurationServiceokta login --profile-nameokta profiles list/use/show/deleteokta --profileflagFiles Changed
New Files
common/.../model/OktaProfile.java- Profile data modelcommon/.../service/ProfileConfigurationService.java- Service interfacecommon/.../service/DefaultProfileConfigurationService.java- Implementationcli/.../commands/profiles/Profiles.java- Parent commandcli/.../commands/profiles/ProfilesList.java- List subcommandcli/.../commands/profiles/ProfilesUse.java- Use subcommandcli/.../commands/profiles/ProfilesShow.java- Show subcommandcli/.../commands/profiles/ProfilesDelete.java- Delete subcommandcommon/.../service/DefaultProfileConfigurationServiceTest.groovy- TestsModified Files
cli/.../Environment.java- Added profile state and activationcli/.../OktaCli.java- Added--profileflag andprofilescommandcli/.../commands/BaseCommand.java- Activate profile before command executioncli/.../commands/Login.java- Support--profile-nameoption🤖 Generated with Claude Code