JWT Authentication
ipucu
This document describes the detailed usage of a specific policy. If you are using Apinizer policy structure for the first time or want to learn the general working principles of policies, we recommend that you first read the What is Policy? page.
Overview
What is its Purpose?
- Standardize centralized JWT generation: Gathers reliable JWT creation flow for different client types on Apinizer.
- Manage authentication sources: Makes Secret Manager, LDAP, Database, API, or OIDC-based authentication services selectable.
- Facilitate authorization integration: Coordinates role and method-based authorization on the same policy as JWT generation.
- Provide operational control: Provides audit and traceability by centrally controlling token durations, refresh rights, and header transfers.
Working Principle
- Request Arrival: For each HTTP/HTTPS request arriving at the API Gateway, the source IP address of the request is detected.
- Policy Check: If the JWT Authentication policy is active, the system checks in the following order:
- Is a Condition defined? If so, is the condition met?
- Is the policy active (active=true)?
- Is a Variable used or is Apinizer default?
- JWT Generation and Validation Process: Authentication source is triggered according to selected grant type, signing algorithm is applied, token lifetime and refresh rights are calculated.
- Decision Making:
- Match Found: Token is created or validated, redirected to target service with user/role headers added if necessary.
- No Match: Request is rejected with default or customized error message; refresh token generation/cancellation is not performed.
- Error Handling: Returns customizable HTTP status code and error message for requests that do not comply with the policy rule.
Features and Capabilities
Basic Features
- Grant Type Management: Quick switching between Client Credentials and Password grant types, automatic checking of required authentication components for each type.
- Identity Source Selection: Integrates Secret Manager, LDAP, Database, external API, or OIDC Provider sources into JWT generation process.
- Token Lifecycle Control: Detailed configuration and default value assignments for token lifetime, refresh right count, and durations.
- Active/Passive Status Control: Easily change the active or passive status of the policy (active/passive toggle). In passive state, the policy is not applied but its configuration is preserved.
- Conditional Application: Determine when the policy will be applied by creating complex conditions with Query Builder (e.g., only for specific endpoints or header values).