Who does mTLS authenticate, and who decides access?

In this order lookup, mTLS authenticates the Checkout and Orders services when they connect. The Orders service still checks whether the user may read the requested order.

Follow an order lookup

A signed-in customer wants to view order-42. This example illustrates an application design with a target named orders.read.

Checkout authenticates the user
Checkout or its gateway verifies the login session. Checkout sends the order ID and the verified user context using the application's internal identity mechanism.
CoAkka Runtime delivers the call
CoAkka Runtime resolves the route for orders.read and delivers the call over mTLS. The services authenticate each other with certificates when establishing the connection.
Orders checks access
The handler verifies the forwarded identity and checks permission to read order-42. It returns order data only when the user has access.

Read the outcome to see where to look

In this example, only the owner can view the order. Keep the order fixed and vary one condition at a time to see where each outcome comes from.

Situation What does the caller see? Where to look
The Orders certificate expired If the caller cannot authenticate the connection for an admitted request, it can receive a REMOTE_TRANSPORT_SECURITY_FAILED Deadletter. Check the connection diagnostic and the certificate in use.
The route table has no orders.read entry A ROUTE_MISS Deadletter for the missing target. Check the target name against the active route table.
The order belongs to another customer The connection and routing succeed. The handler returns an application denial and withholds order data. Check the verified identity and the application's authorization policy.
The customer has access The handler returns the order data. Check that the reply matches the requested order.

Pass verified user identity

The source name, target name, and order ID help correlate the call in logs. Orders bases access decisions on verified identity. Treat a user ID supplied by a browser as input that must be checked.

When multiple services call the same target

If Support also calls orders.read, apply the permissions of each service for the actions it can take on a user's behalf. If the application uses a signed token to carry that identity, the Orders service checks the signature, issuer, audience, and expiry before using the identity to decide access to the order.

References