This document explains how to configure SSO providers and registration types at the whitemark level in Devana.ai.
Each whitemark instance in Devana.ai can be configured with specific SSO settings that control:
An array of SSO providers that are enabled for the whitemark.
Available Providers:
APPLE - Apple ID authenticationAUTHENTIK - Authentik identity providerAZUREAD - Microsoft Azure AD / Entra IDGITHUB - GitHub OAuthGOOGLE - Google OAuthLDAP - LDAP directory authenticationOAUTH2 - Generic OAuth 2.0 providerOPENID_CONNECT - OpenID Connect providerExample:
{
"allowedProviders": ["AZUREAD", "GOOGLE", "GITHUB"]
}
An array of authentication methods allowed for the whitemark.
Available Types:
CREDENTIALS - Traditional email/password authenticationSSO - Single Sign-On authenticationExample:
{
"registrationType": ["SSO", "CREDENTIALS"]
}
Allow both SSO and traditional login:
{
"allowedProviders": ["AZUREAD", "GOOGLE"],
"registrationType": ["SSO", "CREDENTIALS"]
}
Behavior:
Disable traditional login, allow multiple SSO providers:
{
"allowedProviders": ["AZUREAD", "GOOGLE", "GITHUB"],
"registrationType": ["SSO"]
}
Behavior:
Single SSO provider with automatic redirection:
{
"allowedProviders": ["AZUREAD"],
"registrationType": ["SSO"]
}
Behavior:
Traditional authentication only:
{
"allowedProviders": [],
"registrationType": ["CREDENTIALS"]
}
Behavior:
To update a whitemark to enable Google and GitHub SSO with both SSO and credentials authentication:
UPDATE "devana"."WhiteMark"
SET
"registrationType" = '{"CREDENTIALS", "SSO"}'::array<"RegistrationType">,
"allowedProviders" = '{"GOOGLE", "GITHUB"}'::array<"AuthProviders">
WHERE "id" = 'your-white-mark-id';
To update a whitemark to enable SSO on registration only with Azure AD:
UPDATE "devana"."WhiteMark"
SET
"allowedRegistration" = '{"SSO"}'::array<"RegistrationType">
WHERE "id" = 'your-white-mark-id';
Configure SSO providers for a whitemark:
mutation SetupSsoProviders($whitemarkId: ID!, $allowedProviders: [AuthProvidersTypeEnum!]!, $registrationType: [RegistrationTypeEnum!]) {
setupSsoProviders(whitemarkId: $whitemarkId, allowedProviders: $allowedProviders, registrationType: $registrationType) {
id
allowedProviders
registrationType
}
}
Variables:
{
"whitemarkId": "whitemark-uuid",
"allowedProviders": ["AZUREAD", "GOOGLE"],
"registrationType": ["SSO", "CREDENTIALS"]
}
Update whitemark with SSO configuration:
mutation UpsertWhitemark($id: ID, $allowedProviders: [AuthProvidersTypeEnum], $registrationType: [RegistrationTypeEnum]) {
upsertWhitemark(id: $id, allowedProviders: $allowedProviders, registrationType: $registrationType) {
id
allowedProviders
registrationType
}
}
The setup page (/setup) provides a user interface for configuring SSO:
Provider Selection:
Registration Type:
Live Preview:
When a user attempts to authenticate:
Domain Matching:
const whitemark = await prisma.whiteMark.findFirst({
where: {
domains: {
hasSome: [origin],
},
},
});
Provider Authorization:
allowedProvidersRegistration Type Check:
SSO is in registrationType for SSO authenticationCREDENTIALS is in registrationType for email/passwordAutomatic redirection occurs when:
registrationType contains only ["SSO"]allowedProviders contains exactly one providerif (
whiteMark.registrationType.length === 1 &&
whiteMark.registrationType[0] === RegistrationTypeEnum.Sso &&
whiteMark.allowedProviders.length === 1
) {
// Auto-redirect to single SSO provider
router.push(
`${process.env.NEXT_PUBLIC_SSO_API_URL}/auth/prepare?origin=${domain}&provider=${provider}`
);
}
Each enabled SSO provider requires specific environment variables to be configured. Refer to the individual provider documentation:
Each whitemark must have configured domains that match the authentication origin:
{
"domains": ["app.yourcompany.com", "yourcompany.devana.ai"]
}
The system determines the whitemark by matching the request origin against configured domains:
const origin = req.session?.authOrigin || req.headers?.["x-forwarded-host"];
All SSO providers implement CSRF protection using state parameters:
// Generate unique state for each authentication request
req.session.authState = uuidv4();
// Validate state parameter in callback
if (req.query.state && req.query.state !== expectedState) {
return done(new Error("Invalid state parameter"));
}
Authentication sessions are managed securely:
// Store authentication context in session
req.session.authOrigin = origin;
req.session.authProvider = provider;
req.session.authState = state;
// Clean up after successful authentication
delete req.session.authOrigin;
delete req.session.authProvider;
delete req.session.authState;
Each authentication is tied to a specific whitemark:
No whitemark found:
Provider not available:
allowedProvidersRegistration type mismatch:
registrationType includes appropriate valuesEnable debug logging to see: