Barvna shema: Svetla
Trenutno dejavna stran: start » en » Documentation » Data integration and data access » WKL Database Gateway » Concepts » Sign-in and identity pass-through

Sign-in and identity pass-through

The service answers two separate questions: who is making the request (the sign-in method), and as whom the statement runs in SQL Server (identity pass-through, configured per alias). This page explains both and the combinations that are allowed; the detailed rules are in HTTP: sign-in (reference) and Identity pass-through and database identities (reference).

Key features

  • Sign-in with a service key, a Windows account, a SQL Server login, or a personal key.
  • A second factor according to a sign-in policy, by method, area, and network.
  • Statements run under the alias's login, the person's own login, or an assigned shared login; the person remains visible in the session context.

Core concepts

Identity pass-through to SQL Server

Building blocks: Persons with Service and Impersonate, the DenyImpersonate deny list with network conditions and TrustedProxies, the SQL Server login over HTTP Basic through its own connection, and the database identities from the administration store.

Guiding principle: toward the database, the service behaves like a direct connection of the person. This comes down to three properties you can verify. When a statement runs as the person, USER_NAME(), SUSER_SNAME(), and CURRENT_USER return the person—in column defaults, triggers, and views. SQL Server checks the person's permissions, and a denial comes back as 403, just as a direct connection would be refused. And SQL Server itself verifies a SQL Server login when its connection opens. Where this doesn't apply—service keys, or pass-through set to Service—the database sees the alias's login. To make this work, the service separates two questions:

  1. Who is calling? The sign-in method determines that.
  2. As whom does the statement run in SQL Server? The alias's configuration determines that.

This matters because databases evaluate the login themselves: column defaults fill in a value with USER_NAME() (such as „created by“), and triggers, views, and procedures read USER_NAME(), CURRENT_USER, SYSTEM_USER, or HOST_NAME(). With Service, all of them see the alias's login: a „modified by“ column names the service account, and a view that evaluates CURRENT_USER does so for the service account instead of the person.

Who is calling—the sign-in methods:

MethodIdentityVerified by
Service keyan applicationthe service
Personal keya person registered in administrationthe service, against the administration store
Windows (Negotiate)a Windows account with its groupsWindows (Kerberos or NTLM)
SQL Server login over HTTP Basica SQL Server login with name and passwordSQL Server itself, when the connection opens

The service doesn't accept an identity that an upstream proxy passes along in a header: as long as the service can also be reached without that proxy, anyone could set the header themselves.

As whom the statement runs—pass-through, configured per alias:

Pass-throughSQL Server seesRequirement
Service (default)the login from the alias's connection string—
Impersonatethe person: every statement in the request runs under EXECUTE AS LOGIN = '<login>' WITH COOKIEa login of the person's own—access through a group alone isn't enough (SQL Server refuses with error 15406); IMPERSONATE ANY LOGIN, or IMPERSONATE on the person's login, for the alias's login
separate connectionthe SQL Server login itself, through a connection with its credentialsAllowSqlLogins on the alias; only over a protected connection—see SQL Server login

How the alias's Persons setting works for each method:

MethodService (default)Impersonate
Service keythe alias's loginthe alias's login—a service key isn't a person and never switches
Personal keythe alias's loginthe SQL Server login recorded for the person in administration; without a recorded login, the alias's login, with the person in the session context—no 403
Windowsthe alias's loginthe account's Windows login in SQL Server; 403 if the account has no login of its own
SQL Server loginthe login's own connectionthe login's own connection—EXECUTE AS would bypass the password check

A database identity that a person chooses takes precedence over both settings (see database identities).

The person stays visible. When a person registered in administration signs in with a personal key or chooses a database identity, the service writes the person to the session context as read-only before every switch (SESSION_CONTEXT(N'wkl.person'), plus wkl.key and wkl.role)—under Service as well. When someone signs in with a Windows account or a SQL Server login, wkl.person stays empty, even if the account is assigned to a person; there, SQL Server identifies the person through SUSER_SNAME(), provided the statement runs as that person. There's no separate setting for this; the rules are under Row-level restriction.

en/wiki/data-conectivity/database-gateway/concepts/sign-in-and-identity.txt · Zadnja sprememba: uporabnika Wolfgang van der Stille