feat: Add multi-profile support for managing multiple Okta organizations #664
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