What it does
For each request on a route with enforcement configured, the product:
- reads the bearer token from the
Authorizationheader; - builds a permission check with the subject derived from token claims, the
resourceconfigured for the route, and theactionconfigured for the route; - sends that check to Auth;
- continues with the product handler when Auth returns an authorized decision;
- rejects the request with the appropriate HTTP or gRPC error when Auth denies it;
- uses token claims according to the product’s own tenant-aware integration when required.
POST /transactions with the resource transactions and action post. Auth decides whether the subject in the bearer token has that permission.
Permission model
Access Manager evaluates the core permission decision with three values:
Human authorization evaluates permissions embedded in identity data. Groups can organize permissions, and users can also receive direct user permissions.
For a normal user token, the middleware derives the subject from its
owner and sub claims. Unless the product configures local JWT verification, lib-auth parses those claims without signature verification; the authorization round trip to Auth is the trust anchor. Machine-to-machine authorization depends on AUTH_M2M_INVERSION_ENABLED. With its default value of false, the middleware derives a product-scoped admin/<product>-editor-role subject for any non-user token type and does not consult that token’s sub. With true, it uses the application’s token sub identity and rejects unknown token types.
Tenant IP allowlist
Identity stores each tenant’s IP allowlist and the surfaces where it applies. A non-empty list is enforced only on explicitly selected scopes:console for human traffic and api for machine traffic. With no selected scope, the list remains stored but is inert. Configure trusted proxies in the product integration so lib-auth forwards the resolved client IP, and configure TRUSTED_PROXIES in Auth before enforcing a list behind a proxy. The gate runs before Auth’s permission cache; tokens marked as internal bypass it. An empty list, a missing or unusable client IP, an untrusted proxy, or unavailable allowlist data does not deny the request.
A token is internal when it carries the isInternal claim with the value true. Casdoor issues that claim only for applications that the platform provisions as internal Lerian services; the client-facing application API cannot set it. The bypass skips only the allowlist gate: Auth still validates the token against Casdoor before it authorizes the request, so a forged internal marker on an invalid token does not grant access.
In deployments where platform services call Casdoor from cluster networks, configure PLATFORM_INTERNAL_CIDRS in Identity with those CIDRs. Identity co-stores those ranges only while a tenant list exists so Casdoor’s native checks allow platform traffic; Auth subtracts them from the tenant policy before enforcement.
Resource and action names
Resource and action names are exact strings. They must match the values configured for the product route, and the route sends those configured values to Auth. Most API products use HTTP-method-style actions:
Some products use semantic actions when the route is not best described by an HTTP method:
Use Retrieve User Permissions to inspect the effective resources and actions available to the authenticated user.
Request flow
- Receive the request
- The product reads the bearer token from the
Authorizationheader. - If the token is missing or malformed, the request is rejected before any permission check is attempted.
- The product reads the bearer token from the
- Build the permission check
- The product uses the resource and action configured for the route.
- In tenant-aware deployments, the product applies its own configured tenant integration. Do not infer a universal
tenantId-only authorization contract from this route-level flow.
- Ask Auth
- The product calls Auth with the subject, resource, and action. Depending on its integration, it can also forward product and client-IP context.
- Auth evaluates the request against the configured Access Manager permissions and may serve the answer from cache.
- Apply the decision
- On authorized, the product continues to its handler.
- On denied, the product returns the appropriate HTTP or gRPC error and does not invoke business logic.
Where this fits
When a product configures route-level enforcement, it sits between the network and the product handler. With an enabled and configured Auth client, Auth evaluates authorization before the handler runs. An authorized subject still needs the right resource-action permission to reach a specific operation and can be denied by a tenant IP allowlist active for that request’s scope. Auth can serve authorization decisions from cache. On the management side of this picture, see the Identity service. The runtime decision side is handled by the Auth service. For the day-to-day workflow against the APIs, see Using Access Manager.

