use of play.mvc.Before in project play-cookbook by spinscale.
the class Application method checkAuth.
@Before(priority = 1, unless = { "createTicket", "quotes", "thing" })
public static void checkAuth() {
Header ticket = request.headers.get("x-authorization");
if (ticket == null) {
error("Please provide a ticket");
}
String cacheTicket = Cache.get("ticket:" + ticket.value(), String.class);
if (cacheTicket == null) {
error("Please renew your ticket");
}
Cache.set("ticket:" + ticket.value(), cacheTicket, "5min");
}