melodic-belgium-47324
09/18/2025, 9:47 AMchilly-king-10285
09/18/2025, 9:47 AMchilly-king-10285
09/18/2025, 9:48 AMmelodic-belgium-47324
09/18/2025, 10:01 AMchilly-king-10285
09/18/2025, 10:01 AMchilly-king-10285
09/18/2025, 10:01 AMmelodic-belgium-47324
09/19/2025, 9:12 AMchilly-king-10285
09/19/2025, 9:12 AMchilly-king-10285
09/19/2025, 9:12 AMmelodic-belgium-47324
09/19/2025, 9:29 AMchilly-king-10285
09/19/2025, 9:29 AMchilly-king-10285
09/19/2025, 9:30 AMheader
mutator) allow you to set headers using Go templates that have access to the AuthenticationSession
struct. This struct includes fields like .Subject
and .Extra
, but the knowledge sources do not explicitly mention a built-in way to distinguish between a user and a client within the mutator template context. Typically, you might differentiate between a user and a client by how the subject is set (e.g., a user ID vs. a client ID), or by including custom claims or extra fields during authentication. If your authentication flow (e.g., via Hydra or Kratos) sets a distinguishing value in the session (such as a claim in .Extra
), you could use that in your header mutator template: yaml mutators: header: enabled: true config: headers: X-Actor-Type: "{{ if eq .Extra.actor_type \"client\" }}client{{ else }}user{{ end }}"
However, the knowledge sources do not provide a ready-made or automatic way to set such a value; you would need to ensure your authentication process populates .Extra.actor_type
or a similar field accordingly [Header mutator documentation](https://www.ory.sh/docs/oathkeeper/pipeline/mutator#header). Summary: You can set headers conditionally in the mutator if your authentication process provides a way to distinguish user vs. client in the session data. There is no built-in or automatic mechanism in Oathkeeper for this; you must ensure the relevant information is present in the session for the mutator to use. If you need more details on how to populate .Extra
or similar fields, the knowledge sources do not provide explicit instructions.melodic-belgium-47324
09/19/2025, 11:27 AMchilly-king-10285
09/19/2025, 11:27 AMchilly-king-10285
09/19/2025, 11:27 AM