mirror of
https://github.com/makeplane/plane
synced 2025-08-07 19:59:33 +00:00
71 lines
2.2 KiB
TypeScript
71 lines
2.2 KiB
TypeScript
import { observer } from "mobx-react";
|
|
import Image from "next/image";
|
|
import { useTheme } from "next-themes";
|
|
// types
|
|
import {
|
|
TGetBaseAuthenticationModeProps,
|
|
TInstanceAuthenticationMethodKeys,
|
|
TInstanceAuthenticationModes,
|
|
} from "@plane/types";
|
|
// components
|
|
import { AuthenticationMethodCard } from "@/components/authentication";
|
|
// helpers
|
|
import { getBaseAuthenticationModes } from "@/helpers/authentication.helper";
|
|
// plane admin components
|
|
import { UpgradeButton } from "@/plane-admin/components/common";
|
|
// images
|
|
import OIDCLogo from "@/public/logos/oidc-logo.svg";
|
|
import SAMLLogo from "@/public/logos/saml-logo.svg";
|
|
|
|
export type TAuthenticationModeProps = {
|
|
disabled: boolean;
|
|
updateConfig: (key: TInstanceAuthenticationMethodKeys, value: string) => void;
|
|
};
|
|
|
|
// Authentication methods
|
|
export const getAuthenticationModes: (props: TGetBaseAuthenticationModeProps) => TInstanceAuthenticationModes[] = ({
|
|
disabled,
|
|
updateConfig,
|
|
resolvedTheme,
|
|
}) => [
|
|
...getBaseAuthenticationModes({ disabled, updateConfig, resolvedTheme }),
|
|
{
|
|
key: "oidc",
|
|
name: "OIDC",
|
|
description: "Authenticate your users via the OpenID Connect protocol.",
|
|
icon: <Image src={OIDCLogo} height={22} width={22} alt="OIDC Logo" />,
|
|
config: <UpgradeButton />,
|
|
unavailable: true,
|
|
},
|
|
{
|
|
key: "saml",
|
|
name: "SAML",
|
|
description: "Authenticate your users via the Security Assertion Markup Language protocol.",
|
|
icon: <Image src={SAMLLogo} height={22} width={22} alt="SAML Logo" className="pl-0.5" />,
|
|
config: <UpgradeButton />,
|
|
unavailable: true,
|
|
},
|
|
];
|
|
|
|
export const AuthenticationModes: React.FC<TAuthenticationModeProps> = observer((props) => {
|
|
const { disabled, updateConfig } = props;
|
|
// next-themes
|
|
const { resolvedTheme } = useTheme();
|
|
|
|
return (
|
|
<>
|
|
{getAuthenticationModes({ disabled, updateConfig, resolvedTheme }).map((method) => (
|
|
<AuthenticationMethodCard
|
|
key={method.key}
|
|
name={method.name}
|
|
description={method.description}
|
|
icon={method.icon}
|
|
config={method.config}
|
|
disabled={disabled}
|
|
unavailable={method.unavailable}
|
|
/>
|
|
))}
|
|
</>
|
|
);
|
|
});
|