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

feat(auth): azuread behind proxy #2576

Merged
merged 15 commits into from
Nov 24, 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
6 changes: 3 additions & 3 deletions docs/deployment/authentication/azuread-auth.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This feature is a part of Keep Enterprise.
Talk to us to get access: https://www.keephq.dev/meet-keep
</Tip>

Keep supports enterprise authentication through Azure Active Directory (Azure AD), enabling organizations to use their existing Microsoft identity platform for secure access management.
Keep supports enterprise authentication through Azure Entre ID (formerly known as Azure AD), enabling organizations to use their existing Microsoft identity platform for secure access management.

## When to Use

Expand Down Expand Up @@ -49,9 +49,9 @@ We use "Web" platform instead of "Single Page Application (SPA)" because Keep's
</Info>

<Tip>
For localhost, the redirect would be http://localhost:3000/api/auth/callback/azure-ad
For localhost, the redirect would be http://localhost:3000/api/auth/callback/microsoft-entra-id

For production, it should be something like http://your_keep_frontend_domain/api/auth/callback/azure-ad
For production, it should be something like http://your_keep_frontend_domain/api/auth/callback/microsoft-entra-id

</Tip>

Expand Down
Binary file modified docs/images/azuread_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
133 changes: 77 additions & 56 deletions keep-ui/app/(keep)/alerts/alert-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,20 @@ export function AlertTable({
};

return (
<div className="flex flex-col gap-4 h-full">
<TitleAndFilters
table={table}
alerts={alerts}
presetName={presetName}
onThemeChange={handleThemeChange}
/>
<div className="min-h-10">
{/* Setting min-h-10 to avoid jumping when actions are shown */}
// Add h-screen to make it full height and remove the default flex-col gap
<div className="h-screen flex flex-col">
{/* Add padding to account for any top nav/header */}
<div className="pt-4 px-4 flex-none">
<TitleAndFilters
table={table}
alerts={alerts}
presetName={presetName}
onThemeChange={handleThemeChange}
/>
</div>

{/* Make actions/presets section fixed height */}
<div className="h-12 px-4 flex-none">
{selectedRowIds.length ? (
<AlertActions
selectedRowIds={selectedRowIds}
Expand All @@ -291,61 +296,77 @@ export function AlertTable({
/>
)}
</div>
<div className="flex gap-6">
<div className="w-32 min-w-[12rem]">
<AlertFacets
className="sticky top-0"
alerts={alerts}
facetFilters={facetFilters}
setFacetFilters={setFacetFilters}
dynamicFacets={dynamicFacets}
setDynamicFacets={setDynamicFacets}
onDelete={handleFacetDelete}
table={table}
showSkeleton={showSkeleton}
/>
</div>
<div className="flex flex-col gap-4 min-w-0">
<Card className="flex-grow h-full flex flex-col p-0">
<div className="flex-grow">
{/* For dynamic preset, add alert tabs*/}
{!presetStatic && (
<AlertTabs
presetId={presetId}
tabs={tabs}
setTabs={setTabs}
selectedTab={selectedTab}
setSelectedTab={setSelectedTab}
/>
)}
<div ref={a11yContainerRef} className="sr-only" />
<Table className="[&>table]:table-fixed [&>table]:w-full">
<AlertsTableHeaders
columns={columns}
table={table}
presetName={presetName}
a11yContainerRef={a11yContainerRef}
/>
<AlertsTableBody
table={table}
showSkeleton={showSkeleton}
showEmptyState={showEmptyState}
theme={theme}
onRowClick={handleRowClick}
presetName={presetName}
/>
</Table>
</div>
</Card>

{/* Main content area - uses flex-grow to fill remaining space */}
<div className="flex-grow overflow-hidden px-4 pb-4">
<div className="h-full flex gap-6">
{/* Facets sidebar */}
<div className="w-32 min-w-[12rem] overflow-y-auto">
<AlertFacets
className="sticky top-0"
alerts={alerts}
facetFilters={facetFilters}
setFacetFilters={setFacetFilters}
dynamicFacets={dynamicFacets}
setDynamicFacets={setDynamicFacets}
onDelete={handleFacetDelete}
table={table}
showSkeleton={showSkeleton}
/>
</div>

{/* Table section */}
<div className="flex-1 flex flex-col min-w-0">
<Card className="h-full flex flex-col p-0">
<div className="flex-grow flex flex-col overflow-hidden">
{!presetStatic && (
<div className="flex-none">
<AlertTabs
presetId={presetId}
tabs={tabs}
setTabs={setTabs}
selectedTab={selectedTab}
setSelectedTab={setSelectedTab}
/>
</div>
)}

<div ref={a11yContainerRef} className="sr-only" />

{/* Make table wrapper scrollable */}
<div className="flex-grow overflow-auto">
<Table className="[&>table]:table-fixed [&>table]:w-full">
<AlertsTableHeaders
columns={columns}
table={table}
presetName={presetName}
a11yContainerRef={a11yContainerRef}
/>
<AlertsTableBody
table={table}
showSkeleton={showSkeleton}
showEmptyState={showEmptyState}
theme={theme}
onRowClick={handleRowClick}
presetName={presetName}
/>
</Table>
</div>
</div>
</Card>
</div>
</div>
</div>
<div className="mt-2 mb-8 pl-[14rem]">

{/* Pagination footer - fixed height */}
<div className="h-16 px-4 flex-none pl-[14rem]">
<AlertPagination
table={table}
presetName={presetName}
isRefreshAllowed={isRefreshAllowed}
/>
</div>

<AlertSidebar
isOpen={isSidebarOpen}
toggle={() => setIsSidebarOpen(false)}
Expand Down
16 changes: 9 additions & 7 deletions keep-ui/app/(keep)/alerts/alerts-table-body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ export function AlertsTableBody({
if (showEmptyState) {
return (
<>
<div className="flex flex-col justify-center items-center h-96 w-full absolute p-4">
<EmptyStateCard
title="No alerts to display"
description="It is because you have not connected any data source yet or there are no alerts matching the filter."
buttonText="Add Alert"
onClick={handleModalOpen}
/>
<div className="flex items-center h-full w-full absolute -mt-20">
<div className="flex flex-col justify-center items-center w-full p-4">
<EmptyStateCard
title="No alerts to display"
description="It is because you have not connected any data source yet or there are no alerts matching the filter."
buttonText="Add Alert"
onClick={handleModalOpen}
/>
</div>
</div>
{modalOpen && (
<PushAlertToServerModal
Expand Down
10 changes: 3 additions & 7 deletions keep-ui/app/(signin)/signin/SignInForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface Providers {
auth0?: Provider;
credentials?: Provider;
keycloak?: Provider;
"azure-ad"?: Provider;
"microsoft-entra-id"?: Provider;
}

interface SignInFormInputs {
Expand All @@ -42,15 +42,11 @@ export default function SignInForm({ params }: { params?: { amt: string } }) {
} = useForm<SignInFormInputs>();

useEffect(() => {
console.log("Fetching providers");
async function fetchProviders() {
console.log("Fetching providers 2");
const response = await getProviders();
setProviders(response as Providers);
}
console.log("Fetching providers 3");
fetchProviders();
console.log("Fetching providers 4");
}, []);

useEffect(() => {
Expand All @@ -69,9 +65,9 @@ export default function SignInForm({ params }: { params?: { amt: string } }) {
} else if (providers.keycloak) {
console.log("Signing in with keycloak provider");
signIn("keycloak", { callbackUrl: "/" });
} else if (providers["azure-ad"]) {
} else if (providers["microsoft-entra-id"]) {
console.log("Signing in with Azure AD provider");
signIn("azure-ad", { callbackUrl: "/" });
signIn("microsoft-entra-id", { callbackUrl: "/" });
} else if (
providers.credentials &&
providers.credentials.name == "NoAuth"
Expand Down
Loading
Loading