Skip to content

Authentication

Shadow Theme uses a session-based developer authentication flow.

It does not use the portal-api JWT login endpoints. This keeps the browser frontend simple and lets the theme work even when a project does not install or expose the REST API package.

Auth Model

ConcernShadow Theme behavior
LoginValidates developer credentials and stores the developer ID in the Laravel session.
Session keyConfigured by SHADOW_THEME_SESSION_KEY.
Middlewareshadow.user, shadow.guest, and shadow.auth.
Password resetUses the configured Laravel password broker.
MFAOptional, enabled when portal-mfa is installed and configured.

Default session key:

dotenv
SHADOW_THEME_SESSION_KEY=shadow_theme.user_id

Middleware

Shadow Theme registers three middleware aliases:

MiddlewarePurpose
shadow.userResolves the current Shadow Theme developer for all theme routes.
shadow.guestRedirects authenticated developers away from guest-only pages.
shadow.authProtects dashboard, profile, apps, credentials, and MFA settings pages.

Guest Routes

Guest routes include:

RoutePurpose
/loginLogin form.
/registerDeveloper registration.
/forgot-passwordPassword reset request.
/reset-passwordPassword reset completion.
/auth/mfaMFA login challenge, when applicable.

Authenticated Routes

Authenticated routes include:

RoutePurpose
/dashboardDeveloper dashboard.
/profileProfile settings.
/appsDeveloper apps.
/apps/{appName}App details and credentials.
/settings/mfaMFA settings.

Password Reset

Configure the password broker:

dotenv
SHADOW_THEME_PASSWORD_BROKER=users

Enable or disable password reset UI:

dotenv
SHADOW_THEME_PASSWORD_RESET_ENABLED=true

Optional MFA

When ninjaportal/portal-mfa is installed and enabled, Shadow Theme can show MFA flows for developers.

Enable the frontend UI:

dotenv
SHADOW_THEME_MFA_UI_ENABLED=true

Supported UI flows include:

  • Login MFA challenge.
  • Authenticator app enrollment.
  • Authenticator app confirmation.
  • Email OTP enrollment.
  • Email OTP confirmation.
  • Disabling configured MFA drivers.

Redirect After Login

By default, developers are redirected to the Shadow Theme dashboard.

Override it with:

dotenv
SHADOW_THEME_REDIRECT_AFTER_LOGIN=portal/dashboard

Use this when your application has a custom post-login landing page.