Http

Cloud Agnostic
Open Source

Validates tenant membership by calling an external HTTP endpoint. The plugin sends the user ID and tenant ID to your validation service, which responds with 200 OK to allow or 403 Forbidden to reject. Use this when tenant membership is managed outside of the identity provider.

Source code: Notiway.Plugins.Portable.TenantValidation.Http

Compatibility

Compatible withAll Buffer, Broker, Storage, Auth, and Host plugins
ProductNotiway Notify

Installation

Environment Variables

VariableRequiredDefaultDescription
Infra__Plugins__TenantValidation__NameYesSet to Http
Infra__Plugins__TenantValidation__VersionYesPlugin version (e.g., 0.9.0)
Infra__Plugins__TenantValidation__Config__ValidationEndpointYesURL of the HTTP endpoint to call for tenant validation (e.g., https://api.example.com/validate-tenant)

Infrastructure

  1. Deploy an HTTP validation endpoint that is accessible from the Notiway instance.
  2. The endpoint must accept POST requests with user and tenant information and respond with 200 OK (allow) or 403 Forbidden (reject).

Docker Compose

docker-compose.yml
services:
  notiway:
    image: notiway/notify:portable-0.6.0
    ports:
      - "5000:8080"
    environment:
      - Infra__Plugins__TenantValidation__Name=Http
      - Infra__Plugins__TenantValidation__Version=0.9.0
      - Infra__Plugins__TenantValidation__Config__ValidationEndpoint=https://api.example.com/validate-tenant

Usage

Implement a validation endpoint in your backend that checks whether a user belongs to the requested tenant. Return 200 OK to allow the subscription or 403 Forbidden to reject it.

app.MapPost("/validate-tenant", (HttpRequest request) =>
{
    var userId = request.Query["userId"];
    var tenantId = request.Query["tenantId"];

    var isMember = CheckTenantMembership(userId, tenantId);
    return isMember ? Results.Ok() : Results.Forbid();
});
app.post("/validate-tenant", (req, res) => {
    const { userId, tenantId } = req.query;

    const isMember = checkTenantMembership(userId, tenantId);
    res.sendStatus(isMember ? 200 : 403);
});
@app.post("/validate-tenant")
def validate_tenant(userId: str, tenantId: str):
    is_member = check_tenant_membership(userId, tenantId)
    if is_member:
        return Response(status_code=200)
    return Response(status_code=403)