Skip to content

Commit

Permalink
Merge pull request #160 from hibobio/master
Browse files Browse the repository at this point in the history
support controller tests without application in context
  • Loading branch information
gakuzzzz committed Mar 8, 2016
2 parents 62dd02c + 7655e26 commit c54b59d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ trait AsyncAuth {
}

private[auth] def extractToken(request: RequestHeader): Option[AuthenticityToken] = {
if (play.api.Play.isTest(play.api.Play.current)) {
if (play.api.Play.maybeApplication.forall(app => play.api.Play.isTest(app))) {
request.headers.get("PLAY2_AUTH_TEST_TOKEN") orElse tokenAccessor.extract(request)
} else {
tokenAccessor.extract(request)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ trait AuthConfig {

lazy val tokenAccessor: TokenAccessor = new CookieTokenAccessor(
cookieName = "PLAY2AUTH_SESS_ID",
cookieSecureOption = play.api.Play.isProd(play.api.Play.current),
cookieSecureOption = play.api.Play.maybeApplication.exists(app => play.api.Play.isProd(app)),
cookieHttpOnlyOption = true,
cookieDomainOption = None,
cookiePathOption = "/",
Expand Down

0 comments on commit c54b59d

Please sign in to comment.