web services - How to access the webservice in grails through secure layer -
i have simple method in controller class.
class trainingcontroller{ def gettrainingsjson(){ def traininglist = training.list() println "called====" //render traininglist json render "${params.callback}(${traininglist json})" } }
which gets list of training, in html page have request follows
<script type="text/javascript"> $(function(){ $.getjson('http://localhost:8080/training/gettrainingsjson?callback=?', function(data) { console.log("success"); alert(data); }); }); </script>
the request served after login. without login response login page html format.
the request across servers (from php grails). want ensure secure communication must established, how authenticate through json using spring security in grails.
and how ensure nobody can forge request , response server.
and need follow rest or can write methods in existing controllers or need create separate controller/service kind of requests.
if access through browser, spring authentication take care of - secure url accordingly. requests (including ajax) go through spring auth
to prevent snooping consider implementing ssl
the spring security plugin docs has more information on securing application. in particular read authentication, ip address restriction , session fixation prevention
Comments
Post a Comment