java - Cannot get principal in SecurityUtils.getSubject() -


using shiro, when login

@requestmapping(value = "/login", method = requestmethod.post)     @responsebody     public responseentity<restresult> login(@valid @requestbody user user, bindingresult result,                                             httpsession session, httpservletrequest request) {         subject subject = securityutils.getsubject();         result result = userservice.login(user.getname(), user.getpassword());         if (result.issuccess()) {             usernamepasswordtoken token = new usernamepasswordtoken(user.getname(), user.getpassword(), false,                             request.getremotehost());             subject.login(token);         }         return result.toresponseentity();     } 

and in logout method:

   @requestmapping("/logout") @responsebody public responseentity<restresult> logout(httpsession session) {     subject subject = securityutils.getsubject();     subject.logout();     return result.success().build(); } 

the snippet seems ok,but in logout method, members in subject below, enter image description here

as picture indicates principal null, so, what's matter?


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -