# auth.md

KaliteliWebsite, otomatik (ajan) erişim için OAuth 2.0 tabanlı kimlik doğrulamayı destekler.
Bu belge, ajanların API'lere nasıl kayıt olup token alacağını açıklar.

## Kaynak (Resource)

- **Resource identifier:** https://kaliteliwebsite.com
- **Audience:** https://kaliteliwebsite.com
- **Yetkilendirme sunucusu:** https://kaliteliwebsite.com/.well-known/oauth-authorization-server
- **Korunan kaynak metadata:** https://kaliteliwebsite.com/.well-known/oauth-protected-resource

## Kayıt (Registration)

Ajanlar, OAuth 2.0 Dynamic Client Registration (RFC 7591) ile kayıt olur:

```
POST https://kaliteliwebsite.com/api/oauth/register
Content-Type: application/json

{
  "client_name": "my-agent",
  "grant_types": ["client_credentials"],
  "scope": "agent:read catalog:read content:read"
}
```

Yanıt `client_id` ve `client_secret` içerir.

## agent_auth (makine-okunur)

Aşağıdaki `agent_auth` bloğu /.well-known/oauth-authorization-server metadata'sında da yayınlanır.

```json
{
  "agent_auth": {
    "skill": "https://kaliteliwebsite.com/auth.md",
    "register_uri": "https://kaliteliwebsite.com/api/oauth/register",
    "identity_endpoint": "https://kaliteliwebsite.com/api/oauth/register",
    "claim_endpoint": "https://kaliteliwebsite.com/api/oauth/claim",
    "events_endpoint": "https://kaliteliwebsite.com/api/oauth/events",
    "revocation_uri": "https://kaliteliwebsite.com/api/oauth/revoke",
    "registration_methods_supported": [
      "oauth-dynamic-client-registration"
    ],
    "identity_types_supported": [
      "identity_assertion",
      "service_auth",
      "anonymous"
    ],
    "identity_assertion": {
      "assertion_types_supported": [
        "urn:ietf:params:oauth:token-type:id-jag"
      ],
      "credential_types_supported": [
        "jwt"
      ]
    },
    "credential_types_supported": [
      "client_secret",
      "jwt"
    ],
    "events_supported": [
      "https://schemas.workos.com/events/registration.revoked",
      "https://schemas.workos.com/events/credential.revoked"
    ]
  }
}
```

## Token alma (client_credentials)

```
POST https://kaliteliwebsite.com/api/oauth/token
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials&client_id=...&client_secret=...&scope=agent:read+catalog:read+content:read
```

Yanıt, RS256 ile imzalanmış bir `access_token` (JWT) döner. İmza doğrulaması için
public anahtarlar: https://kaliteliwebsite.com/.well-known/jwks.json

## Kimlik bilgisi kullanımı

Erişim token'ı, korumalı uç noktalara `Authorization: Bearer <token>` başlığıyla
gönderilir. Bu sitenin ajan API'si salt-okunurdur; token'lar ajanı tanımlamak ve
hız sınırı (rate limit) uygulamak için kullanılır.

## Desteklenen yöntemler

- OAuth 2.0 Client Credentials (JWT Bearer)
- Anonim erişim (token gerektirmeyen salt-okunur MCP araçları): https://kaliteliwebsite.com/mcp
- A2A (Agent2Agent) protokolü: https://kaliteliwebsite.com/a2a

## Ajan keşif uçları

- A2A Agent Card: https://kaliteliwebsite.com/.well-known/agent-card.json
- MCP Server Card: https://kaliteliwebsite.com/.well-known/mcp/server-card.json
- Agent Skills: https://kaliteliwebsite.com/.well-known/agent-skills/index.json
- API kataloğu: https://kaliteliwebsite.com/.well-known/api-catalog
