# Authz Casdoor Configuration

The `authz-casdoor` plugin protects APISIX and API7 Gateway routes with browser-based OAuth sign-in through Casdoor.<!-- --> <!-- -->Configuration covers static settings and plugin parameters.

## Static Configurations[​](#static-configurations "Direct link to Static Configurations")

The plugin does not expose a shared session secret. Its session library generates a different encryption key in each gateway worker process. Configure one worker process on every gateway instance so later requests can read the session cookie.

* Host or Docker
* API7 Gateway Helm
* APISIX Helm

config.yaml

```
nginx_config:

  worker_processes: 1
```

Reload or restart the gateway after updating `config.yaml`.

values.yaml

```
nginx:

  workerProcesses: 1
```

Apply the values through the gateway release's normal Helm upgrade workflow.

values.yaml

```
apisix:

  nginx:

    workerProcesses: 1
```

Apply the values through the APISIX release's normal Helm upgrade workflow.

When multiple gateway instances serve the route, configure load-balancer affinity so a browser remains on the same instance for the complete authentication flow and session. Otherwise, a callback or later request can reach an instance that cannot read the cookie and return `503 Service Unavailable` or start another sign-in flow. This requirement complicates horizontal scaling; assess it before production use.

## Parameters[​](#parameters "Direct link to Parameters")

See plugin [common configurations](https://docs.api7.ai/apisix/reference/plugin-common-configurations.md) for configuration options available to all plugins.

* endpoint\_addr

  string

  required

  valid value:

  An HTTP or HTTPS URL without a trailing slash or query string

  ***

  Base URL of the Casdoor server. The plugin redirects users to this address for sign-in and sends authorization-code exchanges to the same address.

  The address must be reachable by both users' browsers and every gateway instance.

* client\_id

  string

  required

  ***

  OAuth client ID of the Casdoor application registered for the gateway.

* client\_secret

  string

  required

  ***

  OAuth client secret of the Casdoor application registered for the gateway.

  API7 Gateway encrypts the value with AES at rest. APISIX encrypts it before etcd storage when `apisix.data_encryption.enable_encrypt_fields` is enabled.

* callback\_url

  string

  required

  valid value:

  An HTTP or HTTPS URL without a trailing slash or query string

  ***

  Absolute URL where Casdoor returns the browser after authorization. Configure the same URL as a redirect URI on the Casdoor application.

  The callback path must be matched by a route on which this plugin is configured.
