Gert Verhoog
읽지 않음,2012. 10. 9. 오후 5:25:5512. 10. 9.작성자에게 답장하려면 로그인하세요.
전달하려면 로그인하세요.
이 그룹의 메시지를 삭제할 권한이 없습니다.
메시지를 신고하려면 로그인하세요.
그룹의 이메일 주소가 익명이거나 원본 메시지를 보려면 회원 이메일 주소 보기 권한이 필요합니다.
받는사람 shorele...@googlegroups.com
Hi!
I'm building a Clojurescript application that gets its data from a Clojure server app. Authentication/authorisation are handled server-side, using Chas Emerick's Friend.
If I ask for a piece of data on the server for which I am not authorised, an unauthorised exception is thrown. In a classic server-side application, Ring middleware would catch this exception and either redirect to a login page (when the user is not authenticated), or display an "unauthorised" error message.
In a client-side app that gets its data via XHR requests, things would need to work a little differently.
One possibility would be to have a ring-like middleware stack on the client side, that could be used to observe/intercept/capture/modify responses sent from the remote side. Responses with a certain status (e.g. 401, 403, 404, 5xx) or certain content (a map with an :error key?) could be captured, and an appropriate action could be triggered (e.g. dispatch the event using pub/sub).
My question is: does this sound like a good idea? Does anything like this already exist?
cheers,
gert