Created
May 2, 2015 19:37
-
-
Save PipelineBaron/b4608c47211dbe9a3d81 to your computer and use it in GitHub Desktop.
Authentication middleware
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| final case class AuthenticatedOnlyMiddleware() extends Middleware { | |
| def intercept(next: Controller) = AdhocController { request => | |
| request | |
| .session | |
| .get("user") | |
| .map(_ => next.action(request)) | |
| .getOrElse(Found("").withHeader(Location("/login"))) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment