Open Source API Gateway

requireAuth

Version

Requires a valid access token for the request, accepted either as a Bearer JWT (validated directly against the configured oauth2 client's JWKS) or, when no bearer token is present, via that client's normal session/login flow. After a successful session flow the request still passes through JWT validation before continuing.

Syntax

requireAuth:
expectedAud: <string> # required
oauth2: <string> # required
errorStatus: <int>
expectedTid: <string>
required: <boolean>
scope: <string>
requireAuth:
  expectedAud: <string> # required
  oauth2: <string> # required
  errorStatus: <int>
  expectedTid: <string>
  required: <boolean>
  scope: <string>

Attributes

NameRequiredDefaultDescriptionExamples
errorStatusfalse-HTTP status code to answer with, instead of redirecting the browser to the login page, when the request carries no usable session.-
expectedAudtrue-Expected aud (audience) claim value that a presented JWT must contain.-
expectedTidfalse-Expected value of the tid (tenant ID) claim of a presented JWT, for identity providers that issue tokens per tenant.-
oauth2true-The oauth2 client interceptor supplying the JWKS and the session/login flow used when no bearer token is present.-
requiredfalsetrueWhether authentication is enforced. When false, a request that fails the oauth2 session/redirect flow is allowed to continue anyway.-
scopefalse-OAuth2 scope the access token is requested for. A session that holds no token for this scope triggers a login or a refresh.-

Can be used in