Skip to main content
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

Backend API Authentication policy defines the authentication credentials that API Gateway will use when accessing backend services. It establishes secure connections to backend systems by supporting different authentication methods such as Plain-Text, Basic, API Key, and Digest. Ideal for centrally managing different authentication requirements of each service in microservice architectures.

What is its Purpose?

  • Ensures authentication credentials are automatically added to calls made to backend API services, eliminating the need for manual credential management for each request.
  • Supports four different authentication types: Basic, Digest, Base64, and custom API Authentication, and allows conditional username/password definitions.
  • Enables authentication information to be transmitted to backend via HTTP Header, URL Parameter, Body Message, or Body Injection methods.
  • Provides message content support in XML and JSON formats, working compatibly with both SOAP and REST services.
  • Different user information can be used in different scenarios (e.g., based on environment, endpoint, header value) thanks to condition-based credential management.

Working Principle

  1. Request Arrival: For each HTTP/HTTPS request arriving at API Gateway, it is checked whether authentication information needs to be added before the request is routed to backend service.
  2. Policy Check: If API 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 used?
  3. Authentication Type Selection: Appropriate credentials are prepared according to the defined Auth Type (API, BASIC, BASE64, DIGEST). If Conditional Expression is defined, correct username/password is selected according to conditions.
  4. Decision Making:
    • If Condition is Met: Relevant credential information is added to backend call with selected Send Type method (Header, Param, Body Message, Body Injection) and request is forwarded.
    • If Condition is Not Met or Credential Not Found: Request is rejected and customizable error message is returned.
  5. Error Handling: Customizable HTTP status code and error message are returned for requests that do not comply with policy rules.

Features and Capabilities

Basic Features

  • Four Different Authentication Types: Support for API (ready auth service), Basic Authentication, Base64 encoded Authorization, Digest Authentication.
  • Conditional Credential Management: Ability to make dynamic credential selection based on environment, endpoint, or header value by defining separate conditions for each username/password pair.
  • Four Different Transmission Methods: Ability to send credentials to backend via HTTP Header, URL Parameter, Body Message, or Body Injection methods.
  • XML and JSON Support: Support for both XML (SOAP) and JSON (REST) formats in body-based authentication and ability to perform XPath/JSONPath injection.
  • API Authentication Integration: Ability to perform centralized credential management using pre-defined Authentication API services.
  • Active/Passive Status Control: Easily change policy’s active or passive status (active/passive toggle). Policy is not applied in passive state but its configuration is preserved.
  • Condition-Based Application: Determine when the policy will be applied by creating complex conditions with Query Builder (e.g., only for specific endpoints or header values).

Advanced Features

  • Dynamic Field Name and Injection Path Definition: Create flexible authentication configuration by customizing field names and paths for header, parameter, or body injection.
  • Digest Authentication Support: Ability to perform Digest authentication with advanced security parameters such as nonce, created timestamp (SOAP WS-Security compatible).
  • Body Message Template Support: Create quick SOAP/REST authentication configuration using ready body message templates for XML and JSON.
  • XPath and JSONPath Test Tool: Ability to test and validate body injection and message paths live.
  • Username Expression Table: Ability to perform multi-scenario credential management by defining multiple username/password pairs and setting different conditions for each.
  • Export/Import Feature: Export policy configuration as ZIP file. Import to different environments (Development, Test, Production). Version control and backup capability.
  • Policy Group and Proxy Group Support: Manage multiple policies within Policy Group. Bulk policy assignment to Proxy Groups. Centralized updates and deploy operations.
  • Deploy and Versioning: Deploy policy changes to live environment. See which API Proxies use it (Policy Usage). Proxy Group and Policy Group usage reports.

Usage Scenarios

Configuring Policy Parameters

In this step, users can create a new policy or configure existing policy parameters to define access rules. Defined parameters directly affect how the policy works (e.g., which IPs will be allowed, geographical restrictions, conditional activations, etc.). This allows the policy to be customized according to organization-specific requirements and managed centrally.

Creating New API Authentication Policy

Backend API Authentication Policy Configuration

Configuration Steps

For descriptions of Conditions and Error Message Customization panels, you can review the Conditions and Error Message Customization (Error Message Customization) sections on the What is Policy? page. For a complete guide on all layers, priority order and scenario examples of the error message configuration system, see the Error Message Configuration Guide page.

Deleting Policy

For deletion steps of this policy and operations to be applied when in use, you can refer to the Removing Policy from Flow section on the Policy Management page.

Exporting/Importing Policy

For export (Export) and import (Import) steps of this policy, you can refer to the Export/Import page.

Binding Policy to API

For the process of how this policy will be bound to APIs, you can refer to the Binding Policy to API section on the Policy Management page.

Advanced Features

Tips and Best Practices

Things to Do and Best Practices

Security Best Practices

Things to Avoid

Performance Tips

Frequently Asked Questions (FAQ)