Skip to content

Commit

Permalink
Adds detailed Okta status to Plugin Resource (#44431)
Browse files Browse the repository at this point in the history
Once we collect the Okta usage statistics we need a durable place to store
them. This patch adds a `Details` block to the Okta plugin status in order
provide such a location. As an extra bonus, we already know that the plugin
status can be reached from both the running plugin and the UI code making it
easier plumb the data through in a subsequent PR.
  • Loading branch information
tcsc authored Jul 24, 2024
1 parent 35a0fe9 commit c94112b
Show file tree
Hide file tree
Showing 4 changed files with 4,458 additions and 1,979 deletions.
167 changes: 167 additions & 0 deletions api/proto/teleport/legacy/types/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6175,6 +6175,8 @@ message PluginStatusV1 {
// gitlab is the status details for the Gitlab plugin.
PluginGitlabStatusV1 gitlab = 4;
PluginEntraIDStatusV1 entra_id = 5;
// Okta holds status details for the Okta plugin
PluginOktaStatusV1 okta = 7;
}

// last_raw_error variable stores the most recent raw error message received from an API or service.
Expand Down Expand Up @@ -6218,6 +6220,171 @@ enum PluginStatusCode {
SLACK_NOT_IN_CHANNEL = 10;
}

// OktaPluginSyncStatusCode indicates the possible states of an Okta
// synchronization service.
enum OktaPluginSyncStatusCode {
// OKTA_PLUGIN_SYNC_STATUS_CODE_UNSPECIFIED is the status code zero value,
// indicating that the service has not yet reported a status code.
OKTA_PLUGIN_SYNC_STATUS_CODE_UNSPECIFIED = 0;

// OKTA_PLUGIN_SYNC_STATUS_CODE_SUCCESS indicates that the service is running
// without error
OKTA_PLUGIN_SYNC_STATUS_CODE_SUCCESS = 1;

// OKTA_PLUGIN_SYNC_STATUS_CODE_ERROR indicates that the service is currently
// in an error state.
OKTA_PLUGIN_SYNC_STATUS_CODE_ERROR = 2;
}

// PluginOktaStatusV1 contains the details for the running Okta plugin.
message PluginOktaStatusV1 {
// SSODetails are status details relating to SSO.
PluginOktaStatusDetailsSSO sso_details = 1;

// AppGroupSyncDetails are status details relating to synchronizing apps and
// groups from Okta.
PluginOktaStatusDetailsAppGroupSync app_group_sync_details = 2;

// UsersSyncDetails are status details relating to synchronizing users from
// Okta.
PluginOktaStatusDetailsUsersSync users_sync_details = 3;

// ScimDetails are status details relating to SCIM integration with
// Okta.
PluginOktaStatusDetailsSCIM scim_details = 4;

// AccessListSyncDetails are status details relating to synchronizing access
// lists from Okta.
PluginOktaStatusDetailsAccessListsSync access_lists_sync_details = 5;
}

// PluginOktaStatusDetailsSSO are details related to the
// current status of the Okta integration w/r/t SSO.
message PluginOktaStatusDetailsSSO {
// Enabled indicates whether SSO login is enabled.
bool enabled = 1;

// AppId is the unique Okta application ID of the Okta Applicaion used for
// SSO login.
string app_id = 2;

// AppName is the human-readable name of the Okta Applicaion used for SSO.
string app_name = 3;
}

// PluginOktaStatusDetailsAppGroupSync are details related to the
// current status of the Okta integration w/r/t application and group
// sync.
message PluginOktaStatusDetailsAppGroupSync {
// Enabled is whether the users sync is enabled.
bool enabled = 1;

// StatusCode indicates the current state of the App & Group sync service
OktaPluginSyncStatusCode status_code = 2;

// LastSuccessful is the date of the last successful run.
google.protobuf.Timestamp last_successful = 3 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = true,
(gogoproto.jsontag) = "last_successful"
];

// LastFailed is the date of the last failed run.
google.protobuf.Timestamp last_failed = 4 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = true,
(gogoproto.jsontag) = "last_failed"
];

// NumAppsSynced is the total number of apps synchronized.
int32 num_apps_synced = 5;

// NumAppsSynced is the total number of groups synchronized.
int32 num_groups_synced = 6;

// Error contains a textual description of the reason the last synchronization
// failed. Only valid when StatusCode is OKTA_PLUGIN_SYNC_STATUS_CODE_ERROR.
string error = 7;
}

// PluginOktaStatusDetailsUsersSync are details related to the
// current status of the Okta integration w/r/t users sync.
message PluginOktaStatusDetailsUsersSync {
// Enabled is whether the users sync is enabled.
bool enabled = 1;

// StatusCode indicates the current state of the User sync service
OktaPluginSyncStatusCode status_code = 2;

// LastSuccessful is the date of the last successful run.
google.protobuf.Timestamp last_successful = 3 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = true,
(gogoproto.jsontag) = "last_successful"
];

// LastFailed is the date of the last failed run.
google.protobuf.Timestamp last_failed = 4 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = true,
(gogoproto.jsontag) = "last_failed"
];

// NumUsersSynced is the total number of users synchronized.
int32 num_users_synced = 5;

// Error contains a textual description of the reason the last synchronization
// failed. Only valid when StatusCode is OKTA_PLUGIN_SYNC_STATUS_CODE_ERROR.
string error = 6;
}

// PluginOktaStatusDetailsSCIM are details related to the
// current status of the Okta integration w/r/t SCIM.
message PluginOktaStatusDetailsSCIM {
// Enabled is whether SCIM is enabled.
bool enabled = 1;
}

// PluginOktaStatusDetailsAccessListsSync are details related to the
// current status of the Okta integration w/r/t access list sync.
message PluginOktaStatusDetailsAccessListsSync {
// Enabled is whether access lists sync is enabled.
bool enabled = 1;

// StatusCode indicates the current state of the AccessList sync service
OktaPluginSyncStatusCode status_code = 2;

// LastSuccessful is the date of the last successful run.
google.protobuf.Timestamp last_successful = 3 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = true,
(gogoproto.jsontag) = "last_successful"
];

// LastFailed is the date of the last failed run.
google.protobuf.Timestamp last_failed = 4 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = true,
(gogoproto.jsontag) = "last_failed"
];

// AppFilters are the app filters used for the access list sync.
repeated string app_filters = 5;

// NumAppsSynced are the number of applications synchronized as access lists.
int32 num_apps_synced = 6;

// GroupFilters are the group filters used for the access list sync.
repeated string group_filters = 7;

// NumGroupsSynced are the number of groups synchronized as access lists.
int32 num_groups_synced = 8;

// Error contains a textual description of the reason the last synchronization
// failed. Only valid when StatusCode is OKTA_PLUGIN_SYNC_STATUS_CODE_ERROR.
string error = 9;
}

// PluginCredentialsV1 represents "live" credentials
// that are used by the plugin to authenticate to the 3rd party API.
message PluginCredentialsV1 {
Expand Down
1 change: 1 addition & 0 deletions api/types/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ type PluginStatus interface {
GetLastSyncTime() time.Time
GetGitlab() *PluginGitlabStatusV1
GetEntraId() *PluginEntraIDStatusV1
GetOkta() *PluginOktaStatusV1
}

// NewPluginV1 creates a new PluginV1 resource.
Expand Down
Loading

0 comments on commit c94112b

Please sign in to comment.