Merge branch 'add-microsoft-auth' into 'main'
Add Azure auth See merge request digiresilience/link/link-stack!17
This commit is contained in:
commit
9a590ad13d
2 changed files with 29 additions and 0 deletions
|
|
@ -12,6 +12,7 @@ import {
|
||||||
import {
|
import {
|
||||||
Apple as AppleIcon,
|
Apple as AppleIcon,
|
||||||
Google as GoogleIcon,
|
Google as GoogleIcon,
|
||||||
|
Microsoft as MicrosoftIcon,
|
||||||
Key as KeyIcon,
|
Key as KeyIcon,
|
||||||
} from "@mui/icons-material";
|
} from "@mui/icons-material";
|
||||||
import { signIn, getProviders } from "next-auth/react";
|
import { signIn, getProviders } from "next-auth/react";
|
||||||
|
|
@ -182,6 +183,21 @@ export const Login: FC<LoginProps> = ({ session }) => {
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Grid>
|
</Grid>
|
||||||
)}
|
)}
|
||||||
|
{provider === "azure-ad" && (
|
||||||
|
<Grid item sx={{ width: "100%" }}>
|
||||||
|
<IconButton
|
||||||
|
sx={buttonStyles}
|
||||||
|
onClick={() =>
|
||||||
|
signIn("azure-ad", {
|
||||||
|
callbackUrl: `${origin}`,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<MicrosoftIcon sx={{ mr: 1 }} />
|
||||||
|
Sign in with Azure
|
||||||
|
</IconButton>
|
||||||
|
</Grid>
|
||||||
|
)}
|
||||||
{provider === "credentials" && (
|
{provider === "credentials" && (
|
||||||
<Grid item container spacing={3}>
|
<Grid item container spacing={3}>
|
||||||
<Grid item sx={{ width: "100%" }}>
|
<Grid item sx={{ width: "100%" }}>
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import {
|
||||||
import Google from "next-auth/providers/google";
|
import Google from "next-auth/providers/google";
|
||||||
import Credentials from "next-auth/providers/credentials";
|
import Credentials from "next-auth/providers/credentials";
|
||||||
import Apple from "next-auth/providers/apple";
|
import Apple from "next-auth/providers/apple";
|
||||||
|
import AzureADProvider from "next-auth/providers/azure-ad";
|
||||||
|
|
||||||
const headers = { Authorization: `Token ${process.env.ZAMMAD_API_TOKEN}` };
|
const headers = { Authorization: `Token ${process.env.ZAMMAD_API_TOKEN}` };
|
||||||
|
|
||||||
|
|
@ -82,6 +83,18 @@ if (process.env.GOOGLE_CLIENT_ID && process.env.GOOGLE_CLIENT_SECRET) {
|
||||||
clientSecret: process.env.APPLE_CLIENT_SECRET,
|
clientSecret: process.env.APPLE_CLIENT_SECRET,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
} else if (
|
||||||
|
process.env.AZURE_AD_CLIENT_ID &&
|
||||||
|
process.env.AZURE_AD_CLIENT_SECRET &&
|
||||||
|
process.env.AZURE_AD_TENANT_ID
|
||||||
|
) {
|
||||||
|
providers.push(
|
||||||
|
AzureADProvider({
|
||||||
|
clientId: process.env.AZURE_AD_CLIENT_ID,
|
||||||
|
clientSecret: process.env.AZURE_AD_CLIENT_SECRET,
|
||||||
|
tenantId: process.env.AZURE_AD_TENANT_ID,
|
||||||
|
}),
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
providers.push(
|
providers.push(
|
||||||
Credentials({
|
Credentials({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue