본문으로 건너뛰기

에이전트 · 진행 중

서비스용 AgentPass

명시적 승인 하에 비밀번호나 세션을 공유하지 않고 AI 에이전트가 사용자 대신 행동하게 합니다. Identvia는 AgentPass v0.1 연합 Authority이고 사이트는 Service입니다.

AI 에이전트용 프롬프트 복사

코딩 에이전트를 사용하나요? 이 프롬프트는 에이전트가 이 문서를 참고하도록 하고 반드시 지켜야 할 규칙을 알려 줍니다. 에이전트가 작성한 코드도 다른 코드처럼 검토하세요.

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은 초안 사양이며 바뀔 수 있습니다. Identvia는 clerk/agentpass@937efe3에 고정된 버전을 구현합니다. 아직 되돌릴 수 없거나 고가치 작업을 그 뒤에 두지 마세요.

작동 방식

  1. 에이전트 harness가 Identvia에 패스를 요청: 어떤 사이트·누구·어떤 작업·어떤 종류(bearer_token 또는 browser_session)와 harness 공개 키.
  2. Identvia는 DNS로 사이트를 찾고 어떤 권한이 있는지 물은 뒤 요청을 사용자 받은편지함에 넣습니다. 사용자가 권한을 고르고 패스키 또는 인증 앱으로 승인합니다. 에이전트는 자신의 요청을 승인할 수 없습니다.
  3. Harness는 한 번, 당신 사이트만, 2분 이내, harness 키로 서명한 증명과 함께만 유효한 패스를 받습니다.
  4. 사이트가 패스를 상환: Identvia에서 확인하고 증명을 검증한 뒤 자체 API 토큰 또는 일회용 로그인 링크를 발급합니다.
  5. 에이전트가 일하는 동안 사이트는 최소 60초마다 위임을 재확인합니다. 사용자가 Identvia에서 취소하면 에이전트가 멈춥니다.

PHP: identvia/agentpass-php

GitHub에서 보기 · 모든 SDK

모든 PHP 8.1+ 사이트용 MIT 라이선스 라이브러리(프레임워크 없음, 공유 호스팅 가능). AgentPass 엔드포인트, DNS 디스커버리와 authority 해석, Authority에서의 패스 검증, 보유자 증명 검증, bearer 토큰 또는 브라우저 세션 발급, 지속 검사(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/* 엔드포인트

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

다운로드에는 bearer 토큰과 브라우저 세션을 받는 완전한 데모 todo 서비스(examples/todo)가 포함됩니다.

DNS 레코드

Authority가 구성을 찾도록 TXT 레코드 하나를 게시하세요:

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

엔터프라이즈 도메인은 자체 Authority URL로 _agentpass.<domain>를 게시하거나 위임을 끄려면 none을 쓸 수 있습니다. Identvia와 SDK는 그 우선순위를 존중합니다.

Identvia의 Authority 엔드포인트

  • 구성: https://id.identvia.com/agentpass/ap
  • 발급: POST /agentpass/requests → 상태 링크와 함께 202. poll_after_ms보다 빠르게 폴링하지 마세요.
  • Validate와 authorization-check: Service JWKS의 키로 서명한 단기 ES256 어서션으로 Service가 호출합니다.

당신의 책임

  • 에이전트를 사용자를 위해 행동하는 것으로 다루되 라벨: UI와 로그에 「via agent」를 표시하세요.
  • 좁은 권한을 제공하세요. 절대 *를 제공하지 마세요. Identvia도 하지 않습니다.
  • checkCacheSeconds를 60 이하로 두고 Authority에 닿지 못하면 fail-closed.
  • 작업 설명은 에이전트의 신뢰할 수 없는 텍스트로 다루세요.