使用 ``` UsernamePasswordToken token = new UsernamePasswordToken(userName, password);
token.setRememberMe(true);
```
[DEBUG] 15:44:11.435 org.apache.shiro.web.servlet.SimpleCookie.readValue(SimpleCookie.java:389) - Found 'rememberMe' cookie value [exxxOMM+Z6e0vQ5zJllNE+6esgrAqrMBC0qZI6WoAGhI4XvDVDk+e0s7Y8LHs60XlFBgw532K5yyO5/WB9GcE5be7GDBvCGxoVgaPYU6Px+Gnjv8RYZMdx8tgfwB085TtDM8BIZVyvEkjSD7DkkvtzdiOXLxQOwipjp0h3ElgvPCTHb2Q7tABKfKZ7Y0Gu/FJI/bPfPBYhLzbhpzpwRoVyUDdr2wekJcR76a2MSn25xvtda5RhPIXSXzdiUohnRuDhVBqkFw/QF1FsBbrCNwhazG6895LDTgUBoo52jasfO/3k74MtOk81cB8OGGVmX1vGVlCf67zRXY190smvVKVFA9p1X6bHlSYpsSep6c3y1qeYwTFloJh7YVAatbJCpDq4P3q6RelBrRrg4gNLWIfvD9y32XwwI8LlQftYz/ju5i2lHAUBZyU4OREmJHzpn+yEO5/YxQFcnihQw/th53hnN+YQSki5cJsgivRNPX2j5c5MfMJatfF8tOY78xQbxc+NaBjiLZPh2S6mYUn1UwH8JiRDsWiX5/MBDV6mdLO6fEjiL0nQgurTch0xmL4wKhqCQkOU0TLkKqE7hhy3BC86vrx9MJTgCnUHG2zkR+uwZi6V8c8YG+wBY79PleZxfXgO8XCn17g0uePjTOvKEaDRxgF29mhCJNg+kCmyY+WPIbY8iRU1mWbJKPKv5vCu5qPv0DVLZ7ZtofIBg5zNt9Y4v7EvFJ/MxlMdYEaCmokWLvnSfS0d9Vinyg5RF9TMk0arDLzVkoJplB8f8KuVa5CaoefZsZUqSlth6BREsX2bRL8wObuzYvtSHBpe5w15eE2LjBAW1fZStd9GyiA4GUdK/qr4ztk0iG5bhF5LMhr5vdqICiHeTt3r12HkUak+x0zmFbS1W8Ny1SAG3AZianY79QD8qU8cHvcXaKZFBG+y4UGgaALYAL5NnAGKmC90FOlgrLvgHnoOnq37zHAh2VclgXHez+wWgELNG+eWMp1+G8mvI+xZr72I2uVcUjGwAdFddDV8GOq+zw4bbQljXy7ihNQSOz9KloDxKbCr3Zy5cNM7AgUM92dzRz717VYEh/z9pXv+iaw3r/+BasCVPlfsJ8Fh/lP8RihdNu1VuzSxd8QIh/mbCyCFP1ubZ0v9iJEXl9m7ouYMas8vM9xZ9436pJi6eRj6DQsuNmpM1xyxmoAx0L0naWeAXNp9OMpkR0ymoy3BGkMJqzEgjZsbUH3f0p1dhZxx8E6QVgGzn+WbdbqMWuyLK04mJjgNToFNqZ2CT/05oYbGkeCIYSh5/cqWeLzuZq2fWxd+nLk0JRRBO/aixZCMSbuK2Mivll7xuHXXa8kfPxRbNeAH2xWn+DtKPFaJwC3ymDES5ZKV5Bm/NMWgja1EmOdCPNH6B3u/DsnbXnp9dANyZVbblceeYBUPJCklyNBmCrTJFADM47D1IOVOzuGFWdKzG5ST6nMM+l]
[DEBUG] 15:44:11.435 org.apache.shiro.web.servlet.SimpleCookie.readValue(SimpleCookie.java:389) - Found 'rememberMe' cookie value [exxxOMM+Z6e0vQ5zJllNE+6esgrAqrMBC0qZI6WoAGhI4XvDVDk+e0s7Y8LHs60XlFBgw532K5yyO5/WB9GcE5be7GDBvCGxoVgaPYU6Px+Gnjv8RYZMdx8tgfwB085TtDM8BIZVyvEkjSD7DkkvtzdiOXLxQOwipjp0h3ElgvPCTHb2Q7tABKfKZ7Y0Gu/FJI/bPfPBYhLzbhpzpwRoVyUDdr2wekJcR76a2MSn25xvtda5RhPIXSXzdiUohnRuDhVBqkFw/QF1FsBbrCNwhazG6895LDTgUBoo52jasfO/3k74MtOk81cB8OGGVmX1vGVlCf67zRXY190smvVKVFA9p1X6bHlSYpsSep6c3y1qeYwTFloJh7YVAatbJCpDq4P3q6RelBrRrg4gNLWIfvD9y32XwwI8LlQftYz/ju5i2lHAUBZyU4OREmJHzpn+yEO5/YxQFcnihQw/th53hnN+YQSki5cJsgivRNPX2j5c5MfMJatfF8tOY78xQbxc+NaBjiLZPh2S6mYUn1UwH8JiRDsWiX5/MBDV6mdLO6fEjiL0nQgurTch0xmL4wKhqCQkOU0TLkKqE7hhy3BC86vrx9MJTgCnUHG2zkR+uwZi6V8c8YG+wBY79PleZxfXgO8XCn17g0uePjTOvKEaDRxgF29mhCJNg+kCmyY+WPIbY8iRU1mWbJKPKv5vCu5qPv0DVLZ7ZtofIBg5zNt9Y4v7EvFJ/MxlMdYEaCmokWLvnSfS0d9Vinyg5RF9TMk0arDLzVkoJplB8f8KuVa5CaoefZsZUqSlth6BREsX2bRL8wObuzYvtSHBpe5w15eE2LjBAW1fZStd9GyiA4GUdK/qr4ztk0iG5bhF5LMhr5vdqICiHeTt3r12HkUak+x0zmFbS1W8Ny1SAG3AZianY79QD8qU8cHvcXaKZFBG+y4UGgaALYAL5NnAGKmC90FOlgrLvgHnoOnq37zHAh2VclgXHez+wWgELNG+eWMp1+G8mvI+xZr72I2uVcUjGwAdFddDV8GOq+zw4bbQljXy7ihNQSOz9KloDxKbCr3Zy5cNM7AgUM92dzRz717VYEh/z9pXv+iaw3r/+BasCVPlfsJ8Fh/lP8RihdNu1VuzSxd8QIh/mbCyCFP1ubZ0v9iJEXl9m7ouYMas8vM9xZ9436pJi6eRj6DQsuNmpM1xyxmoAx0L0naWeAXNp9OMpkR0ymoy3BGkMJqzEgjZsbUH3f0p1dhZxx8E6QVgGzn+WbdbqMWuyLK04mJjgNToFNqZ2CT/05oYbGkeCIYSh5/cqWeLzuZq2fWxd+nLk0JRRBO/aixZCMSbuK2Mivll7xuHXXa8kfPxRbNeAH2xWn+DtKPFaJwC3ymDES5ZKV5Bm/NMWgja1EmOdCPNH6B3u/DsnbXnp9dANyZVbblceeYBUPJCklyNBmCrTJFADM47D1IOVOzuGFWdKzG5ST6nMM+l]
[WARN ] 15:44:11.451 org.apache.shiro.mgt.AbstractRememberMeManager.onRememberedPrincipalFailure(AbstractRememberMeManager.java:449) - There was a failure while trying to retrieve remembered principals. This could be due to a configuration problem or corrupted principals. This could also be due to a recently changed encryption key, if you are using a shiro.ini file, this property would be 'securityManager.rememberMeManager.cipherKey' see: http://shiro.apache.org/web.html#Web-RememberMeServices. The remembered identity will be forgotten and not used for this request.
[WARN ] 15:44:11.451 org.apache.shiro.mgt.AbstractRememberMeManager.onRememberedPrincipalFailure(AbstractRememberMeManager.java:449) - There was a failure while trying to retrieve remembered principals. This could be due to a configuration problem or corrupted principals. This could also be due to a recently changed encryption key, if you are using a shiro.ini file, this property would be 'securityManager.rememberMeManager.cipherKey' see: http://shiro.apache.org/web.html#Web-RememberMeServices. The remembered identity will be forgotten and not used for this request.
[DEBUG] 15:44:11.456 org.apache.shiro.web.servlet.SimpleCookie.addCookieHeader(SimpleCookie.java:226) - Added HttpServletResponse Cookie [rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Mon, 11-Dec-2017 07:44:11 GMT]
[WARN ] 15:44:11.456 org.apache.shiro.mgt.DefaultSecurityManager.getRememberedIdentity(DefaultSecurityManager.java:609) - Delegate RememberMeManager instance of type [org.apache.shiro.web.mgt.CookieRememberMeManager] threw an exception during getRememberedPrincipals().
org.apache.shiro.crypto.CryptoException: Unable to execute 'doFinal' with cipher instance [javax.crypto.Cipher@4b5f92c0].
at org.apache.shiro.crypto.JcaCipherService.crypt(JcaCipherService.java:462)
at org.apache.shiro.crypto.JcaCipherService.crypt(JcaCipherService.java:445)
at org.apache.shiro.crypto.JcaCipherService.decrypt(JcaCipherService.java:390)
at org.apache.shiro.crypto.JcaCipherService.decrypt(JcaCipherService.java:382)
at org.apache.shiro.mgt.AbstractRememberMeManager.decrypt(AbstractRememberMeManager.java:482)
at org.apache.shiro.mgt.AbstractRememberMeManager.convertBytesToPrincipals(AbstractRememberMeManager.java:419)
at org.apache.shiro.mgt.AbstractRememberMeManager.getRememberedPrincipals(AbstractRememberMeManager.java:386)
at org.apache.shiro.mgt.DefaultSecurityManager.getRememberedIdentity(DefaultSecurityManager.java:604)
at org.apache.shiro.mgt.DefaultSecurityManager.resolvePrincipals(DefaultSecurityManager.java:492)
at org.apache.shiro.mgt.DefaultSecurityManager.createSubject(DefaultSecurityManager.java:342)
at org.apache.shiro.subject.Subject$Builder.buildSubject(Subject.java:846)
at org.apache.shiro.web.subject.WebSubject$Builder.buildWebSubject(WebSubject.java:148)
at org.apache.shiro.web.servlet.AbstractShiroFilter.createSubject(AbstractShiroFilter.java:292)
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:359)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1621)
at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1621)
at org.nutz.mvc.WhaleFilter.doFilter(WhaleFilter.java:159)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1621)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:541)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1593)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1239)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:481)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1562)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1141)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:564)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.crypto.BadPaddingException: Given final block not properly padded
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:989)
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:845)
at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:446)
at javax.crypto.Cipher.doFinal(Cipher.java:2165)
at org.apache.shiro.crypto.JcaCipherService.crypt(JcaCipherService.java:459)
... 43 more
[DEBUG] 15:44:11.458 org.apache.shiro.web.servlet.SimpleCookie.addCookieHeader(SimpleCookie.java:226) - Added HttpServletResponse Cookie [rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Mon, 11-Dec-2017 07:44:11 GMT]
[WARN ] 15:44:11.459 org.apache.shiro.mgt.DefaultSecurityManager.getRememberedIdentity(DefaultSecurityManager.java:609) - Delegate RememberMeManager instance of type [org.apache.shiro.web.mgt.CookieRememberMeManager] threw an exception during getRememberedPrincipals().
org.apache.shiro.crypto.CryptoException: Unable to execute 'doFinal' with cipher instance [javax.crypto.Cipher@196a589b].
at org.apache.shiro.crypto.JcaCipherService.crypt(JcaCipherService.java:462)
at org.apache.shiro.crypto.JcaCipherService.crypt(JcaCipherService.java:445)
at org.apache.shiro.crypto.JcaCipherService.decrypt(JcaCipherService.java:390)
at org.apache.shiro.crypto.JcaCipherService.decrypt(JcaCipherService.java:382)
at org.apache.shiro.mgt.AbstractRememberMeManager.decrypt(AbstractRememberMeManager.java:482)
at org.apache.shiro.mgt.AbstractRememberMeManager.convertBytesToPrincipals(AbstractRememberMeManager.java:419)
at org.apache.shiro.mgt.AbstractRememberMeManager.getRememberedPrincipals(AbstractRememberMeManager.java:386)
at org.apache.shiro.mgt.DefaultSecurityManager.getRememberedIdentity(DefaultSecurityManager.java:604)
at org.apache.shiro.mgt.DefaultSecurityManager.resolvePrincipals(DefaultSecurityManager.java:492)
at org.apache.shiro.mgt.DefaultSecurityManager.createSubject(DefaultSecurityManager.java:342)
at org.apache.shiro.subject.Subject$Builder.buildSubject(Subject.java:846)
at org.apache.shiro.web.subject.WebSubject$Builder.buildWebSubject(WebSubject.java:148)
at org.apache.shiro.web.servlet.AbstractShiroFilter.createSubject(AbstractShiroFilter.java:292)
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:359)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1621)
at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1621)
at org.nutz.mvc.WhaleFilter.doFilter(WhaleFilter.java:159)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1621)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:541)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1593)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1239)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:481)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1562)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1141)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:564)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.crypto.BadPaddingException: Given final block not properly padded
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:989)
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:845)
at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:446)
at javax.crypto.Cipher.doFinal(Cipher.java:2165)
at org.apache.shiro.crypto.JcaCipherService.crypt(JcaCipherService.java:459)
... 43 more