All Products
Search
Document Center

Microservices Engine:Configure OIDC authentication

Last Updated:Mar 11, 2026

When multiple backend services each implement their own authentication logic, you face duplicated code, inconsistent security policies, and complex maintenance. A cloud-native gateway solves this by centralizing OpenID Connect (OIDC) authentication at the gateway layer -- the gateway handles token validation, session management, and login redirects so that backend services receive only pre-authenticated requests. This strengthens system security and provides a more flexible security policy configuration. Single sign-on (SSO) is also supported across all services behind the gateway.

Prerequisites

Before you begin, make sure that you have:

  • An identity provider (IdP) that supports the standard OIDC protocol

  • The following information from your IdP:

ItemDescription
Issuer URLThe base URL for the .well-known/openid-configuration discovery endpoint. The gateway uses this URL to automatically retrieve the IdP's authorization, token, and userinfo endpoints.
Client IDThe application identifier assigned during IdP registration
Client secretThe application secret assigned during IdP registration
Redirect URLA callback URL registered in the IdP. The path must be /oauth2/callback. Format: https://yourdomain/oauth2/callback

OIDC authentication flow

Standard OIDC flow

In a standard OIDC setup, four roles interact:

RoleDescription
ClientThe application that serves end users (for example, a browser or mobile app)
Authorization serverThe OpenID provider that authenticates users and issues ID tokens
Business serverThe backend service that provides business logic
End userThe resource owner -- the person who accesses the application

OIDC extends OAuth 2.0 by adding an ID token -- a JSON Web Token (JWT) that carries user identity information in a self-contained, tamper-proof format.

Standard OIDC authentication flow

The standard flow works as follows:

  1. The client sends an authentication request to the authorization server.

  2. The end user enters credentials on the authorization page and confirms the request.

  3. The authorization server validates the request and returns an authorization code to the client.

  4. The client sends a callback request with the authorization code to the business server.

  5. The business server sends the authorization code, client ID, and client secret to the authorization server.

  6. The authorization server validates the request and returns an ID token.

  7. The business server forwards the ID token to the client.

  8. The client includes the ID token in subsequent business requests to the business server.

  9. The business server validates the ID token and returns a business response.

In this model, each business server must independently connect to the authorization server to validate tokens -- creating duplicated integration effort.

Gateway-based OIDC flow

When a cloud-native gateway handles OIDC authentication, the gateway replaces the business server in the token exchange. The authorization server becomes transparent to backend services -- they only receive pre-validated requests.

Cloud-native gateway OIDC authentication flow

The gateway-based flow works as follows:

  1. The client sends a request to the gateway.

  2. The gateway redirects the client to the authorization server.

  3. The authorization server authenticates the user and returns an authorization code to the gateway.

  4. The gateway sends the authorization code back to the client.

  5. The client sends a callback request with the authorization code to the gateway.

  6. The gateway sends the authorization code, client ID, and client secret to the authorization server.

  7. The authorization server validates the request and returns an ID token.

  8. The gateway sends the ID token to the client.

  9. The client includes the ID token in subsequent business requests to the gateway.

  10. The gateway validates the ID token and forwards the request to the appropriate backend service.

  11. The backend service processes the request and returns a response to the gateway.

  12. The gateway forwards the response to the client.

For unauthenticated or invalid requests, the gateway automatically redirects the client to the authorization server's login page.

Create an authentication rule

  1. Log on to the MSE console.

  2. In the left-side navigation pane, choose Cloud-native Gateway > Gateways. In the top navigation bar, select a region.

  3. On the Gateways page, click the gateway ID.

  4. In the left-side navigation pane, choose Security Management > Global Authentication.

  5. In the upper-left corner of the page that appears, click Create Authentication. In the Create Authentication panel, configure the following parameters, and then click OK.

ParameterDescription
Authentication NameA name for the authentication rule.
Authentication TypeSelect OIDC.
IssuerThe issuer identifier from your IdP. This is the base URL used for OIDC discovery (the .well-known/openid-configuration endpoint).
Redirect URLThe URL that the authorization server redirects to after authentication completes. Format: http(s)://yourdomain/oauth2/callback. The path must be /oauth2/callback, and this URL must match the redirect URL registered in your IdP.
Client-IDThe application ID from your IdP's registration information.
Client-SecretThe application secret from your IdP's registration information.
Cookie-DomainThe domain to which the session cookie is sent after authentication. Set to a.example.com to send the cookie only to that specific host, or .example.com to send it to all subdomains of example.com.
ScopeThe OIDC scopes to request. Separate multiple values with semicolons (;).
AuthorizationThe access control mode: Whitelist -- Only requests matching specified hostnames and paths bypass authentication. All other requests require authentication. Blacklist -- Only requests matching specified hostnames and paths require authentication. All other requests bypass authentication. Click + Rule Condition to add entries. For each entry, specify a Domain Name and a Path.

Create an authentication route

After the authentication rule is created, create a route to handle the OIDC callback. For step-by-step instructions, see Create a routing rule.

Configure the following parameters for the authentication route:

ParameterValue
Domain NameSelect the domain name from the Redirect URL of the authentication rule. If no domain name is configured, select *.
PathSelect Prefix and enter /oauth2.
Destination ServiceSet to oauth2-proxy.
Important

For HTTPS requests, configure a domain name and associate it with the route.

Verify the authentication rule

Return to the Global Authentication page. If the new authentication rule appears in the list, the configuration is complete.

View authentication rule details

  1. Log on to the MSE console.

  2. In the left-side navigation pane, choose Cloud-native Gateway > Gateways. In the top navigation bar, select a region.

  3. On the Gateways page, click the gateway ID.

  4. In the left-side navigation pane, choose Security Management > Global Authentication.

  5. Click the name of an authentication rule, or click Details in the Actions column. The details page shows the current authentication configuration and authorization information.

Authentication rule details

In the Authorization Information section, click Add Authorization Information to add new entries. Specify the Request Domain Name, Request Path, and matching mode, and then click OK.

Manage authentication rules

On the Global Authentication page, find the target authentication rule and use the following actions in the Actions column:

ActionDescription
EnableActivate the authentication rule.
DisableDeactivate the authentication rule.
EditModify the authentication rule settings.
DeleteRemove the authentication rule. You must disable the rule before deletion.

References

For an overview of all supported authentication mechanisms, see Gateway authentication overview.