Skip to content

Authentication ​

Overview ​

The backend issues Laravel Passport personal access tokens for every kind of caller. Each API surface has its own guard and its own user model, so a token minted for one surface is rejected by the others.

GuardDriverProvider modelUsed byToken name
apipassportApp\Models\UserAdmin API /api/v1 (auth:api)Api Token (password, passkey, social, support), SSO Token (SAML)
dam-apipassportApp\Models\DAM\DealerUsersPortal API /dam/v1 (auth:dam-api + dam-api middleware)DAM Api Token
external-apipassportApp\Models\DAM\DamExternalAppExternal API /external/v1 (auth:external-api + external-api middleware)External Api Token
external-userpassportApp\Models\ExternalUserExternal upload users on /api/v1 (check.external middleware; also auth/verify via auth.user-or-external)external-token
websessionApp\Models\UserBlade super-admin pages under /adminnone

Guards are defined in config/auth.php. Route prefixes come from RouteServiceProvider: routes/api.php is mounted at /api, routes/dam-api.php at /dam, routes/external-api.php at /external.

All tokens come from one personal access client with no provider, so on its own Passport would let any guard accept any token and look its user_id up in its own table (a portal token for dealer user 7 would sign in as Admin user 7). Since PR #453 AuthServiceProvider replaces Passport's passport guard driver with App\Auth\ProviderBoundTokenGuard, which rejects a token whose name is not one its provider issues:

ProviderAccepted token names
usersApi Token, SSO Token
dealer_usersDAM Api Token
external_appExternal Api Token
external_usersexternal-token

A token with any other name authenticates as nobody (401). Routes that must accept more than one kind of token use auth.user-or-external, which picks the guard from the token name (see Middleware).

Passport has no global expiry configured, so normal tokens are long-lived. SAML SSO tokens are the exception: SsoLoginService::issueToken() sets Passport::personalAccessTokensExpireIn() to saml.token_ttl_days (default 7) right before minting.

Login methods covered here: admin password login, portal (partner) login, the backend-user portal sign-in link (login-with-id), public portal credentials, password reset and invitation password setup, passkeys (WebAuthn, laragear/webauthn), SAML SSO, social login (Socialite), support PIN login, external upload user OTP login and external app (API key) login.

Endpoints ​

Admin API (/api/v1) ​

MethodPathController@methodPurpose
POST/loginAuth\AuthController@loginEmail and password login, returns access_token and default workspace
GET/check-brandingAuth\AuthController@checkBrandingBranding and SSO flags for the login page (custom domain aware)
POST/forgot-passwordAuth\AuthController@sendPasswordResetLinkEmailEmail a reset link
POST/reset-password-detailsAuth\AuthController@getResetPwdUserDetailsExchange the emailed token for an encrypted reset_token
POST/reset-passwordAuth\AuthController@resetPasswordSet a new password
POST/generate-passwordAuth\AuthController@generateNewUserPasswordSet password from a user, dealer or general invitation
POST/generate-common-passwordAuth\AuthController@generateCommonPasswordSet password for a new subscription customer from a signed PasswordSetupToken
POST/passkeys/login/optionsAuth\PasskeyController@loginOptionsWebAuthn assertion challenge
POST/passkeys/loginAuth\PasskeyController@loginVerify the signed challenge, issue token
GET/auth/login/{service}Auth\SocialAuthController@redirectRedirect to Google, Facebook or Microsoft (social middleware)
GET/auth/login/{service}/callbackAuth\SocialAuthController@callbackProvider callback, checks state, redirects to /social-login?login_code= on the frontend
POST/auth/social/exchangeAuth\SocialAuthController@exchangeLoginCodeSwap the one-time login_code for the access token (throttle:20,1)
POST/auth/sso/resolveAuth\SsoAuthController@resolveEmail domain to SSO connection lookup
GET/auth/sso/{url_slug}/redirectAuth\SsoAuthController@redirectRedirect to the IdP with a SAML request
POST/auth/sso/{url_slug}/acsAuth\SsoAuthController@acsSAML assertion consumer service
GET/auth/sso/{url_slug}/metadataAuth\SsoAuthController@metadataService provider metadata XML
POST/support-loginSupport\AuthController@supportLoginLogin with a user's support PIN
POST/external-loginUser\ExternalUserController@externalUserLoginSend an OTP to an external upload user
POST/external-login-verifyUser\ExternalUserController@externalUserLoginVerifyVerify OTP, issue external-user token
POST/external-logoutUser\ExternalUserController@externalUserLogoutLog out external user (check.external)
GET/check-tokenclosureReturns 200 when the api token is valid
GET/auth/verifyAuth\TokenVerifyController@verifyServer-side token check for user and external upload user tokens: user_id, is_external, workspaces with DAM role; 1200/min per token (auth.user-or-external, throttle:verify-token)
GET/userAuth\AuthController@getUserCurrent user, workspaces and modules
GET/check-workspace-accessAuth\AuthController@checkWorkspaceAccessWorkspace access check for the current user
POST/logoutAuth\AuthController@logoutDelete the current token
POST/terminate-token, /terminate-all-tokenSupport\AuthController@terminateToken, @terminateAllTokenEnd support sessions
GET/passkeysAuth\PasskeyController@indexList the user's passkeys
POST/passkeys/register/optionsAuth\PasskeyController@registerOptionsWebAuthn creation options, after re-authentication (throttle:reauth)
POST/passkeys/registerAuth\PasskeyController@registerStore a new passkey (optional alias)
DELETE/passkeys/{id}Auth\PasskeyController@destroyRemove a passkey, after re-authentication (throttle:reauth)
GET POST/sso/connection, /sso/sync, /sso/test, /sso/activityWorkspace\SsoSettingsControllerOwner-only SSO setup (checkWorkspaceOwner, checkSsoAllowed)

Portal API (/dam/v1) ​

MethodPathController@methodPurpose
POST/loginDAM\v1\Auth\AuthController@loginPartner login to one portal (instance)
POST/login-with-idDAM\v1\Auth\AuthController@loginByIdSign an admin user into a portal as a backend user with a signed PortalLoginTicket
POST/check-public-portalDAM\v1\Auth\AuthController@checkPublicPortalLoginSign a visitor into a public portal as its anonymous account (throttle:30,1)
POST/forgot-passwordDAM\v1\Auth\AuthController@sendPasswordResetLinkEmailEmail a reset link to a partner
POST/reset-password-details, /reset-passwordDAM\v1\Auth\AuthController@getResetPwdUserDetails, @resetPasswordPartner password reset
POST/get-invitation-details, /generate-passwordDAM\v1\Auth\AuthController@getInvitationUserDetails, @generateNewUserPasswordAccept a portal invitation
GET/userDAM\v1\Auth\AuthController@getUserCurrent partner
POST/auth-change-passwordDAM\v1\Auth\AuthController@authChangePasswordChange password, revoke other tokens
POST/logoutDAM\v1\Auth\AuthController@logoutDelete the current token

External API (/external/v1) ​

MethodPathController@methodPurpose
POST/loginDAM\v1\External\AuthController@loginExchange app_key and secret_key for a token

Workflows ​

Admin password login ​

On a custom domain the default workspace is swapped for the first domain workspace if the user's default_workspace is not on that domain. The module list comes from active module_workspaces rows plus the user's role per module (getRoleData). Every later admin request carries the token and passes auth:api; workspace-scoped routes also pass checkUserWithWS (see Middleware), which returns 420 when the user is not a member of url_workspace_id and runs the SSO re-check below.

Portal (partner) login ​

workspace_id is not required when flage_type is sent. The anonymous public-portal user is matched by email and instance id; other partners are matched by email only. Every authenticated portal request then passes DAMAPIMiddleware: the token name must be DAM Api Token, the instance (from instance_id, the X-Instance-Id header or the user's instance_id) must be active (403 Brand portal not found or inactive.), and the user needs an active dam_instances_users row unless they are a backend user (403 You do not have access to this instance.). The middleware merges dam_instance_id and dam_workspace_id into the request.

Portal login ticket. login-with-id has no auth middleware. Its token is a App\Services\PortalLoginTicket: <user id>.<portal id>.<expires unix time>.<hmac>, where the HMAC (SHA-256, keyed with the app key) covers portal-login|<user id>|<portal id>|<expires>. A ticket lives 12 hours and only opens the portal it names. It is issued as the portal's login_url attribute (DamInstance::getLoginUrlAttribute()): for an Admin user, a ticket for that user; for a backend portal user, a ticket for its linked backend_login_user_id; for an ordinary portal user, null. Until PR #453 the token was md5(user id), which anyone could compute. Example body: { "url": "<portal url>", "token": "42.7.1795000000.<64 hex>" }.

The backend portal user also needs a dam_instances_users row like everyone else: DAMAPIMiddleware no longer lets is_backend_user skip the instance access check.

Public portal. The frontend calls POST /dam/v1/check-public-portal with the portal url (throttle:30,1). checkPublicPortalLogin does the whole sign-in in one call, in this order:

  1. Active portal with is_public_portal = 1 at that url, else <url> is not available.
  2. Its workspace exists, else Workspace is not available.
  3. Subscription not suspended, else the suspended-account message.
  4. The portal's anonymous account exists (DealerUsers with email DamInstance::PUBLIC_PORTAL_EMAIL, this instance_id, is_backend_user = 0), else <url> is not available. The account is deactivated when the portal goes private, so is_active = 0 returns 422 Your access is denied. Please contact Administrator.
  5. A dam_instances_users row for it, else 422 not authorised.
  6. portalSignIn() records the login and returns the same payload as POST /dam/v1/login, plus url and id.

The response never carries the anonymous email or password (the old checkPublicPortalDetails returned both for the browser to post to /login). The anonymous account is read-only from the portal: POST /dam/v1/auth-change-password returns 403 The password of the public portal account cannot be changed., and POST /dam/v1/digital/instance/update-user writes nothing and returns the current record.

Password reset ​

Reset links expire 60 minutes after they are issued (PasswordVerificationEmail::EXPIRES_MINUTES, applied with the unexpired() scope in reset-password-details and reset-password on both APIs). The link host no longer comes from Origin or Referer: it is FRONTEND_URL, or https://<workspace url> when the request matched a custom-domain workspace whose domain_status is verified.

Admin and portal users share password_verification_emails, but user_id means users.id for one and dealer_users.id for the other. Since PR #453 portal tokens start with dlr- (dlr- plus 46 random characters); each API deletes and accepts only its own kind, so an Admin token can never reset a portal account with the same id or the reverse.

Mail is sent through WorkspaceMailService::scoped() so a custom-domain workspace uses its own mail settings. The same email is returned for an unknown user and a user outside the custom-domain workspace, so the endpoint does not leak membership. Users that only have module 3 access get the email redirected to a fixed internal address. The portal flow (/dam/v1/forgot-password) is the same but looks up active DealerUsers with is_backend_user = 0 and builds the link on the portal's own URL (https://{instance->url}) or DAM_FRONTEND_URL. generate-password handles invitation tokens of type user, dealer or general (base64 in type); a general invitation that is revoked or past last_date returns This link is expired.

Password setup links. generate-common-password (the emailed "set your password" link for new subscription customers, /password-setup and /subscription/generate-password on the frontend) takes an App\Services\PasswordSetupToken: <user id>.<expires>.<hmac>, valid 7 days. The HMAC covers the user's current password hash, so the link stops working as soon as a password is set. A bad token returns This password link is invalid or has expired. It replaced md5(user id).

Passkey (WebAuthn) login ​

Enrolment runs under auth:api: register/options returns the creation options (AttestationRequest::toCreate()), register verifies and saves the credential with an optional alias (max 255).

Re-authentication. A bearer token alone cannot add or remove a passkey. register/options and DELETE /passkeys/{id} call reauthenticate() first:

AccountProof requiredFailure (422)
Has a passwordpassword in the body, checked with Hash::checkCurrent password does not match.
No password (SSO JIT users are created with password = NULL)The access token was created within webauthn.reauth.token_max_age_minutes (env WEBAUTHN_REAUTH_TOKEN_MAX_AGE_MINUTES, default 10), i.e. a fresh IdP sign-inPlease sign in again to manage passkeys.

The frontend picks the prompt from password_generated on GET /api/v1/user. Gating register/options is enough because its challenge is the only way to finish register. Both routes and user/auth-change-password use the reauth limiter: 5 requests per minute per user id (IP when signed out), so a stolen token cannot be used to guess the password. Enrolments and removals are logged (Passkey enrolled, Passkey removed, and a warning for each rejected re-auth).

App\WebAuthn\CacheChallengeRepository binds enrolment challenges to the user they were issued to (cache key webauthn:challenge: + SHA-256 of <model class>|<user id>|<challenge>), so a challenge from account A cannot complete an enrolment on account B. Login (assertion) challenges stay unbound because the user is unknown until the authenticator answers. Credentials live in webauthn_credentials. The account checks mirror password login so a deactivated or suspended user cannot sign in with a passkey.

Social login ​

Social login never creates accounts. Error messages are base64 encoded in the message query parameter. If the request expects JSON the token is returned as JSON instead of a redirect.

(PR #453):

  • State check (login CSRF). The routes have no session, so Socialite runs stateless(). redirect generates a 40-character state, sends it to the provider and stores it in the social_login_state cookie (10 minutes, path /api/v1/auth/login, HttpOnly, SameSite lax, Secure on HTTPS). callback compares the returned state with the cookie using hash_equals; a missing or different value redirects to /social-login?error=Unable to sign in with <Service>. Please try again.&code=0. The cookie is cleared on success and on a state failure.
  • No token in the URL. The callback stores the access token in the cache under social-login-code: + SHA-256 of a 64-character login_code for 120 seconds and redirects to FRONTEND_URL/social-login?login_code=<code>. The frontend calls POST /api/v1/auth/social/exchange with { "login_code": "<code>" } and gets { "access_token": "<token>" }. Cache::pull makes the code single use; an unknown, used or expired code returns 422 { "success": false, "message": "This sign-in link is invalid or has expired. Please try again." }. The route allows 20 calls per minute.

SAML SSO ​

redirect and acs only need the connection to be synced (isReady()) and the workspace to have sso_enabled; enabled only controls the resolve lookup.

resolve now uses findAllEnabledForDomain(): every enabled, usable connection that verified the email's domain, oldest first, in workspaces with sso_enabled. The response keeps the oldest as the top-level url_slug, workspace_name, provider and redirect_url, and adds choices (the same four fields per workspace) so the login page can offer a pick when one company runs several workspaces.

An existing account matched only by email (no sso_identities link yet) is signed in and linked only when it already belongs to the workspace: a workspace_users row (any status), a UserInvitation or GeneralInvitationsWorkspace for it, or an identity on this connection. Otherwise the sign-in is blocked with reason domain_not_allowed, detail Existing account is not a member of this workspace and the message This email already has a Collage account that isn't part of <workspace>. Ask the workspace owner to invite you directly. handleAssertion checks in order: email present, email domain on the verified domain list, user found by IdP stable id (sso_identities.name_id) then email, re-check user match, an existing account matched only by email must already belong to the workspace, seat availability for new users (owner is emailed when seats are full), user active, workspace subscription not suspended, workspace membership active. New users are created and given the default viewer role for the DAM module; the service refuses to grant an admin role. Each outcome is written to sso_login_events.

Sign-in activity log. SsoLoginEvent::record() writes one row per attempt or system event (outcome is ok, blocked or system), trims detail to 1024 and user_agent to 512 characters, mirrors the row to the BigQuery spool table sso_login_events, and never throws, so a logging failure cannot break a sign-in. Rows are never purged. System reasons written by the settings flow are settings_updated, sync_queued, test_ok / test_failed, and sync_ok / sync_failed from SyncSsoMetadata.

GET /api/v1/sso/activity (owner only) returns the workspace's rows newest first. per_page defaults to 25 and is clamped to 10-100. Rows with reason allowed_by_support or switched_off_by_support are left out, because the support on/off switch is internal; the owner sees sign-ins and their own actions. Since ac390fb the support switch (Web\Subscription\UserController@updateSsoStatus) no longer writes an event at all; it only clears the 60 s "workspace has SSO" cache with WorkspaceSsoConnection::forgetEnabledCache(). Each row carries id, created_at (ISO 8601), email, user_id, user_name, outcome, reason, detail and ip, with current_page, last_page, per_page and total beside data. Message: Sign-in activity.

SSO domain verification ​

Added in PR #453 (migration 2026_11_04_000000_create_workspace_sso_domains_table). A domain the owner only typed in proves nothing: an owner who runs their own identity provider could list another company's domain and have it assert that company's addresses. Each allowed domain is now a workspace_sso_domains row that must be proven before it matches anyone.

Record. Name {record_prefix}.{domain} (saml.domain_verification.record_prefix, env SSO_DOMAIN_TXT_PREFIX, default _collage-verify), value collage-verify=<token> where the token is 40 hex characters (bin2hex(random_bytes(20))). Example for example.com: _collage-verify.example.com TXT "collage-verify=<40 hex>". DomainVerifier::check() reads every TXT record at the prefixed name first and then at the apex (some DNS hosts cannot create underscore names), strips surrounding quotes and whitespace, and compares with hash_equals. On a miss the message is: No TXT record with the value collage-verify=<token> was found at _collage-verify.<domain> (or at <domain>). DNS changes can take up to an hour to spread; add the record and try again.

Statuses (WorkspaceSsoDomain): pending, verified, failed; verified_by is dns or support. A domain verified once stays verified: a failed re-check only updates last_checked_at and last_error (trimmed to 512 characters). Only verified rows take part in sign-in matching (allowsEmail(), findAllEnabledForDomain()).

Rules, in the order the API applies them:

RuleWhereResult
Domain is normalised (lowercase, leading @ dropped)addDomain, verifyDomain, removeDomain, updateEmpty after normalising: 422 Enter a domain such as company.com.
Public mailbox providers are refused (31 names in saml.domain_verification.public_email_domains, for example gmail.com, outlook.com, yahoo.com, icloud.com, proton.me)addDomain, update422 <domain> is a public email provider and can't be used for company login.
Adding an existing domain is a no-opaddDomain200 This domain is already on the list.
Verify is rate limiteddomains/verify routethrottle:10,1,sso-domain-verify (10 per minute)
Verifying a verified domain does not look DNS up againverifyDomain200 This domain is already verified.
Turning company login on needs at least one verified domain still in the listupdate422 Verify at least one allowed email domain before enabling company login.
The last verified domain cannot be removed while login is onremoveDomain422 Switch company login off before removing the last verified domain.
Unknown domainverifyDomain, removeDomain422 This domain is not on the list.

POST /api/v1/sso/connection with allowed_domains calls syncAllowedDomains(): new names start pending, names no longer listed are deleted, the rest keep their status. addDomain may run before any metadata exists; it creates the connection with last_sync_status = never. The workspace_sso_connections.allowed_domains JSON column is kept as a mirror (refreshDomainMirror()) for older readers; the table is the source. The settings payload now carries allowed_domains (every name), verified_domains and domains (one object per row: id, domain, status, verified, verified_by, verified_at, last_checked_at, last_error, txt_name, txt_value, created_at). Every add, verify, failed verify and remove writes a settings_updated row to sso_login_events.

Migration. Existing allow-lists were never ownership-checked, so the migration copies every name in allowed_domains into the new table as pending. Sign-ins on those domains stop until the owner verifies the TXT record or support marks the domain verified.

Support override. POST /admin/subscription/update-sso-domain (super-admin panel, workspace_id, domain, action = verify or reset) marks a domain verified with verified_by = support after a manual ownership check, or resets it to pending. Resetting the last verified domain while login is on also switches company login off and appends Company login was switched off because no verified domain remains. to the message.

SSO re-check on workspace entry ​

The 428 response carries a redirect URL with recheck=1, uid and an HMAC sig; redirect verifies the signature before starting the IdP round trip. A refused re-check sets last_recheck_failed_at, which blocks the workspace for saml.recheck_failure_hold_minutes (default 10). Any exception inside the check is logged and the request continues.

External upload user OTP login ​

Routes behind check.external resolve the user from the external-user guard and return 401 Unauthenticated. or 403 Your account is inactive.. Upload flows for these users are covered in Sharing.

External app (API key) login ​

Every other /external/v1 route runs auth:external-api and ExternalAPIMiddleware, which rejects any token whose name is not External Api Token with Access denied. (HTTP 400). Keys are managed from the admin app through GET /api/v1/digital-assets/get-app-token and POST /api/v1/digital-assets/update-app-token.

Support PIN login ​

The PIN must be a non-empty string: a null or empty PIN returns 422 Incorrect user OR password instead of matching every user whose support_pin is NULL. UsersController@saveSupportPin likewise refuses an empty PIN (422 Support pin is required.).

Users create the PIN with POST /api/v1/user/save-pin. terminate-token deletes the support token by jti and clears support_pin once no support sessions remain.

Session revocation on access change ​

Added in 9fd5e03 (PR #439). A changed role or workspace access must not outlive the tokens issued under the old one.

  • UsersController@editUserDetails (POST /api/v1/user/edit-user) takes an access fingerprint before and after the edit: an md5 of the user's role_user rows (workspace_id:module_id:role_id, ordered by workspace, module, role) plus their workspace_users rows (workspace_id=workspace_status, ordered by workspace). If the two differ, every token is revoked. Name, phone and photo edits leave the fingerprint unchanged, so sessions survive.
  • UsersController@deleteUser (POST /api/v1/user/delete-user) refuses the workspace owner (Oops! This admin is the current Workspace Owner and can’t be deactivated. ...), sets workspace_users.workspace_status = 0, sets the matching backend dam_instances_users.instance_status = 0, then always calls revokeAllApiTokens(). If the workspace was the user's default_workspace, it moves to their newest other active workspace (or NULL). Message: User deactivated successfully! On the next login the user sees only the workspaces they still belong to.
  • User::revokeAllApiTokens() collects the user's Passport tokens with revoked = false, sets revoked = true on their oauth_refresh_tokens rows (by access_token_id) and then on the tokens, and returns the number of access tokens revoked (0 when there were none). It works on $user->tokens(), so every Passport token issued to that user is revoked whatever its name.

Data ​

Model / tableUse
User / usersAdmin users (is_active, is_verified, default_workspace, support_pin, last_login)
workspace_usersMembership and workspace_status checked on every login
SubscriptionUsers / subscription_usersis_suspended check
DealerUsers / dealer_usersPortal partners and backend users (is_backend_user)
DamInstancesUsers / dam_instances_usersPartner access to a portal
DamExternalApp / dam_external_appsExternal API keys
ExternalUser / external_usersExternal upload users, otp, otp_expires_at
PasswordVerificationEmail / password_verification_emailsReset tokens (Admin and portal; portal tokens start with dlr-; valid 60 minutes)
UserInvitation, DealershipUsersInvitations, GeneralInvitationsInvitation tokens for generate-password
SocialUser / social_usersLinked social accounts
webauthn_credentialsPasskeys
WorkspaceSsoConnection, WorkspaceSsoDomain, SsoIdentity, SsoLoginEventSAML connection, allowed domains with ownership proof, user link, sign-in log
SupportSessionDetails / support_session_detailsSupport PIN sessions
oauth_access_tokensPassport tokens