# `AshScim.Router`
[🔗](https://github.com/ash-project/ash_scim/blob/main/lib/ash_scim/router.ex#L5)

A `Plug` that exposes Ash resources as a SCIM 2.0 server.

## Quick start

Either plug it directly into a pipeline:

    plug AshScim.Router,
      domains: [MyApp.Accounts],
      auth: {AshScim.Auth.StaticBearer, tokens: ["dev-secret"]}

Or wrap it in your own module so config lives next to your app:

    defmodule MyApp.Scim do
      use AshScim.Router,
        domains: [MyApp.Accounts],
        auth: {AshScim.Auth.StaticBearer, tokens: {:env, "SCIM_TOKEN"}}
    end

    # in your endpoint/router
    forward "/scim/v2", MyApp.Scim

## Options

  * `:domains` — list of Ash domains to scan for resources carrying the
    `AshScim.User` or `AshScim.Group` extensions.
  * `:resources` — alternative to `:domains` if you want to enumerate
    resources explicitly.
  * `:auth` — `{module, opts}` implementing `AshScim.Auth`.
  * `:base_url` — used to populate `meta.location` in encoded resources.
    If omitted, `meta.location` is not emitted.

## Endpoints

  * `GET    /<type>` — list (supports `?filter=…` and `?count=…&startIndex=…`)
  * `GET    /<type>/:id`
  * `POST   /<type>`
  * `PUT    /<type>/:id` — full replace
  * `DELETE /<type>/:id`
  * `GET    /ServiceProviderConfig`

`<type>` is the configured `path` from each resource's `scim` section
(defaults: `Users`, `Groups`).

PATCH support and the `/Schemas` & `/ResourceTypes` discovery endpoints
are forthcoming.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
