Skip to Content

Require a sign-in for an app

Put a sign-in in front of an internal tool or a preview, with A-Line.cloud accounts or your own OpenID Connect provider.

Goal: nobody reaches the app until they sign in. Visitors sign in with their A-Line.cloud account (members of the app's environment) or at your own OpenID Connect (OIDC) provider, such as Google Workspace, Microsoft Entra ID, Okta, Keycloak or Authentik. Your app does not change: A-Line.cloud checks every request before it reaches the app.

Before you start

  • An app with at least one HTTP or HTTPS domain. Static sites, TCP, UDP and TLS passthrough domains are not covered.
  • For OIDC: a client (application) registered at your provider, and its client secret stored in one of the app's secret groups. It must be a secret you can reveal (not write-only); linking it is recorded in the secret's access log.
  • An environment admin role: changing any sign-in setting needs one, plus a step-up check when your account has two-factor authentication.

Choose who may sign in

ModeWho gets in
alineA-Line.cloud users with at least min_role (viewer, member or admin) on the app's environment. They sign in to the console, and the console signs them in to the app.
oidcAccounts of your provider that match allowed_emails or allowed_groups. At least one rule is required: a shared provider (any Google account, say) would otherwise let everyone in.

allowed_emails takes addresses (ana@example.com) and whole domains (@example.com); with aline it narrows the members further. A visitor who no longer matches the rules, loses the role, or (with aline) signs out of the console is refused on the next request.

With oidc, email and domain rules only match when the ID token carries email_verified: true. Some providers leave that claim out (Microsoft Entra ID does), so their visitors never match an email rule: use allowed_groups for those providers instead.

Public paths are matched per segment. A request path with a ; or a segment starting with .., plain or percent-encoded, never counts as public, so /healthz/..;/admin still needs a sign-in.

Turn it on in the console

Open the app, then Settings, HTTP settings.

Under Sign-in required, pick A-Line.cloud members or OIDC provider.

For OIDC, enter the issuer URL, the client ID and the name of the secret that holds the client secret, then register the redirect URIs the console lists at your provider. Each is https://<host>/.well-known/aline-sso/callback, one per host of the app.

Add allowed emails, domains or groups, and save.

Or in a project file

projects/tools/apps/admin.yaml
# yaml-language-server: $schema=https://a-line.cloud/schemas/iac/v1.json
version: 1
source:
  image: ghcr.io/example/admin:2.1.0
port: 8080
http:
  sign_in:
    mode: oidc
    allowed_emails: ["@example.com"]
    public_paths: ["/healthz"]
    session_hours: 12
    oidc:
      issuer: https://accounts.example.com
      client_id: admin-tool
      client_secret_secret: OIDC_CLIENT_SECRET
      groups_claim: groups
      allowed_groups: ["platform-team"]

A present sign_in mapping replaces the stored setting; keys it leaves out take their defaults. sign_in: {mode: off} turns it off. A sync never applies a sign-in change on its own: it applies the rest of http and holds the sign-in until an environment admin confirms it (with step-up) on the project's pending changes.

KeyMeaning
modeoff (default), aline or oidc.
min_rolealine only: viewer (default), member or admin.
allowed_emailsUp to 100 addresses or @domain entries.
public_pathsUp to 20 path prefixes reachable without signing in, such as a health check or a webhook. / is refused.
session_hoursHow long a sign-in lasts, 1 to 168 hours (default 12). With aline, never longer than the console session.
oidc.issuerThe provider's https issuer URL; its discovery document is read from /.well-known/openid-configuration.
oidc.client_idThe client ID.
oidc.client_secret_secretThe name of the secret that holds the client secret, never the secret itself.
oidc.scopesExtra scopes besides openid email profile (up to 10).
oidc.groups_claimThe ID token claim that lists the visitor's groups (default groups).
oidc.allowed_groupsUp to 50 groups; any one admits the visitor.

What the app receives

Every request that passes carries who signed in:

HeaderValue
X-Aline-User-EmailThe visitor's email (verified by the provider for OIDC).
X-Aline-User-IdThe A-Line.cloud user ID, or the provider's subject.
X-Aline-User-GroupsOIDC only: the allowed groups the visitor is in, comma-separated.

Clients can never set these headers themselves: any copy they send is removed. The sign-in cookie is removed from the request too.

Visitors sign out at https://<host>/.well-known/aline-sso/logout. Paths under /.well-known/aline-sso/ belong to the sign-in and never reach the app.

How it fails

The sign-in fails closed. When it cannot be checked (the provider is down, the client secret is missing, or a setting no longer validates), visitors see a "Sign-in unavailable" or "Sign-in misconfigured" page with status 503, never the app.

  • A page load without a sign-in is sent to sign in. Other requests (fetch, API clients) get 401 with {"error":"sign_in_required"}.
  • A sign-in cookie is valid on the host it was issued for only.
  • A visitor the rules do not admit gets a "Not allowed" page with status 403.

On this page