# SculptureShops auth.md

## Audience

This document is for shopping, search, and customer-support agents acting on
behalf of a user at https://sculptureshops.com/. Public catalog content remains
available without authentication.

## Supported authentication methods

- Public browsing: no authentication.
- Agent API: OAuth 2.0 Authorization Code with PKCE (S256), provided by
  Cloudflare Access Managed OAuth. Bearer access tokens are sent in the
  `Authorization` request header.
- Supported scope: `agent-api:read` for the isolated read-only status endpoint.
- Existing customer accounts remain separate: browser-mediated WooCommerce
  login at https://sculptureshops.com/my-account/.

## Agent registration and provisioning

OAuth clients can use Dynamic Client Registration at the advertised
`register_uri`. Registration discovers a client identifier; it does not create
a WooCommerce customer account or authorize purchases.

```yaml
agent_auth:
  skill: https://sculptureshops.com/auth.md
  register_uri: https://cleverfreelancer.cloudflareaccess.com/cdn-cgi/access/oauth/registration
  identity_types_supported:
    - identity_assertion
  identity_assertion:
    assertion_types_supported:
      - verified_email
    credential_types_supported:
      - access_token
  claim_uri: https://cleverfreelancer.cloudflareaccess.com/cdn-cgi/access/oauth/authorization
    claim_uri: https://sculptureshops.com/cdn-cgi/access/get-identity
  registration_methods:
    - type: oauth_dynamic_client_registration
      http_method: POST
      user_action_required: true
      credential_types_supported:
        - oauth_bearer_access_token
      grant_types_supported:
        - authorization_code
        - refresh_token
      scopes_supported:
        - agent-api:read
      response_types_supported:
        - code
      code_challenge_methods_supported:
        - S256
      authorization_server: https://sculptureshops.com
      protected_resource_metadata: https://sculptureshops.com/.well-known/oauth-protected-resource
```

### Complete OAuth registration flow

1. Read Protected Resource Metadata at
   https://sculptureshops.com/.well-known/oauth-protected-resource.
2. Read Authorization Server Metadata from the advertised issuer at
   https://sculptureshops.com/.well-known/oauth-authorization-server. The
   authorization and token endpoints are operated by Cloudflare Access.
3. Register the client at the metadata document's `registration_endpoint`,
   using only redirect URIs controlled by the client. Registration is a
   consequential POST and must not be probed during passive discovery.
4. Start the Authorization Code flow with the RFC 8707 `resource` parameter,
   a PKCE S256 challenge, and a redirect URI registered to the client.
5. The authorized operator completes the browser-mediated email verification
   and consent step. Exchange the returned code at `token_endpoint` with the
   original PKCE verifier.
6. Send the access token only as `Authorization: Bearer <token>` to
   https://sculptureshops.com/agent-api/status. Do not put tokens in URLs.

## Credential use

OAuth access and refresh tokens are credentials. Keep them out of URLs, logs,
prompts, and persistent storage unless the client has a secure credential
store. Use TLS, send access tokens only in the Authorization header, validate
the resource/audience, and discard tokens when no longer needed. OAuth access
does not authorize checkout or other consequential storefront actions.

## OAuth metadata

OAuth Protected Resource Metadata:
https://sculptureshops.com/.well-known/oauth-protected-resource

OAuth Authorization Server Metadata (site discovery proxy):
https://sculptureshops.com/.well-known/oauth-authorization-server

Authorization Server Metadata:
https://sculptureshops.com/.well-known/oauth-authorization-server

This service advertises OAuth 2.0, not OpenID Connect. No `openid` scope or
ID Token is promised. The advertised JWKS contains the issuer's public signing
keys; Cloudflare Managed OAuth access tokens are opaque bearer credentials.
