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

PROD-2366 - Admin UI for Managing OpenID Providers #5134

Merged
merged 68 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
e313b41
PROD-2366 - Admin UI for Managing OpenID Providers
andres-torres-marroquin Jul 29, 2024
c3904f9
qA
andres-torres-marroquin Jul 29, 2024
60be32a
qA
andres-torres-marroquin Jul 29, 2024
e12a8c2
qA
andres-torres-marroquin Jul 29, 2024
2ef3661
Merge branch 'main' into PROD-2366
andres-torres-marroquin Jul 30, 2024
288913e
Add OpenIDProvider table
andres-torres-marroquin Jul 30, 2024
69711fc
PROD-2366 - Admin UI for Managing OpenID Providers
andres-torres-marroquin Jul 30, 2024
5abacbc
QA
andres-torres-marroquin Jul 30, 2024
48bdc9b
Merge branch 'main' into PROD-2366
andres-torres-marroquin Jul 30, 2024
581bd7b
QA
andres-torres-marroquin Jul 30, 2024
ba71a81
QA
andres-torres-marroquin Jul 30, 2024
6933916
QA
andres-torres-marroquin Jul 30, 2024
0cd45c8
QA
andres-torres-marroquin Jul 30, 2024
9fa5a11
QA
andres-torres-marroquin Jul 31, 2024
23c7e97
QA
andres-torres-marroquin Jul 31, 2024
40ffeaa
Merge branch 'main' into PROD-2366
andres-torres-marroquin Jul 31, 2024
1373f6a
QA
andres-torres-marroquin Jul 31, 2024
a306219
Merge branch 'main' into PROD-2366
andres-torres-marroquin Jul 31, 2024
e1d1125
QA
andres-torres-marroquin Jul 31, 2024
cc38853
QA
andres-torres-marroquin Jul 31, 2024
049897b
Merge branch 'main' into PROD-2366
andres-torres-marroquin Jul 31, 2024
1d53cf7
Merge branch 'main' into PROD-2366
andres-torres-marroquin Jul 31, 2024
085df3f
QA
andres-torres-marroquin Jul 31, 2024
8dfc7d6
Merge branch 'main' into PROD-2366
andres-torres-marroquin Jul 31, 2024
675c6d3
Merge branch 'main' into PROD-2366
andres-torres-marroquin Jul 31, 2024
c714fee
Merge branch 'main' into PROD-2366
andres-torres-marroquin Aug 1, 2024
f5985e4
Adding login with google
andres-torres-marroquin Aug 1, 2024
abdaf7a
Adding login with google
andres-torres-marroquin Aug 1, 2024
107c70e
Adding login with google
andres-torres-marroquin Aug 1, 2024
a3202ee
QA
andres-torres-marroquin Aug 2, 2024
8fbcf33
QA
andres-torres-marroquin Aug 2, 2024
ebe72e5
QA
andres-torres-marroquin Aug 2, 2024
fe157b4
QA
andres-torres-marroquin Aug 2, 2024
2ad8f90
QA
andres-torres-marroquin Aug 2, 2024
eaea803
QA
andres-torres-marroquin Aug 5, 2024
80d1bdb
QA
andres-torres-marroquin Aug 5, 2024
999821a
QA
andres-torres-marroquin Aug 5, 2024
912005f
QA
andres-torres-marroquin Aug 5, 2024
b6caff6
QA
andres-torres-marroquin Aug 5, 2024
2d657f4
QA
andres-torres-marroquin Aug 5, 2024
72270c1
QA
andres-torres-marroquin Aug 6, 2024
77f7f07
QA
andres-torres-marroquin Aug 6, 2024
90eb553
QA
andres-torres-marroquin Aug 6, 2024
81d6918
QA
andres-torres-marroquin Aug 6, 2024
c355904
QA
andres-torres-marroquin Aug 6, 2024
c05ee92
Refactor
andres-torres-marroquin Aug 7, 2024
e58ea48
QA
andres-torres-marroquin Aug 7, 2024
0352cd5
Merge branch 'main' into PROD-2366
andres-torres-marroquin Aug 7, 2024
98bb6cb
QA
andres-torres-marroquin Aug 7, 2024
6b0170b
QA
andres-torres-marroquin Aug 7, 2024
1126326
QA
andres-torres-marroquin Aug 7, 2024
13ee0c2
QA
andres-torres-marroquin Aug 7, 2024
04e2088
QA
andres-torres-marroquin Aug 7, 2024
5d251d0
QA
andres-torres-marroquin Aug 7, 2024
1af95cb
QA
andres-torres-marroquin Aug 7, 2024
893ac65
QA
andres-torres-marroquin Aug 8, 2024
c940c5f
QA
andres-torres-marroquin Aug 8, 2024
5b73103
QA
andres-torres-marroquin Aug 8, 2024
cc3c3de
QA
andres-torres-marroquin Aug 8, 2024
236ee28
QA
andres-torres-marroquin Aug 9, 2024
4a9669c
QA
andres-torres-marroquin Aug 9, 2024
490def4
QA
andres-torres-marroquin Aug 9, 2024
304e3b3
Update clients/admin-ui/src/features/user-management/UserManagementLa…
andres-torres-marroquin Aug 9, 2024
94c71fc
Merge branch 'main' into PROD-2366
andres-torres-marroquin Aug 9, 2024
b072091
Adding CHANGELOG.md
andres-torres-marroquin Aug 9, 2024
37d253a
QA
andres-torres-marroquin Aug 9, 2024
c0550da
QA
andres-torres-marroquin Aug 9, 2024
413b7b9
QA
andres-torres-marroquin Aug 9, 2024
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions clients/admin-ui/src/features/auth/auth.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { RoleRegistryEnum, ScopeRegistryEnum } from "~/types/api";
import {
LoginRequest,
LoginResponse,
LoginWithOIDCRequest,
LogoutRequest,
LogoutResponse,
} from "./types";
Expand Down Expand Up @@ -58,6 +59,13 @@ const authApi = baseApi.injectEndpoints({
}),
invalidatesTags: () => ["Auth"],
}),
loginWithOIDC: build.mutation<LoginResponse, LoginWithOIDCRequest>({
query: (data) => ({
url: `plus/openid-provider/${data.provider}/callback?code=${data.code}`,
method: "GET",
}),
invalidatesTags: () => ["Auth"],
}),
logout: build.mutation<LogoutResponse, LogoutRequest>({
query: () => ({
url: "logout",
Expand Down Expand Up @@ -85,6 +93,7 @@ const authApi = baseApi.injectEndpoints({

export const {
useLoginMutation,
useLoginWithOIDCMutation,
useLogoutMutation,
useAcceptInviteMutation,
useGetRolesToScopesMappingQuery,
Expand Down
5 changes: 5 additions & 0 deletions clients/admin-ui/src/features/auth/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ export interface LoginRequest {
password: string;
}

export interface LoginWithOIDCRequest {
provider: string;
code: string;
}

export interface LoginResponse {
user_data: User;
token_data: {
Expand Down
1 change: 1 addition & 0 deletions clients/admin-ui/src/features/common/api.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const baseApi = createApi({
"Configuration Settings",
"TCF Purpose Override",
"Consent Reporting",
"OpenID Provider",
],
endpoints: () => ({}),
});
3 changes: 3 additions & 0 deletions clients/admin-ui/src/features/common/nav/v2/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@ export const GLOBAL_CONSENT_CONFIG_ROUTE = "/settings/consent";
export const MESSAGING_ROUTE = "/messaging";
export const MESSAGING_ADD_TEMPLATE_ROUTE = "/messaging/add-template";
export const MESSAGING_EDIT_ROUTE = "/messaging/[id]";

// OpenID Authentication group
export const OPENID_AUTHENTICATION_ROUTE = "/settings/openid-authentication";
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { UseDisclosureReturn } from "fidesui";

import AddModal from "~/features/configure-consent/AddModal";
import SSOProviderForm from "~/features/openid-authentication/SSOProviderForm";

const AddSSOProviderModal = ({
isOpen,
onClose,
}: Pick<UseDisclosureReturn, "isOpen" | "onClose">) => (
<AddModal isOpen={isOpen} onClose={onClose} title="Add SSO Provider">
<SSOProviderForm onClose={onClose} />
</AddModal>
);

export default AddSSOProviderModal;
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import AddModal from "~/features/configure-consent/AddModal";
import SSOProviderForm from "~/features/openid-authentication/SSOProviderForm";
import { OpenIDProvider } from "~/types/api/models/OpenIDProvider";

const EditSSOProviderModal = ({
isOpen,
onClose,
openIDProvider,
}: {
isOpen: boolean;
onClose: () => void;
openIDProvider: OpenIDProvider;
}) => (
<AddModal isOpen={isOpen} onClose={onClose} title="Edit SSO Provider">
<SSOProviderForm openIDProvider={openIDProvider} onClose={onClose} />
</AddModal>
);

export default EditSSOProviderModal;
112 changes: 112 additions & 0 deletions clients/admin-ui/src/features/openid-authentication/SSOProvider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import {
Box,
Button,
ConfirmationModal,
Image,
Text,
useDisclosure,
useToast,
} from "fidesui";

import { getErrorMessage, isErrorResult } from "~/features/common/helpers";
import { errorToastParams, successToastParams } from "~/features/common/toast";
import EditSSOProviderModal from "~/features/openid-authentication/EditSSOProviderModal";
import { useDeleteOpenIDProviderMutation } from "~/features/openid-authentication/openprovider.slice";
import { OpenIDProvider } from "~/types/api/models/OpenIDProvider";

const SSOProvider = ({
openIDProvider,
}: {
openIDProvider: OpenIDProvider;
}) => {
const { onOpen, isOpen, onClose } = useDisclosure();
const {
isOpen: deleteIsOpen,
onOpen: onDeleteOpen,
onClose: onDeleteClose,
} = useDisclosure();
const toast = useToast();

const [deleteOpenIDProviderMutation] = useDeleteOpenIDProviderMutation();

const handleDelete = async () => {
const result = await deleteOpenIDProviderMutation(openIDProvider.id);
if (isErrorResult(result)) {
toast(errorToastParams(getErrorMessage(result.error)));
onDeleteClose();
return;
}

toast(successToastParams(`OpenID Provider deleted successfully`));

onDeleteClose();
};

return (
<Box
alignItems="center"
borderRadius="lg"
borderWidth="1px"
display="flex"
height="74px"
marginBottom="24px"
padding={2}
>
<Box display="flex" alignItems="center">
<Image
src={`/images/oauth-login/${openIDProvider.provider}.png`}
alt={`${openIDProvider.provider} icon`}
width={50}
height={50}
/>
<Box display="flex" flexDirection="column">
<Text fontSize="medium" fontWeight="bold" marginLeft="16px">
{openIDProvider.provider}
</Text>
<Text fontSize="medium" marginLeft="16px">
{openIDProvider.name}
</Text>
</Box>
</Box>
<Box flexGrow={1} display="flex" justifyContent="flex-end">
<Button
size="sm"
marginRight="12px"
variant="outline"
onClick={onDeleteOpen}
data-testid="remove-sso-provider-btn"
>
Remove
</Button>
<Button
size="sm"
marginRight="12px"
variant="outline"
onClick={onOpen}
data-testid="edit-sso-provider-btn"
>
Edit
</Button>
</Box>
<EditSSOProviderModal
isOpen={isOpen}
onClose={onClose}
openIDProvider={openIDProvider}
/>
<ConfirmationModal
isOpen={deleteIsOpen}
onClose={onDeleteClose}
onConfirm={handleDelete}
title="Remove SSO provider"
message={
<Text>
You are about to permanently remove this SSO provider. Are you sure
you would like to continue?
</Text>
}
/>
</Box>
);
};

export default SSOProvider;
Loading
Loading