Skip to content

Commit

Permalink
Web: Update okta types and add back okta "view status" and row click …
Browse files Browse the repository at this point in the history
…handler (#46261)

* Okta types update

* Revert "Remove okta row click handler (not fully implemented) (#46179)"

This reverts commit 714c174.

* Revert "Remove view status button for okta (not fully implemented) (#46174)"

This reverts commit 54a0293.

* Require exact route and revert primary route link and text for oidc finish dialog
  • Loading branch information
kimlisa committed Sep 13, 2024
1 parent 3870144 commit 2948d22
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 17 deletions.
26 changes: 26 additions & 0 deletions web/packages/teleport/src/Integrations/IntegrationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import React from 'react';
import styled from 'styled-components';
import { useHistory } from 'react-router';
import { Link as InternalRouteLink } from 'react-router-dom';

import { Box, Flex, Image } from 'design';
Expand Down Expand Up @@ -65,11 +66,27 @@ type Props<IntegrationLike> = {
type IntegrationLike = Integration | Plugin | ExternalAuditStorageIntegration;

export function IntegrationList(props: Props<IntegrationLike>) {
const history = useHistory();

function handleRowClick(row: IntegrationLike) {
if (row.kind !== 'okta') return;
history.push(cfg.getIntegrationStatusRoute(row.kind, row.name));
}

function getRowStyle(row: IntegrationLike): React.CSSProperties {
if (row.kind !== 'okta') return;
return { cursor: 'pointer' };
}

return (
<Table
pagination={{ pageSize: 20 }}
isSearchable
data={props.list}
row={{
onClick: handleRowClick,
getStyle: getRowStyle,
}}
columns={[
{
key: 'resourceType',
Expand Down Expand Up @@ -98,6 +115,15 @@ export function IntegrationList(props: Props<IntegrationLike>) {
return (
<Cell align="right">
<MenuButton>
{/* Currently, only okta supports status pages */}
{item.kind === 'okta' && (
<MenuItem
as={InternalRouteLink}
to={cfg.getIntegrationStatusRoute(item.kind, item.name)}
>
View Status
</MenuItem>
)}
<MenuItem onClick={() => props.onDeletePlugin(item)}>
Delete...
</MenuItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,11 @@ export enum PluginOktaSyncStatusCode {
Error = 2,
}

/**
* Contains statistics about the various sub-services in the Okta
* integration
*/
export type PluginStatusOkta = {
orgUrl: string;
accessListSyncEnabled: boolean;
details?: PluginOktaDetails;
};

export type PluginOktaDetails = {
ssoDetails?: OktaSsoDetails;
appGroupSyncDetails?: OktaAppGroupSyncDetails;
usersSyncDetails?: OktaUserSyncDetails;
Expand Down Expand Up @@ -92,7 +90,6 @@ export type OktaAccessListSyncDetails = {
numGroups: number;
appFilters: string[];
groupFilters: string[];
defaultOwners: string[];
/**
* Error contains a textual description of the reason the last synchronization
* failed. Only valid when StatusCode is OKTA_PLUGIN_SYNC_STATUS_CODE_ERROR.
Expand Down
56 changes: 46 additions & 10 deletions web/packages/teleport/src/services/integrations/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,27 @@ import { Node } from '../nodes';
* while "plugin" resource is only supported in enterprise. Plugin
* type exists in OS for easier typing when combining the resources
* into one list.
*
* Generics:
* T is resource type "integration" or "plugin"
* K is the kind of integration (eg: aws-oidc) or plugin (eg: okta)
* SP is the provider-specific spec of integration or plugin
* SD is the provider-specific status containing status details
* - currently only defined for plugin resource
*/
export type Integration<
T extends string = 'integration',
K extends string = IntegrationKind,
S extends Record<string, any> = IntegrationSpecAwsOidc,
SP extends Record<string, any> = IntegrationSpecAwsOidc,
SD extends Record<string, any> = null,
> = {
resourceType: T;
kind: K;
spec?: S;
spec?: SP;
name: string;
details?: string;
statusCode: IntegrationStatusCode;
status?: SD;
};
// IntegrationKind string values should be in sync
// with the backend value for defining the integration
Expand Down Expand Up @@ -118,7 +127,32 @@ export type ExternalAuditStorageIntegration = Integration<
ExternalAuditStorage
>;

export type Plugin<T = any> = Integration<'plugin', PluginKind, T>;
export type Plugin<SP = any, D = any> = Integration<
'plugin',
PluginKind,
SP,
PluginStatus<D>
>;

export type PluginStatus<D = any> = {
/**
* the status code of the plugin
*/
code: IntegrationStatusCode;
/**
* the time the plugin was last run
*/
lastRun: Date;
/**
* the last error message from the plugin
*/
errorMessage: string;
/**
* contains provider-specific status information
*/
details?: D;
};

export type PluginSpec =
| PluginOktaSpec
| PluginSlackSpec
Expand All @@ -143,13 +177,6 @@ export type PluginKind =
| 'jamf'
| 'entra-id';

export type PluginStatus<S = any> = {
name: string;
type: PluginKind;
statusCode: IntegrationStatusCode;
stats?: S;
};

export type PluginOktaSpec = {
// scimBearerToken is the plain text of the bearer token that Okta will use
// to authenticate SCIM requests
Expand All @@ -167,6 +194,15 @@ export type PluginOktaSpec = {
// that were deemed not serious enough to fail the plugin installation, but
// may effect the operation of advanced features like User Sync or SCIM.
error: string;
/**
* is the set of usernames that the integration assigns as
* owners to any Access Lists that it creates
*/
defaultOwners: string[];
/**
* the Okta org's base URL
*/
orgUrl: string;
};

export type PluginSlackSpec = {
Expand Down

0 comments on commit 2948d22

Please sign in to comment.