Skip to content
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

[v17] UI changes for Identity Center Resource Access Requests #50010

Merged
merged 7 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/web/ui/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type App struct {
Kind string `json:"kind"`
// SubKind is the subkind of the app resource. Used to differentiate different
// flavors of app.
SubKind string `json:"subkind,omitempty"`
SubKind string `json:"subKind,omitempty"`
// Name is the name of the application.
Name string `json:"name"`
// Description is the app description.
Expand Down Expand Up @@ -89,9 +89,9 @@ type IdentityCenterPermissionSet struct {
Name string `json:"name"`
// ARN is the AWS-assigned ARN of the permission set
ARN string `json:"arn"`
// AssignmentID is the assignment resource that will provision an Account
// Assignment for this Permission Set on the enclosing account
AssignmentID string `json:"accountAssignment,omitempty"`
// AssignmentID is the assignment resource ID that will provision an Account
// assignment for this permission set on the enclosing account.
AssignmentID string `json:"assignmentId,omitempty"`
RequiresRequest bool `json:"requiresRequest,omitempty"`
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { Option as BaseOption } from 'shared/components/Select';

export type Option = BaseOption & {
isAdded?: boolean;
kind: 'app' | 'user_group' | 'namespace';
kind: 'app' | 'user_group' | 'namespace' | 'aws_ic_account_assignment';
};

export const CheckableOptionComponent = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ const baseProps: RequestCheckoutWithSliderProps = {
name: 'app-saml',
id: 'app-name',
},
{
kind: 'aws_ic_account_assignment',
name: 'account1',
id: 'admin-on-account1',
},
],
clearAttempt: () => null,
onClose: () => null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,8 @@ function getPrettyResourceKind(kind: RequestableResourceKind): string {
return 'SAML Application';
case 'namespace':
return 'Namespace';
case 'aws_ic_account_assignment':
return 'AWS IAM Identity Center Account Assignment';
default:
kind satisfies never;
return kind;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@ export function getEmptyResourceState(): ResourceMap {
role: {},
saml_idp_service_provider: {},
namespace: {},
aws_ic_account_assignment: {},
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export function getNumAddedResources(addedResources: ResourceMap) {
Object.keys(addedResources.user_group).length +
Object.keys(addedResources.windows_desktop).length +
Object.keys(addedResources.saml_idp_service_provider).length +
Object.keys(addedResources.namespace).length
Object.keys(addedResources.namespace).length +
Object.keys(addedResources.aws_ic_account_assignment).length
);
}
10 changes: 10 additions & 0 deletions web/packages/shared/components/AccessRequests/fixtures/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,16 @@ export const requestSearchPending: AccessRequest = {
friendlyName: 'app-saml',
},
},
{
id: {
kind: 'aws_ic_account_assignment',
name: 'admin-on-account1',
clusterName: 'cluster-name',
},
details: {
friendlyName: 'account1',
},
},
],
};

Expand Down
46 changes: 46 additions & 0 deletions web/packages/teleport/src/Apps/fixtures/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,52 @@ export const apps = [
],
clusterId: 'one',
},
{
name: 'aws-iam-ic-account-1',
uri: 'https://console.aws.amazon.com',
publicAddr: 'console.aws.amazon.com',
subKind: 'aws-ic-account',
labels: [{ name: 'teleport.dev/origin', value: 'aws-identity-center' }],
description: 'This is an AWS IAM Identity Center account',
awsConsole: false,
permissionSets: [
{
name: 'Admin perm set',
arn: 'arn:aws:sso:::permissionSet/Admin',
display: 'Admin',
},
{
name: 'ReadOnly perm set',
arn: 'arn:aws:sso:::permissionSet/ReadOnly',
display: 'ReadOnly',
},
],
clusterId: 'one',
fqdn: 'https://console.aws.amazon.com',
},
{
name: 'aws-iam-ic-account-2',
uri: 'https://console.aws.amazon.com',
publicAddr: 'console.aws.amazon.com',
subKind: 'aws-ic-account',
labels: [{ name: 'teleport.dev/origin', value: 'aws-identity-center' }],
description: 'This is an AWS IAM Identity Center account',
awsConsole: false,
permissionSets: [
{
name: 'Admin perm set',
arn: 'arn:aws:sso:::permissionSet/Admin',
display: 'Admin',
},
{
name: 'ReadOnly perm set',
arn: 'arn:aws:sso:::permissionSet/ReadOnly',
display: 'ReadOnly',
},
],
clusterId: 'one',
fqdn: 'https://console.aws.amazon.com',
},
].map(makeApp);

export const moreApps = [
Expand Down
3 changes: 2 additions & 1 deletion web/packages/teleport/src/services/agents/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ export type ResourceIdKind =
| 'kube_cluster'
| 'user_group'
| 'windows_desktop'
| 'saml_idp_service_provider';
| 'saml_idp_service_provider'
| 'aws_ic_account_assignment';

export type AccessRequestScope =
| 'my_requests'
Expand Down
4 changes: 4 additions & 0 deletions web/packages/teleport/src/services/apps/makeApps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export default function makeApp(json: any): App {
requiresRequest,
integration = '',
samlAppPreset,
subKind,
permissionSets,
} = json;

const canCreateUrl = fqdn && clusterId && publicAddr;
Expand Down Expand Up @@ -69,6 +71,7 @@ export default function makeApp(json: any): App {

return {
kind: 'app',
subKind,
id,
name,
description,
Expand All @@ -89,5 +92,6 @@ export default function makeApp(json: any): App {
samlAppSsoUrl,
requiresRequest,
integration,
permissionSets,
};
}
26 changes: 26 additions & 0 deletions web/packages/teleport/src/services/apps/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,35 @@ export interface App {
// Integration is the integration name that must be used to access this Application.
// Only applicable to AWS App Access.
integration?: string;
/** subKind is subKind of an App. */
subKind?: AppSubKind;
/**
* permissionSets is a list of AWS IAM Identity Center permission sets
* available for this App. The value is only populated if the app SubKind is
* aws_ic_account.
*/
permissionSets?: PermissionSet[];
}

export type UserGroupAndDescription = {
name: string;
description: string;
};

/** AppSubKind defines names of SubKind for App resource. */
export enum AppSubKind {
AwsIcAccount = 'aws_ic_account',
}

/**
* PermissionSet defines an AWS IAM Identity Center permission set that
* is available to an App.
*/
export type PermissionSet = {
/** name is a permission set name */
name: string;
/** arn is a permission set ARN */
arn: string;
/** assignmentId is an account assignment ID. */
assignmentId: string;
};
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ export function AccessRequestCheckout() {
switch (c.kind) {
case 'app':
case 'saml_idp_service_provider':
case 'aws_ic_account_assignment':
resource.Icon = Icon.Application;
break;
case 'node':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ type ResourceKind =
| 'kube_cluster'
| 'saml_idp_service_provider'
| 'namespace'
| 'aws_ic_account_assignment'
>
| 'role';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ type SharedResourceAccessRequestKind =
| 'db'
| 'node'
| 'kube_cluster'
| 'saml_idp_service_provider';
| 'saml_idp_service_provider'
| 'aws_ic_account_assignment';

/**
* Extracts `kind`, `id` and `name` from the resource request.
Expand Down Expand Up @@ -433,6 +434,18 @@ export function toResourceRequest({
},
kind: 'app',
};
case 'aws_ic_account_assignment':
return {
resource: {
uri: routing.getAppUri({
rootClusterId,
leafClusterId,
appId: resourceId,
}),
samlApp: false,
},
kind: 'app',
};
case 'db':
return {
resource: {
Expand Down
Loading