I'm not sure if I'm understanding your question here. Let me try to address your concerns and let me know if I don't.

What I think is a bit ugly is that the 'AuthModule' has it's own 'ajax handler' (it is using $.ajax for enroll/login/logoff), but the same file is also messing around with the 'ajax config' of the rest handler
The reason I don't use AeroGear.ajax and instead $.ajax is that I am doing the authentication. AeroGear.ajax would try to check if an enroll or a login is authenticated and fail the request because it's not. That obviously isn't what we want so I bypass our checks by using $.ajax directly for the Auth module instead of AeroGear.ajax

So basically why passing the 'ajax.js' header to the auth.js, via the rest.js ? wouldn't it be cleaner if the 'ajax.js' would just read (get or callback etc) the auth-hoken
So a pipe determines whether or not it needs to authenticate by the fact that an authenticator is associated with it because technically you could have secure and open resources in the same app. By keeping all of the auth code in the auth module, I then get access to that via the auth adapter that was attached and it feels better organized. I am open to other suggestions though if you think of a better method.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira