API Gateway Authentication - 5 Strategies and Real Life Examples
API Gateway Authentication - 5 Strategies and Real Life Examples
One common use case for an API gateway is to provide an additional layer of
security for your backend services. This can be achieved through various forms of
authentication, including user-password credentials, key-based authentication,
LDAP, and authentication protocols like OAuth or OIDC.
Authentication is important for both internal and external APIs. Internal APIs can
use authentication to implement fine-grained access control over the microservices,
allowing for more secure and controlled access to resources.
For external APIs, authentication is critical because it helps to ensure that only
authorized external clients, such as web and mobile apps, are able to access the
resources they need. This helps to protect the API and its underlying resources
from unauthorized access, data breaches, and denial of service attacks, which can
be initiated by unauthorized clients. External APIs can use authentication to
implement access controls, track usage and monitor how resources are being
consumed, which can aid in compliance and security incident investigations.
Key-based authentication
With API key authentication, a client includes a unique key in the request header
or as a query parameter, and the API gateway checks that the key is valid. API keys
can be generated and managed by the API provider or by an external system like a
token management service. This approach is useful for HTTP APIs.
LDAP authentication
LDAP (Lightweight Directory Access Protocol) is a widely used protocol for storing
and querying authentication information. With LDAP authentication, the API gateway
can validate client credentials by checking them against an LDAP server, which acts
as a central repository for user information. This can be useful in situations
where you want to authenticate clients against an existing corporate user
directory.
OAuth authentication
OAuth 2.0 is a widely used standard for delegating access to resources. With OAuth
2.0, a client obtains an access token from an authorization server, and then
includes that token in each subsequent request to the API gateway. The API gateway
can then validate the token and determine the client’s level of access. This can be
useful in situations where you want to give third-party apps or services limited
access to your API. However, it only works with HTTPS requests.
OIDC authentication
OpenID Connect (OIDC) is a widely used standard built on top of OAuth 2.0. It
provides a way to authenticate clients and obtain user information in a single
request. With OpenID Connect, a client obtains an ID token from an authorization
server, in addition to an access token, which can be used to authenticate the
client and access user information. OpenID Connect can be useful in situations
where you want to obtain user information in addition to authenticating clients.
More details about authentication within Gloo Gateway can be found here and here.