cherifGsoul on upgrade-docs-html-canjs
cherifGsoul on master
Upgrade the site theme for new … (compare)
cherifGsoul on upgrade-docs-html-canjs
Upgrade the site theme for new … (compare)
any-to-string
converter
Guys, we are working on JWT Authentication (actually any token auth):
And have some issue with modiying how url behavior makes call.
We would like to have something like this:
Entity.connection = connect(
[url, JWTAuth, constructor, constructorStore, canMap, realTime, callbacksOnce], {
url: '/secured/entity',
Map: Entity,
List: Entity.List,
algebra
}
);
The idea is that ajax call that makes url
here:
https://github.com/canjs/can-connect/blob/master/data/url/url.js#L370
Should have tokens as request headers.
The problem is that there is no way how we can pre-configure ajax settings in URL behavior. In order to have beforeSend
section with doing some Auth logic there.
The only option that we found is rewrite ajax function
Entity.connection = connect(
[url, JWTAuth, constructor, constructorStore, canMap, realTime, callbacksOnce], {
url: '/secured/entity',
ajax: authenticatedAjax,
Map: Entity,
List: Entity.List,
algebra
}
);
But in this case we can move all logic to authenticatedAJAX and don't use JWTAuth.
How this best to organize ?
import
for instance?