greenkeeper[bot] on core-js-3.5.0
chore(package): update core-js … (compare)
greenkeeper[bot] on can-observable-mixin-1.0.7
fix(package): update can-observ… (compare)
cherifGsoul on update-infrastructure-page
cherifGsoul on master
Update infrastructure page with… (compare)
cherifGsoul on update-infrastructure-page
Fix typos (compare)
cherifGsoul on document-inserted-removed-can6
Add inserted/removed events to … (compare)
greenkeeper[bot] on can-view-live-5.0.1
fix(package): update can-view-l… (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?
import DefineMap from 'can-define/map/';
https://gitter.im/canjs/canjs?at=5a96b77f0202dc012e96818d
Maybe there is way to expose params
to connect configuration ?
https://github.com/canjs/can-connect/blob/master/data/url/url.js#L373
In this case we can configure what ajax params URLBehavior
will use. So the idea that we will be able to do something like...
Entity.connection = connect(
[url, constructor, constructorStore, canMap, realTime, callbacksOnce], {
url: '/secured/entity',
ajaxConf: {
// configuration params like beforeSend etc..
// that will allow us do some additional logic if required
},
Map: Entity,
List: Entity.List,
algebra
}
);