İçeriğe geç

Aracılar · devam ediyor

Hizmetler için AgentPass

Açık onayla, parola veya oturum paylaşmadan bir AI aracısının kullanıcılarınızdan biri adına hareket etmesine izin verin. Identvia AgentPass v0.1 federasyon Authority’sidir; siteniz Service’tir.

Yapay zekâ ajanınız için istemi kopyalayın

Kodlama ajanı mı kullanıyorsunuz? Bu istem onu bu belgelere yönlendirir ve uyması gereken kuralları listeler. Yazdıklarını diğer kodlar gibi inceleyin.

You are helping me add "Sign in with Identvia" to my app (PHP). Identvia is an OpenID Connect provider.

Read these first (they are plain Markdown and are the source of truth; prefer them over anything you remember):
- https://id.identvia.com/developers/docs/quickstart.md
- https://id.identvia.com/developers/docs/oidc.md
- https://id.identvia.com/developers/docs/security.md
- Discovery: https://id.identvia.com/.well-known/openid-configuration

Stack: plain PHP 8.1+ (no framework). Use the official SDK identvia/identvia-php (composer require identvia/identvia-php, or the zip with vendor/ from https://id.identvia.com/developers/docs/php for hosts without Composer). Create identvia.php (config), login.php (redirectToSignIn), callback.php (handleCallback, then session_regenerate_id(true) and store sub) and logout.php. Read secrets from environment variables or a config file outside the web root.

Requirements:
1. Authorization code flow with PKCE (S256 only), a random state and a nonce per sign-in. No implicit flow.
2. Validate the ID token: RS256 signature from the JWKS, iss = https://id.identvia.com, aud contains my client_id, exp/iat, and the nonce.
3. Identify users by sub (it is pairwise: different for every app). Treat email as optional, because the person may choose not to share it.
4. Redirect URIs must match exactly. Keep the client secret and refresh tokens server-side; never log tokens.
5. Ask only for the scopes I need (openid, plus email/profile if used). Handle the user canceling (error=access_denied) gracefully.

Optional, only if I ask for AI-agent access later:
- AgentPass (agents acting for a user with single-use, holder-bound passes): https://id.identvia.com/developers/docs/agentpass.md
- MCP server for agent clients: https://id.identvia.com/developers/docs/mcp.md
- Token exchange, rich authorization requests and CIBA: https://id.identvia.com/developers/docs/delegation.md

Before writing code, tell me which files you will add or change. Don't invent endpoints or options that aren't in the docs; if something is unclear, ask me.

AgentPass v0.1 bir taslak spesifikasyondur ve değişebilir. Identvia, clerk/agentpass@937efe3’e sabitlenmiş sürümü uygular. Henüz geri alınamaz veya yüksek değerli işlemleri arkasına koymayın.

Nasıl çalışır

  1. Aracının harness’i Identvia’dan geçiş ister: hangi site, hangi kullanıcı, hangi görev, hangi tür (bearer_token veya browser_session) ve harness’in genel anahtarı.
  2. Identvia DNS ile sitenizi bulur, hangi izinlerin var olduğunu sorar ve isteği kullanıcının gelen kutusuna koyar. Kullanıcı izinleri seçer ve geçiş anahtarı veya kimlik doğrulama uygulamasıyla onaylar. Aracılar kendi isteklerini asla onaylayamaz.
  3. Harness bir kez, yalnızca siteniz için, 2 dakika içinde ve yalnızca harness anahtarıyla imzalı kanıtla geçerli bir geçiş alır.
  4. Siteniz geçişi bozar: Identvia ile kontrol eder, kanıtı doğrular ve kendi API jetonunu veya tek kullanımlık oturum açma bağlantısını verir.
  5. Aracı çalışırken siteniz en az her 60 saniyede yetkilendirmeyi yeniden kontrol eder. Kullanıcı Identvia’da iptal edince aracı durur.

PHP: identvia/agentpass-php

GitHub’da gör · Tüm SDK’ler

Herhangi bir PHP 8.1+ sitesi için MIT lisanslı kitaplık (çerçeve yok, paylaşımlı hostingde çalışır). AgentPass uç noktalarını sunar, DNS keşfi ve authority çözümlemesi yapar, geçişleri Authority ile doğrular, taşıyıcı kanıtını doğrular, bearer jeton veya tarayıcı oturumu verir ve sürekli kontrolleri çalıştırır (fail-closed).

PHP
$service = new AgentPass\Service\Service(new AgentPass\Service\ServiceConfig(
    origin: 'https://todo.example.com',
    signingKeyPem: file_get_contents(__DIR__ . '/agentpass-key.pem'),   // bin/agentpass-keygen
    trustedAuthorities: [AgentPass\Service\ServiceConfig::authority('https://id.identvia.com')],
    scopes: [['name' => 'todos:read', 'description' => 'See your todos'], ['name' => 'todos:write', 'description' => 'Add todos']],
    store: AgentPass\Service\Store\PdoStore::sqlite(__DIR__ . '/data/agentpass.sqlite'),
));
if ($service->handleGlobals()) { exit; }            // /agentpass-service/* uç noktaları

// API’nizde:
$d = $service->authenticateBearer($_SERVER['HTTP_AUTHORIZATION'] ?? '');
if (!$d->can('todos:write')) { /* 403 */ }

İndirme, bearer jetonları ve tarayıcı oturumlarını kabul eden eksiksiz bir demo todo hizmeti (examples/todo) içerir.

DNS kaydı

Authority’lerin yapılandırmanızı bulması için bir TXT kaydı yayımlayın:

DNS
_agentpass-service.todo.example.com.  TXT  "https://todo.example.com/agentpass-service/config.json"

Kurumsal etki alanları kendi Authority URL’siyle _agentpass.<domain> yayımlayabilir veya yetkilendirmeyi kapatmak için none. Identvia ve SDK bu önceliğe uyar.

Identvia’nın Authority uç noktaları

  • Yapılandırma: https://id.identvia.com/agentpass/ap
  • Veriliş: POST /agentpass/requests → durum bağlantılı 202; poll_after_ms’den hızlı yoklamayın.
  • Validate ve authorization-check: Service JWKS’indeki anahtarla imzalı kısa ömürlü ES256 assertion ile Service’ler tarafından çağrılır.

Sorumluluklarınız

  • Aracıyı kullanıcı adına hareket ediyor sayın ama etiketleyin: UI ve günlüklerde 「via agent」 gösterin.
  • Dar izinler sunun. Asla * sunmayın; Identvia da sunmaz.
  • checkCacheSeconds’i 60 veya altında tutun ve Authority’ye ulaşılamazsa fail-closed olun.
  • Görev açıklamasını aracının güvenilmez metni sayın.