-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
invoking rest AsyncStack method in tests always returns 401 #144
Comments
I'm also interested in resolving this issue. |
Can I see your |
In your |
My global auth trait GlobalAuthConfig extends AuthConfig {
type Id = String
type User = user.User
val idTag: ClassTag[Id] = classTag[Id]
val sessionTimeoutInSeconds = current.configuration.getInt("session.timeout.seconds").getOrElse(3600)
def resolveUser(id: Id)(implicit ctx: ExecutionContext) = Future.successful(Some(User(id)))
def authorizationFailed(request: RequestHeader)(implicit ctx: ExecutionContext) = Future.successful(Forbidden)
def authorize(user: User, authority: Authority)(implicit ctx: ExecutionContext) = Future.successful(true)
def loginSucceeded(request: RequestHeader)(implicit ctx: ExecutionContext) = Future.successful(Ok)
def logoutSucceeded(request: RequestHeader)(implicit ctx: ExecutionContext) = Future.successful(Ok)
def authenticationFailed(request: RequestHeader)(implicit ctx: ExecutionContext) = Future.successful(Unauthorized)
override def authorizationFailed(request: RequestHeader, user: User, authority: Option[Authority])(implicit context: ExecutionContext): Future[Result] = {
Future.successful(Forbidden("no permission"))
}
}
my version of the play2auth is 0.13.2 |
Thanks! Ok, I see. play2-auth-test 0.13.2 is broken #136 It was fixed at 0.14.0, however it is for Play2.4 |
play2-auth 0.13.3 had been published, and currently latest release for Play2.3 is 0.13.5 |
I've tried to run tests using fake request and you withLoggedIn implicit but it always return 401 code.
I was debugging whole day and after few hours I've manage code which is working well in my project. Can you look on it and tell if I didn't understand your tutorial or you have bug in your code? Bellow you can see my implicit and real working test. I had to add cookie into FakeRequest after that AsyncStack function is working great in my integration tests
Implicit function and my own implementation of TokenAccessor
Real test which works :)
The text was updated successfully, but these errors were encountered: