high-gpu-580
12/04/2023, 1:16 AMredirect
mode. Oathkeeper is behind Kong Gateway.
# oathkeeper.yaml
# ...
errors:
handlers:
redirect:
enabled: true
config:
to: <http://app.lc/login>
return_to_query_param: continue
when:
- error:
- unauthorized
- forbidden
• Navigate http://whoami.lc:8000/pages/private
• Unauthenticated request. Redirect to http://app.lc/login?continue=...
• But the query param continue
is wrong URL.
◦ Expect: http://app.lc/login?continue=http://whoami.lc:8000/pages/private
◦ Actually: http://app.lc/login?continue=http://oathkeeper:4455/pages/private
How do I fix this issue?
There is my access-rules:
# access-rules.yaml
- id: whoami:page-private
version: v0.40.6
upstream:
url: <http://whoami>
preserve_host: false
match:
url: <http://oathkeeper:4455/pages/private><(/.*)?>
methods:
- GET
- POST
- PUT
- DELETE
- PATCH
- OPTIONS
authenticators:
- handler: cookie_session
authorizer:
handler: allow
mutators:
- handler: header
errors:
- handler: redirect
Debug logs:
{"http_request":{"headers":{"accept":"application/json","accept-encoding":"gzip, deflate, br","connection":"keep-alive","user-agent":"got (<https://github.com/sindresorhus/got>)","x-forwarded-for":"172.19.0.1","x-forwarded-host":"<http://whoami.lc|whoami.lc>","x-forwarded-path":"/pages/private","x-forwarded-port":"8000","x-forwarded-proto":"http","x-kong-request-id":"facbf508e60b1d6411826d0cbafc0e00","x-real-ip":"172.19.0.1"},"host":"oathkeeper:4455","method":"GET","path":"/pages/private","query":null,"remote":"172.19.0.11:60092","scheme":"http"},"level":"info","msg":"started handling request","time":"2023-12-04T01:12:48.105434044Z"}
{"audience":"application","error":{"debug":"","message":"Access credentials are invalid","reason":"","stack_trace":"\<http://ngithub.com/ory/oathkeeper/proxy.(*requestHandler).HandleRequest|ngithub.com/ory/oathkeeper/proxy.(*requestHandler).HandleRequest>\n\t/project/proxy/request_handler.go:236\ngithub.com/ory/oathkeeper/proxy.(*Proxy).Rewrite\n\t/project/proxy/proxy.go:133\nnet/http/httputil.(*ReverseProxy).ServeHTTP\n\t/usr/local/go/src/net/http/httputil/reverseproxy.go:433\ngithub.com/urfave/negroni.Wrap.func1\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:46\ngithub.com/urfave/negroni.HandlerFunc.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29\ngithub.com/urfave/negroni.middleware.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38\ngithub.com/ory/x/corsx.ContextualizedMiddleware.func1\n\t/go/pkg/mod/github.com/ory/x@v0.0.565/corsx/middleware.go:26\ngithub.com/urfave/negroni.HandlerFunc.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29\ngithub.com/urfave/negroni.middleware.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38\ngithub.com/ory/x/reqlog.(*Middleware).ServeHTTP\n\t/go/pkg/mod/github.com/ory/x@v0.0.565/reqlog/middleware.go:142\ngithub.com/urfave/negroni.middleware.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38\ngithub.com/ory/oathkeeper/metrics.(*Middleware).ServeHTTP\n\t/project/metrics/middleware.go:103\ngithub.com/urfave/negroni.middleware.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38\ngithub.com/ory/x/metricsx.(*Service).ServeHTTP\n\t/go/pkg/mod/github.com/ory/x@v0.0.565/metricsx/middleware.go:272\ngithub.com/urfave/negroni.middleware.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38\ngithub.com/urfave/negroni.(*Negroni).ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:96\ngo.opentelemetry.io/contrib/instrumentation/net/http/otelhttp.(*Handler).ServeHTTP\n\t/go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.36.4/handler.go:204\nnet/http.serverHandler.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2936\nnet/http.(*conn).serve\n\t/usr/local/go/src/net/http/server.go:1995\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1598","status":"Unauthorized","status_code":401},"granted":false,"http_host":"oathkeeper:4455","http_method":"GET","http_url":"<http://oathkeeper:4455/pages/private>","http_user_agent":"got (<https://github.com/sindresorhus/got>)","level":"warning","msg":"No authentication handler was responsible for handling the authentication request","reason_id":"authentication_handler_no_match","rule_id":"whoami:page-private","service_name":"ORY Oathkeeper","service_version":"v0.40.6","time":"2023-12-04T01:12:48.105826497Z"}
{"audience":"application","error":{"debug":"","message":"Access credentials are invalid","reason":"","stack_trace":"\<http://ngithub.com/ory/oathkeeper/proxy.(*requestHandler).HandleRequest|ngithub.com/ory/oathkeeper/proxy.(*requestHandler).HandleRequest>\n\t/project/proxy/request_handler.go:236\ngithub.com/ory/oathkeeper/proxy.(*Proxy).Rewrite\n\t/project/proxy/proxy.go:133\nnet/http/httputil.(*ReverseProxy).ServeHTTP\n\t/usr/local/go/src/net/http/httputil/reverseproxy.go:433\ngithub.com/urfave/negroni.Wrap.func1\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:46\ngithub.com/urfave/negroni.HandlerFunc.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29\ngithub.com/urfave/negroni.middleware.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38\ngithub.com/ory/x/corsx.ContextualizedMiddleware.func1\n\t/go/pkg/mod/github.com/ory/x@v0.0.565/corsx/middleware.go:26\ngithub.com/urfave/negroni.HandlerFunc.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29\ngithub.com/urfave/negroni.middleware.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38\ngithub.com/ory/x/reqlog.(*Middleware).ServeHTTP\n\t/go/pkg/mod/github.com/ory/x@v0.0.565/reqlog/middleware.go:142\ngithub.com/urfave/negroni.middleware.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38\ngithub.com/ory/oathkeeper/metrics.(*Middleware).ServeHTTP\n\t/project/metrics/middleware.go:103\ngithub.com/urfave/negroni.middleware.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38\ngithub.com/ory/x/metricsx.(*Service).ServeHTTP\n\t/go/pkg/mod/github.com/ory/x@v0.0.565/metricsx/middleware.go:272\ngithub.com/urfave/negroni.middleware.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38\ngithub.com/urfave/negroni.(*Negroni).ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:96\ngo.opentelemetry.io/contrib/instrumentation/net/http/otelhttp.(*Handler).ServeHTTP\n\t/go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.36.4/handler.go:204\nnet/http.serverHandler.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2936\nnet/http.(*conn).serve\n\t/usr/local/go/src/net/http/server.go:1995\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1598","status":"Unauthorized","status_code":401},"granted":false,"http_host":"oathkeeper:4455","http_method":"GET","http_url":"<http://oathkeeper:4455/pages/private>","http_user_agent":"got (<https://github.com/sindresorhus/got>)","level":"warning","msg":"Access request denied","service_name":"ORY Oathkeeper","service_version":"v0.40.6","time":"2023-12-04T01:12:48.105944474Z"}
{"http_request":{"headers":{"accept":"application/json","accept-encoding":"gzip, deflate, br","connection":"keep-alive","user-agent":"got (<https://github.com/sindresorhus/got>)","x-forwarded-for":"172.19.0.1","x-forwarded-host":"<http://whoami.lc|whoami.lc>","x-forwarded-path":"/pages/private","x-forwarded-port":"8000","x-forwarded-proto":"http","x-kong-request-id":"facbf508e60b1d6411826d0cbafc0e00","x-real-ip":"172.19.0.1"},"host":"oathkeeper:4455","method":"GET","path":"/pages/private","query":null,"remote":"172.19.0.11:60092","scheme":"http"},"http_response":{"headers":{"content-type":"text/html; charset=utf-8","location":"<http://app.lc/login?continue=http%3A%2F%2Foathkeeper%3A4455%2Fpages%2Fprivate>"},"size":114,"status":302,"text_status":"Found","took":801890},"level":"info","msg":"completed handling request","time":"2023-12-04T01:12:48.106218184Z"}
fierce-wolf-75402
11/29/2023, 7:31 PM{
"id": "protected_resources",
"version": "v0.40.6",
"match": {
"url": "<http|https>://<.*>/<playground|query|anything/header>",
"methods": [
"GET",
"POST"
]
},
"authenticators": [
{
"handler": "jwt",
"config": {
"target_audience": [
"{{ printIndex .MatchContext.RegexpCaptureGroups 0 }}://{{ printIndex .MatchContext.RegexpCaptureGroups 1 }}"
]
}
}
],
Error in log:
"reason": "id=\nrid=\nerror=The request could not be authorized\nreason=Token audience [<https://my.domain.com>] is not intended for target audience {{ printIndex .MatchContext.RegexpCaptureGroups 0 }}://{{ printIndex .MatchContext.RegexpCaptureGroups 1 }}
agreeable-microphone-83376
11/29/2023, 9:15 AMbumpy-telephone-79609
11/26/2023, 8:27 AM/engines/acp/ory/exact/allowed
?early-oil-83208
11/22/2023, 11:07 AMauthorization
header.
Is there a reason this is specifically an OpenId Connect ID token, or does it just match that convention?
The example isn't really using an OIDC flow.
From usage, it seems like it's an internal token intended as something like a session token, to propagate authentication information to a downstream service.
If I remember correctly, the id_token
is intended for use by the client rather than being propagated downstream.
Sorry if this is a philosophical point, I'm just trying to understand the intend usage to I don't use this for the wrong reasons 😅
The idea of swapping an external authentication (the session info) for an internal represenation (a JWT) is what I'm looking for, so the way it works seems to fit, but the mention of OIDC has confused me a little bit.acoustic-shampoo-32095
11/22/2023, 8:37 AMauthorizers:
allow:
enabled: true
remote_json:
enabled: true
config:
remote: <http://keto:4466/relation-tuples/check|http://keto:4466/relation-tuples/check>
payload: |
{
"namespace": "api_access",
"object": "endpoints",
"relation": "access",
"subject_id": "{{ print .Extra.identity.metadata_admin.role }}"
}
quick-addition-40343
11/21/2023, 9:48 AMastonishing-psychiatrist-64556
11/18/2023, 7:06 AMastonishing-psychiatrist-64556
11/18/2023, 6:05 AMbumpy-telephone-79609
11/16/2023, 6:53 PMfierce-wolf-75402
11/14/2023, 5:49 PMfierce-wolf-75402
11/14/2023, 3:54 PMketo_engine_acp_ory
authorizer in OathKeeper? If so, do I just set the keto_engine_acp_ory
handler’s base_url to the Ory Network project slug URL?acoustic-shampoo-32095
11/10/2023, 11:45 PMfancy-evening-36350
11/10/2023, 4:49 PM- id: 'my-webhook'
upstream:
preserve_host: false
url: <http://my-service>
match:
url: <https://my-api.com/my-webhook>
methods:
- POST
authenticators:
- handler: noop
authorizer:
handler: allow
mutators:
- handler: noop
ancient-judge-84558
11/10/2023, 11:34 AMlog:
leak_sensitive_values: true
format: json_pretty
level: warn
But I get logs in text format without sensitive information on level info. 😕
I’m editing the right config file, because when I write “logs” instead of “log”, oathkeeper shows me a parse error.
Any ideas why this is happening?ancient-ice-60674
11/08/2023, 1:58 PMjolly-breakfast-43519
11/03/2023, 8:32 AMjolly-breakfast-43519
11/01/2023, 1:23 PMgreen-jewelry-10349
10/30/2023, 9:57 AM<http://127.0.0.1:8080/todos>
.
I get unauthorized response
{
"error": {
"code": 401,
"status": "Unauthorized",
"message": "Access credentials are invalid"
}
}
and but this check_session_url
endpoint is not getting hit. bcz there are no logs from that api.
I have also posted logs from oathkeeper
Can you guys help me with this issue like is there anything wrong in the config or anything else I am missing.better-receptionist-46087
10/26/2023, 2:48 PMtall-easter-67692
10/22/2023, 11:36 AMif using Kubernetes deployment and oathkeeer maester, it'll be two CRD with non-overlapping matching rules on the HTTP path (edited)@alert-advantage-94977 is it possible without using maester? nice to know it's possible using maester!
alert-advantage-94977
10/22/2023, 7:59 AMtall-easter-67692
10/21/2023, 11:15 AMkind-sugar-1935
10/19/2023, 10:59 AMbearer_token:
enabled: true
config:
check_session_url: <https://www.domain.be/sessions/whoami>
preserve_path: true
extra_from: "@this"
subject_from: "identity.id"
token_from:
header: X-Session-Token
forward_http_headers:
- Authorization
- X-Session-Token
rhythmic-gpu-74421
10/16/2023, 5:43 PMvictorious-eye-56567
10/15/2023, 2:37 PMwhoami
endpoint with the X-Session-Token
set to `ory_st_7ek8qeAbffehkb9dGFoz1dWNZeVQuatd`it tells me
{
"error": {
"code": 500,
"status": "Internal Server Error",
"message": "securecookie: base64 decode failed - caused by: illegal base64 data at input byte 36"
}
}
And the official API doc says the format is MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj
but on the rare occasions the Session Token is mentionned in the doc it says it is prefixed with ory_st
.
I am quite confused and can't understand where to go from there...victorious-eye-56567
10/15/2023, 2:20 PMory_st_7ek8qeAbffehkb9dGFoz1dWNZeVQuatd
.
I am having trouble finding any documentation on how to setup my access rule to verify the session token.
I can see bearer_token and cookie_session but it does not seem to be what I need.
Which authenticator should I use ?late-student-35526
10/11/2023, 8:03 AM/health/ready
endpoint returns a 503 *healthx.swaggerNotReadyStatus a few times before getting killed.
Full error:
time=2023-10-11T07:52:57Z level=error msg=An error occurred while handling a request audience=application error=map[message:The requested resource could not be found stack_trace:stack trace could not be recovered from error type *healthx.swaggerNotReadyStatus] http_request=map[headers:map[accept:*/* accept-encoding:gzip connection:close user-agent:kube-probe/1.24] host:127.0.0.1 method:GET path:/health/ready query:<nil> remote:127.0.0.6:42323 scheme:http] http_response=map[status_code:503] service_name=ORY Oathkeeper service_version=v0.40.6
high-rose-8124
10/02/2023, 7:45 PMory_session_...
to make a request to determine who the HTTP request belongs to in my Go backend. I need to get the identity.id
in my backend. However, is there a way to pass the identity.id
to the backend from oathkeeper instead of having to make an additional request in my backend?shy-lunch-29324
10/02/2023, 5:34 PM