I'm still at a loss about getting to my Authorization key
{"Sec-WebSocket-Version" ["13"],
"Origin" ["<http://localhost:8000>"],
"Sec-WebSocket-Extensions" ["permessage-deflate"],
"User-Agent"
["Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:82.0) Gecko/20100101 Firefox/82.0"],
"Accept-Encoding" ["gzip, deflate"],
"Cache-Control" ["no-cache"],
"Accept-Language" ["en-US,en;q=0.5"],
"Sec-WebSocket-Protocol" ["graphql-ws"],
"Connection" ["keep-alive, Upgrade"],
"Sec-WebSocket-Key" ["VrocNXrlymz9f3WWNd+Ifg=="],
"Upgrade" ["websocket"],
"Accept" ["*/*"],
"Pragma" ["no-cache"],
"Host" ["localhost:8000"]}
This is what comes with the ServletUpgradeRequest in init-context
I configured graphiql to send an auth token, so that shouldn't be the issue (hopefully)
(if (config/non-production? config)
(set/union
#{["/api/v1/graphiql"
:get (lp/graphiql-ide-handler {:api-path "/api/v1/graphql"
:subscriptions-path "/api/v1/ws"
:ide-headers {"Authorization" "Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJqdGkiOiJjZjMxMjQwMDkxNmM0YmY5ODA4M2ExNTg4M2UzYjRhZiIsImV4cCI6MTYwNTI4MTE2Nn0.U8lKgjPl-NxWHMpCZwdUgQ6ceQsFtm8CQkpw4niMjEo"}}) ;; EDIT IN DEV
:route-name ::graphiql]}
(lp/graphiql-asset-routes "/assets/graphiql"))
#{}))))
but its still unclear where I can get that and associate it with the :user key
slash reject if the user isn't authorized
Now i'm digging through old issues, but i'm still not there since the context def. does not have any request info
do you get anything when passing the same map to :ide-connection-params
rather than :ide-headers
? @emccue
Just made that change and no
not that i've noticed yet
😞 have you checked in ctx for the key :connection-params
or just headers?
err
for clarification, where should I be checking this?
I have the interceptors in :subscription-interceptors
and I have :init-context
right now my interceptors are looking for a :request and a "Authorization" in the request
(:query
:variables
:id
:shutdown-ch
:response-data-ch
:parsed-lacinia-query
:lacinia-app-context)
I have these keys in the context for :subscription interceptors
(:io.pedestal.interceptor.chain/terminators
:com.walmartlabs.lacinia.pedestal.subscriptions/values-chan-fn
:io.pedestal.interceptor.chain/queue)
and these keys in what I think is coming from init-context
(http/default-interceptors)
(update :io.pedestal.http/interceptors conj (interceptor/interceptor context-adder))
(update :io.pedestal.http/interceptors conj (interceptor/interceptor auth/user-from-jwt-interceptor))
I have this chain that adds an interceptor that should add the user to the request map of stuff
and I do see a db query when i fire off the subscription req, but nothing else
hmm, honestly I'm probably not going to be able to help much, I just remembered the connection-params things from the docs maybe in lacinia-app-context there will be the connection params
This https://github.com/walmartlabs/lacinia-pedestal/blob/master/src/com/walmartlabs/lacinia/pedestal/subscriptions.clj#L322 suggests to me that the map you get in looks something like
{:request {... the bit you posted}
:connection-params {the other stuff}}
since on context there it does both (get-in context [:request :lacinia-app-context])
and (:connection-params context)
basically I would say, wherever you are currently doing (get-in x [:request "Authorisation"])
in your interceptors just log out x
and see if it has anything that looks like your token
yeah so far not there
I might give up for a week