Documentation
¶
Overview ¶
Package okta provides Okta API client and group synchronization to GitHub teams. Uses OAuth 2.0 with private key authentication.
Index ¶
- Variables
- func FilterEnabledGroups(groups []okta.Group, enabledNames []string) []okta.Group
- type Client
- func (c *Client) GetAPIClient() *okta.APIClient
- func (c *Client) GetContext() context.Context
- func (c *Client) GetGroupByName(name string) (*okta.Group, error)
- func (c *Client) GetGroupInfo(groupName string) (*GroupInfo, error)
- func (c *Client) GetGroupMembers(groupID string) (*GroupMembersResult, error)
- func (c *Client) GetGroupsByPattern(pattern string) ([]*GroupInfo, error)
- func (c *Client) ListGroups() ([]okta.Group, error)
- type ClientConfig
- type GroupInfo
- type GroupMembersResult
- type OrphanedUsersReport
- type SyncReport
- type SyncResult
- type SyncRule
- type Syncer
Constants ¶
This section is empty.
Variables ¶
var DefaultScopes = []string{"okta.groups.read", "okta.users.read"}
DefaultScopes defines the required OAuth scopes for the Okta API. these scopes are necessary for group sync functionality.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the Okta SDK client with custom configuration.
func NewClient ¶
func NewClient(cfg *ClientConfig) (*Client, error)
NewClient creates an Okta client with background context.
func NewClientWithContext ¶
func NewClientWithContext(ctx context.Context, cfg *ClientConfig) (*Client, error)
NewClientWithContext creates an Okta client with OAuth 2.0 private key authentication. supports custom TLS certificate pools via context for testing.
func (*Client) GetAPIClient ¶ added in v0.18.0
GetAPIClient returns the underlying Okta SDK API client.
func (*Client) GetContext ¶
GetContext returns the context used for API requests.
func (*Client) GetGroupByName ¶
GetGroupByName searches for an Okta group by exact name match.
func (*Client) GetGroupInfo ¶
GetGroupInfo fetches details for a single Okta group by name.
func (*Client) GetGroupMembers ¶
func (c *Client) GetGroupMembers(groupID string) (*GroupMembersResult, error)
GetGroupMembers fetches GitHub usernames for all active members of an Okta group. only includes users with status "ACTIVE" to exclude suspended/deprovisioned users. skips users without a GitHub username in their profile and tracks them separately.
func (*Client) GetGroupsByPattern ¶
GetGroupsByPattern fetches all Okta groups matching a regex pattern.
type ClientConfig ¶
type ClientConfig struct {
Domain string
ClientID string
PrivateKey []byte
PrivateKeyID string
Scopes []string
GitHubUserField string
BaseURL string
}
ClientConfig contains Okta client configuration.
type GroupMembersResult ¶ added in v0.6.0
GroupMembersResult contains the results of fetching group members.
type OrphanedUsersReport ¶
type OrphanedUsersReport struct {
OrphanedUsers []string
}
OrphanedUsersReport contains users who are org members but not in any synced teams.
type SyncReport ¶
type SyncReport struct {
Rule string
OktaGroup string
GitHubTeam string
MembersAdded []string
MembersRemoved []string
MembersSkippedExternal []string
MembersSkippedNoGHUsername []string
Errors []string
}
SyncReport contains the results of syncing a single Okta group to GitHub team.
func (*SyncReport) HasChanges ¶
func (r *SyncReport) HasChanges() bool
HasChanges returns true if members were added or removed.
func (*SyncReport) HasErrors ¶
func (r *SyncReport) HasErrors() bool
HasErrors returns true if any errors occurred during sync.
type SyncResult ¶
type SyncResult struct {
Reports []*SyncReport
OrphanedUsers *OrphanedUsersReport
}
SyncResult contains all sync reports and orphaned users report.
type Syncer ¶
type Syncer struct {
// contains filtered or unexported fields
}
Syncer coordinates synchronization of Okta groups to GitHub teams.
func NewSyncer ¶
func NewSyncer(oktaClient *Client, githubClient *client.Client, rules []SyncRule, safetyThreshold float64, logger *slog.Logger) *Syncer
NewSyncer creates a new Okta to GitHub syncer.
func (*Syncer) DetectOrphanedUsers ¶
func (s *Syncer) DetectOrphanedUsers(ctx context.Context, syncedTeams []string) (*OrphanedUsersReport, error)
DetectOrphanedUsers finds organization members not in any synced teams. excludes external collaborators.