A function-invocation filter skips `next` when the bearer is missing or userinfo rejects it. The function runs only on the path that calls `next`.

Getting started, including the planned sample, is [Semantic Kernel](/docs/agent-frameworks/semantic-kernel).

## What fails closed

Invoking `whoami` with no token does not enter the function. The result is not a subject.

Invoking `whoami` with a bearer userinfo accepts runs the function. The result is that subject.

A resolved subject is not authorization. Scopes and allowed tools are a later check. The [trust-store sample](https://github.com/authdog/agents-samples/tree/main/trust-store/python) is that later check for MCP. This page stops at admission.

## Related

| Read | To learn how to |
| --- | --- |
| [Semantic Kernel](/docs/agent-frameworks/semantic-kernel) | See the hook |
| [API keys and M2M for Semantic Kernel](/docs/ai/semantic-kernel/api-keys-and-m2m) | Where the secret is allowed to live |
| [Authorizing tool calls for Semantic Kernel](/docs/ai/semantic-kernel/authorize-tool-calls) | What happens after the subject is known |
