-
Notifications
You must be signed in to change notification settings - Fork 1
cx-32 add last login event feed #98
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds CloudTrail-based AWS SSO user last-login event feed functionality. Introduces configuration flag to enable CloudTrail integration, creates CloudTrail client when enabled, and implements paginated event feed for parsing AWS SSO login events from CloudTrail logs. Changes
Sequence Diagram(s)sequenceDiagram
actor Admin
participant Config as Configuration
participant Connector as AWS Connector
participant Setup as SetupClients
participant CloudTrail as CloudTrail Client
participant EventFeed as Event Feed
participant API as CloudTrail API
Admin->>Config: Enable SyncSSOUserLastLogin flag
Config->>Connector: New(ctx, config)
Connector->>Connector: Set syncSSOUserLastLogin from config
Connector->>Setup: SetupClients(ctx)
alt SyncSSOUserLastLogin enabled
Setup->>CloudTrail: Initialize cloudtrail.NewFromConfig()
CloudTrail-->>Setup: Client ready
Setup->>Connector: Store cloudTrailClient
end
Admin->>Connector: EventFeeds(ctx)
alt Flag enabled && Client exists
Connector->>EventFeed: newSSOLoginEventFeed(cloudTrailClient, region)
EventFeed-->>Connector: Return feed
Connector-->>Admin: []EventFeed
else
Connector-->>Admin: nil
end
Admin->>EventFeed: ListEvents(ctx, startAt, pageToken)
EventFeed->>EventFeed: Decode pagination token
EventFeed->>EventFeed: Compute time window
EventFeed->>API: LookupEvents(CloudTrailInput)
API-->>EventFeed: CloudTrail events
EventFeed->>EventFeed: Parse JSON payloads<br/>Filter Federate/Authenticate<br/>Extract user identity
EventFeed-->>Admin: []*v2.Event, StreamState
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
Adds event feed to get the Identity Center Users (sso_user) last login information.
This requires:
NEW PERMISSION
{ "Sid": "EventFeedPermissions", "Effect": "Allow", "Action": [ "cloudtrail:LookupEvents" ], "Resource": "*" },Pre-requisite:
AWS account with CloudTrail setup to log events.
Summary by CodeRabbit
New Features
Dependencies
✏️ Tip: You can customize this high-level summary in your review settings.