Apache shiro remember me not working -


I am trying to use the memory feature from apache shiro, but it is not working.

I have it shiro.ini

  [main] ds = org.apache.shiro.jndi.JndiObjectFactory ds.requiredType = javax.sql.DataSource Ds.resourceName = Java: / Computer Application / env / JDBC / MyDS # JDBC scope config jdbcRealm = br.com.myproject.web.service.security.JdbcRealmImpl jdbcRealm.permissionsLookupEnabled = true jdbcRealm.authenticationQuery = User Select Password Where Username =? And status = 1 jdbcRealm.dataSource = $ ds sha256Matcher = org.apache.shiro.authc.credential.Sha256CredentialsMatcher jdbcRealm.credentialsMatcher = $ sha256Matcher Security Manager. Realms = $ jdbcRealm [urls] / ** = authcBasic   

This is my JdbcRealmImpl:

  public class JdbcRealmImpl extends JdbcRealm {public JdbcRealmImpl () {super (); } @Override Protects AuthenticationInfo doGetAuthenticationInfo (Final AuthenticationToken Token) throws AuthenticationException {Final AuthenticationInfo information = super.doGetAuthenticationInfo (token); End UserDB userDB = New UserDB (); End User Users = userDB.getUserByUsername ((string) token.getPrincipal ()); Return new SimpleAuthenticationInfo (user, info.getCredentials (), getName ()); }}   

Since this is a web service project, there is a login service in:

  @ POST @ path ("/ login") public response login (@FormParam ("username") last string user name, @FormParam ("password") last string password, @FormParam ("remember") last boolean memory) {last topic currentUser = SecurityUtils.getSubject (); If (! CurrentUser.isAuthenticated ()) {end user name password token token = new username password dialog (user name, password); Try {Token.setRememberMe (Remember); CurrentUser.login (token); } Hold (last authentication exception e) {return Response.status (condition.bad_REQUEST). ("invalid user"). Build (); }} Returns Response.ok () Build (); }   

The problem is that SecurityUtils.getSubject () isRemembered () always returned unrealistic even when I set up token.setRememberMe (correct).

Is there any configuration that im missing?

topic. Nominated () Shir is a bit difficult, it only gives the truth if the subject has a valid Remember setting (cookie, etc.) and the subject is not authentic. Here's the description:

So, I suspect that your memory is working fine, but the number of expectations for the topic () does not really match what's the method.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -