I have Play with Silhouette authentication and authorization configured using the JWTAuthenticator
. This authenticator works by reading the X-Auth-Token
header, which is a jwt
, to identify user in every request. This works fine for REST endpoints.
Now I have images that only owners should be able to access it, and I would like to use those in background-image
css property (this is a requirement). In such scenario I'm not able to set the request header hence the request will be denied.
The next natural step is to embed the token in the background-image
url itself as an url parameter. However I don't know then how to proceed at the server side. How can I tell the JWTAuthenticator
to use the token in the url if not X-Auth-Token
header is present?