HTTP Permissions-Policy publickey-credentials-create

Typ

Die publickey-credentials-create-Direktive steuert die Erstellung von WebAuthn-Credentials für Passkey-Registrierung.

Syntax

Die Direktive definiert eine Allowlist für Ursprünge, die neue WebAuthn-Credentials erstellen dürfen.

http
Permissions-Policy: publickey-credentials-create=(self)
Permissions-Policy: publickey-credentials-create=(self "https://auth.example.com")
Permissions-Policy: publickey-credentials-create=()

Direktiven

Die Direktive unterstützt Standard-Allowlist-Werte für präzise Zugriffssteuerung.

self
Erlaubt Credential-Erstellung nur für das Hauptdokument des gleichen Ursprungs. Eingebettete iFrames von anderen Ursprüngen werden blockiert.
origin-list
Liste von Ursprüngen in Anführungszeichen, z.B. "https://registration.auth-provider.example.com", die zusätzlich zum Hauptdokument Credentials erstellen dürfen. Für Auth-Service-Widgets.

Beispiele

Die folgenden Beispiele zeigen typische Anwendungsfälle für Passkey-Registrierung und FIDO2-Setup.

Passkey-Registrierung bei Account-Setup

Eine Registration-Seite nutzt WebAuthn für passwortlose Passkey-Erstellung.

http
HTTP/1.1 200 OK
Content-Type: text/html
Permissions-Policy: publickey-credentials-create=(self)

<!DOCTYPE html>
<html>
<head><title>Create Account</title></head>
<body>
  <button id="register">Register with Passkey</button>
  <script>
    document.getElementById('register').addEventListener('click', async () => {
      const credential = await navigator.credentials.create({
        publicKey: {
          challenge: new Uint8Array(32),
          rp: {name: 'Example Corp', id: 'example.com'},
          user: {id: new Uint8Array(16), name: 'user@example.com', displayName: 'User'},
          pubKeyCredParams: [{type: 'public-key', alg: -7}]
        }
      });
      // Send credential to server
    });
  </script>
</body>
</html>

Enterprise-Portal mit SSO-Registration-Widget

Ein Enterprise-Portal erlaubt einem SSO-Provider Passkey-Registrierung für Mitarbeiter.

http
HTTP/1.1 200 OK
Content-Type: text/html
Permissions-Policy: publickey-credentials-create=(self "https://sso.corp.example.com")

<!DOCTYPE html>
<html>
<head><title>Employee Onboarding</title></head>
<body>
  <iframe src="https://sso.corp.example.com/register-passkey"
          allow="publickey-credentials-create"></iframe>
</body>
</html>

REST-API ohne Credential-Creation

Ein API-Endpunkt deaktiviert Credential-Erstellung für reine Authentication-Flows.

http
HTTP/1.1 200 OK
Content-Type: application/json
Permissions-Policy: publickey-credentials-create=()

{
  "status": "success",
  "registration_complete": true
}

Vorteile für die Systemarchitektur

  • Ermöglicht passwortlose Authentifizierung mit FIDO2-Passkeys
  • Verhindert unerwünschte Credential-Erstellung durch Drittanbieter
  • Unterstützt Hardware-Token-Registrierung (YubiKey, etc.)
  • Reduziert Phishing-Risiken durch kryptografische Authentifizierung

Spezifikation

Definiert in der W3C Web Authentication (WebAuthn) API Spezifikation. Erfordert HTTPS und User-Gesture. Unterstützt Platform- und Cross-Platform-Authenticators.

Weitere Spezifikationen

Permissions-Policy Header, Content-Security-Policy Header