t2v/play2-auth

An error "Cookie value contains an invalid char: !" happens when pass big number to gotoLoginSucceeded()

Closed this issue · 1 comments

when i pass large number to gotoLoginSucceeded() (f.g gotoLoginSucceeded("214748364700")), I get an error which says
"""
lay.api.http.HttpErrorHandlerExceptions$$anon$1: Execution exception[[IllegalArgumentException: Cookie value contains an invalid char: !]]
at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:254) ~[play_2.11-2.4.0.jar:2.4.0]
at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:180) ~[play_2.11-2.4.0.jar:2.4.0]
at play.api.GlobalSettings$class.onError(GlobalSettings.scala:179) [play_2.11-2.4.0.jar:2.4.0]
at play.api.DefaultGlobal$.onError(GlobalSettings.scala:212) [play_2.11-2.4.0.jar:2.4.0]
at play.api.http.GlobalSettingsHttpErrorHandler.onServerError(HttpErrorHandler.scala:94) [play_2.11-2.4.0.jar:2.4.0]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$9$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:158) [play-netty-server_2.11-2.4.0.jar:2.4.0]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$9$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:155) [play-netty-server_2.11-2.4.0.jar:2.4.0]
at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36) [scala-library-2.11.6.jar:na]
at scala.util.Failure$$anonfun$recover$1.apply(Try.scala:215) [scala-library-2.11.6.jar:na]
at scala.util.Try$.apply(Try.scala:191) [scala-library-2.11.6.jar:na]
at scala.util.Failure.recover(Try.scala:215) [scala-library-2.11.6.jar:na]
at scala.concurrent.Future$$anonfun$recover$1.apply(Future.scala:324) [scala-library-2.11.6.jar:na]
at scala.concurrent.Future$$anonfun$recover$1.apply(Future.scala:324) [scala-library-2.11.6.jar:na]
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32) [scala-library-2.11.6.jar:na]
at play.api.libs.iteratee.Execution$trampoline$.executeScheduled(Execution.scala:109) [play-iteratees_2.11-2.4.0.jar:2.4.0]
at play.api.libs.iteratee.Execution$trampoline$.execute(Execution.scala:71) [play-iteratees_2.11-2.4.0.jar:2.4.0]
at scala.concurrent.impl.CallbackRunnable.executeWithValue(Promise.scala:40) [scala-library-2.11.6.jar:na]
at scala.concurrent.impl.Promise$DefaultPromise.tryComplete(Promise.scala:248) [scala-library-2.11.6.jar:na]
at scala.concurrent.Promise$class.complete(Promise.scala:55) [scala-library-2.11.6.jar:na]
at scala.concurrent.impl.Promise$DefaultPromise.complete(Promise.scala:153) [scala-library-2.11.6.jar:na]
at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235) [scala-library-2.11.6.jar:na]
at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235) [scala-library-2.11.6.jar:na]
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32) [scala-library-2.11.6.jar:na]
at scala.concurrent.impl.ExecutionContextImpl$AdaptedForkJoinTask.exec(ExecutionContextImpl.scala:121) [scala-library-2.11.6.jar:na]
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [scala-library-2.11.6.jar:na]
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.pollAndExecAll(ForkJoinPool.java:1253) [scala-library-2.11.6.jar:na]
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1346) [scala-library-2.11.6.jar:na]
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [scala-library-2.11.6.jar:na]
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [scala-library-2.11.6.jar:na]
Caused by: java.lang.IllegalArgumentException: Cookie value contains an invalid char: !
at play.core.netty.utils.CookieEncoder.validateCookie(CookieEncoder.java:47) ~[play-netty-utils-2.4.0.jar:2.4.0]
at play.core.netty.utils.ServerCookieEncoder.encode(ServerCookieEncoder.java:77) ~[play-netty-utils-2.4.0.jar:2.4.0]
at play.api.mvc.Cookies$$anonfun$5.apply(Http.scala:846) ~[play_2.11-2.4.0.jar:2.4.0]
at play.api.mvc.Cookies$$anonfun$5.apply(Http.scala:839) ~[play_2.11-2.4.0.jar:2.4.0]
at scala.collection.immutable.Stream.map(Stream.scala:418) ~[scala-library-2.11.6.jar:na]
at play.api.mvc.Cookies$.encodeSetCookieHeader(Http.scala:839) ~[play_2.11-2.4.0.jar:2.4.0]
at play.api.mvc.Cookies$.mergeSetCookieHeader(Http.scala:934) ~[play_2.11-2.4.0.jar:2.4.0]
at play.api.mvc.Result.withCookies(Results.scala:139) ~[play_2.11-2.4.0.jar:2.4.0]
at jp.t2v.lab.play2.auth.CookieSupport$class.bakeCookie(CookieSupport.scala:16) ~[play2-auth_2.11-0.13.0.jar:0.13.0]
at controllers.Application$.bakeCookie(Application.scala:14) ~[classes/:na]
at jp.t2v.lab.play2.auth.LoginLogout$$anonfun$gotoLoginSucceeded$2$$anonfun$apply$1.apply(LoginLogout.scala:18) ~[play2-auth_2.11-0.13.0.jar:0.13.0]
at jp.t2v.lab.play2.auth.LoginLogout$$anonfun$gotoLoginSucceeded$2$$anonfun$apply$1.apply(LoginLogout.scala:17) ~[play2-auth_2.11-0.13.0.jar:0.13.0]
at scala.util.Success$$anonfun$map$1.apply(Try.scala:236) ~[scala-library-2.11.6.jar:na]
at scala.util.Try$.apply(Try.scala:191) [scala-library-2.11.6.jar:na]
at scala.util.Success.map(Try.scala:236) ~[scala-library-2.11.6.jar:na]
... 9 common frames omitted
"""

Thank you for your good project.

The Netty what is used in Play2.4 does not accept ! as cookie value.

It was fixed by #131

play2-auth 0.13.0 is build for Play2.3.x.

Would you use 0.14.0-SNAPSHOT with Play2.4?