检查用户是否是grails中的loggen

检查用户是否是grails中的loggen,grails,login,titanium-mobile,Grails,Login,Titanium Mobile,我正在构建一个移动应用程序,它连接到使用SpringSecurity核心的grails应用程序。 我正在Tianium studio中构建应用程序。 如何检查用户在移动应用程序上有一个打开的会话。 我使用以下代码使用登录: var xhr = Ti.Network.createHTTPClient(); var url = "http://localhost:8080/FYP/j_spring_security_check"; var postD

我正在构建一个移动应用程序,它连接到使用SpringSecurity核心的grails应用程序。 我正在Tianium studio中构建应用程序。 如何检查用户在移动应用程序上有一个打开的会话。 我使用以下代码使用登录:

   var xhr = Ti.Network.createHTTPClient();
           var url = "http://localhost:8080/FYP/j_spring_security_check";
           var postData = "";
           postData += 'j_username=' + usernameField.value;
           postData += '&j_password=' + passwordField.value;
           postData += '&_spring_security_remember_me=on';
           Ti.API.debug(url);
           xhr.open("POST", url);
           xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
           xhr.onload = function() {

                var response = JSON.parse(xhr.responseText);
                win.close({animate:true});
                slidingMenu.open({animate:true});
               if( response.error ){
                 alert( response.error );
               } else {
                 //logged in now do something
               }
           };
           xhr.onerror = function(){
             Ti.API.error( "Error Logging in" );   
           };
           xhr.send(postData);

但是如何检查用户是否已经登录?

我只使用一个应用程序级别变量。在这种情况下,当我需要保护数据时,我总是将存储的用户名和密码传递给服务器,因此每次服务器都必须进行身份验证。

使用

springsecurityservice.isLoggedIn() 
并执行
GET
请求:)