Mutators
A mutator transforms the credentials from incoming requests to credentials that your backend understands. For example, the
Authorization: basic
header might be transformed to X-User: <subject-id>
. This allows you to write backends that don't care if
the original request was an anonymous one, an OAuth 2.0 Access Token, or some other credential type. All your backend has to do is
understand, for example, the X-User:
.
The Access Control Decision API will return the mutated result as the HTTP Response.
noop
This mutator doesn't transform the HTTP request and simply forwards the headers as-is. This is useful if you don't want to
replace, for example, Authorization: basic
with X-User: <subject-id>
.
noop
configuration
# Global configuration file oathkeeper.yml
mutators:
noop:
# Set enabled to true if the authenticator should be enabled and false to disable the authenticator. Defaults to false.
enabled: true
# Some Access Rule: access-rule-1.yaml
id: access-rule-1
# match: ...
# upstream: ...
mutators:
- handler: noop
noop
access rule example
cat ./rules.json
{
"id": "some-id",
"upstream": {
"url": "http://my-backend-service"
},
"match": {
"url": "http://my-app/api/users/<[0-9]+>/<[a-zA-Z]+>",
"methods": [
"GET"
]
},
"authenticators": [
{
"handler": "anonymous"
}
],
"authorizer": {
"handler": "allow"
},
"mutators": [
{
"handler": "noop"
}
]
}
curl -X GET http://my-app/some-route
HTTP/1.0 200 Status OK
The request has been allowed! The original HTTP Request hasn't been modified.