fix: disable sso login when no issuer present

This commit is contained in:
Maximilian Liebmann 2025-05-06 13:07:50 +02:00
parent 43504d31f7
commit bf50f3a5a5
2 changed files with 9 additions and 2 deletions

View file

@ -37,7 +37,12 @@ export default async function LoginPage() {
<hr style={{ width: 230 }} /> <hr style={{ width: 230 }} />
<SSOLogin provider='authentik' providerDisplayName='SSO' /> {process.env.AUTH_AUTHENTIK_ISSUER && (
<SSOLogin provider='authentik' providerDisplayName='SSO' />
)}
{process.env.AUTH_AUTHENTIK_ISSUER && (
<SSOLogin provider='authentik' providerDisplayName='SSO' />
)}
</div> </div>
); );
} }

View file

@ -2,7 +2,9 @@ import NextAuth from 'next-auth';
import Authentik from 'next-auth/providers/authentik'; import Authentik from 'next-auth/providers/authentik';
export const { handlers, signIn, signOut, auth } = NextAuth({ export const { handlers, signIn, signOut, auth } = NextAuth({
providers: [Authentik], providers: [process.env.AUTH_AUTHENTIK_ISSUER ? Authentik : null].filter(
(x) => x !== null,
),
callbacks: { callbacks: {
authorized: async ({ auth }) => { authorized: async ({ auth }) => {
return !!auth; return !!auth;