feat: staged account creation and profile attribute support#145
feat: staged account creation and profile attribute support#145c1-dev-bot[bot] wants to merge 3 commits into
Conversation
Add support for creating Okta users in STAGED status (not immediately activated) via a new `create_in_staged_status` field in the account creation schema. Staged users can be activated later through Okta workflows or API calls. Also add support for populating common Okta profile attributes during account creation: department, title, display_name, user_type, organization, manager_id, cost_center, division, and employee_number. Fixes: CE-519
|
Claude finished @c1-dev-bot[bot]'s task in 1m 25s —— View job PR Review: Staged Account Creation & Profile Attributes
Overall AssessmentThis is a well-structured PR that adds two useful features cleanly. The Issues1. Staged creation bypasses credential handling — is this intentional?
This is likely fine for staged users (they aren't activated yet, so login params don't apply), but it should be explicitly documented in the code comment or the schema description, since someone might set both Suggestion: Add a note to the 2.
|
|
Claude finished @c1-dev-bot[bot]'s task in 2m 0s —— View job PR Review: Staged Account Creation & Profile Attributes
Blocking Issues: 0 | Suggestions: 2 Security IssuesNone found. Correctness IssuesNone found. Suggestions
Notes
Overall this is a clean, well-structured PR. The |
| for schemaField, oktaField := range optionalProfileFields { | ||
| if val, ok := pMap[schemaField]; ok { | ||
| if strVal, isStr := val.(string); isStr && strVal != "" { | ||
| (*profile)[oktaField] = strVal |
There was a problem hiding this comment.
🟡 Suggestion: okta.UserProfile is a map type (map[string]interface{}), so the pointer dereference is unnecessary when indexing. You can simplify this to profile[oktaField] = strVal.
| (*profile)[oktaField] = strVal | |
| profile[oktaField] = strVal |
| func parseBoolField(pMap map[string]interface{}, fieldName string) (bool, error) { | ||
| val := pMap[fieldName] | ||
| switch v := val.(type) { | ||
| case bool: | ||
| requirePasswordChanged = v | ||
| return v, nil | ||
| case string: | ||
| parsed, err := strconv.ParseBool(v) | ||
| if err != nil { | ||
| return nil, err | ||
| return false, err | ||
| } | ||
| requirePasswordChanged = parsed | ||
| return parsed, nil | ||
| case nil: | ||
| // Do nothing | ||
| return false, nil | ||
| default: | ||
| return false, fmt.Errorf("okta-connectorv2: unsupported type for %s: %T", fieldName, val) | ||
| } | ||
| } |
There was a problem hiding this comment.
🟡 Suggestion: The parseBoolField refactor adds a default error case that didn't exist in the original inline switch (which silently treated unexpected types as false). This is a good improvement — explicitly erroring on unexpected types is safer than silent fallthrough. Just noting this is a minor behavioral change from the previous code.
|
Claude finished @c1-dev-bot[bot]'s task in 1m 31s —— View job PR Review: Staged Account Creation & Profile Attributes
Blocking Issues: 0 | Non-blocking: 3 CorrectnessThe implementation is clean and correct. Both features (staged creation and optional profile attributes) are well-structured and backward-compatible. No security or correctness issues found. Findings1. Previous review suggestion to simplify
|
Summary
create_in_staged_statusfield to account creation schema, allowing users to be created in Okta's STAGED status instead of being immediately activated. Staged users can be activated later via Okta workflows or API calls.department,title,display_name,user_type,organization,manager_id,cost_center,division, andemployee_number.parseBoolFieldhelper for cleaner code.Details
Staged Account Creation
When
create_in_staged_statusis set totrue, the Okta CreateUser API is called withactivate=false, which creates the user in STAGED status. This is useful for onboarding workflows where user activation is controlled by separate Okta workflows or happens at a scheduled time.Profile Attributes
The following optional Okta profile attributes can now be set during account creation:
departmentdepartmenttitletitledisplay_namedisplayNameuser_typeuserTypeorganizationorganizationmanager_idmanagerIdcost_centercostCenterdivisiondivisionemployee_numberemployeeNumberTest Plan
go build ./...passesgo test ./...passescreate_in_staged_status=trueand verify STAGED status in OktaFixes: CE-519
Automated PR Notice
This PR was automatically created by c1-dev-bot as a potential implementation.
This code requires: