}
@Override
public void handle(@NotNull final YokeRequest request, @NotNull final Handler<Object> next) {
// default session
final YokeCookie cookie = new YokeCookie(name, hmacSHA256);
cookie.setPath(path);
cookie.setHttpOnly(httpOnly);
cookie.setMaxAge(maxAge);
// path validation mismatch
if (request.normalizedPath().indexOf(cookie.getPath()) != 0) {
next.handle(null);
return;
}
// find the session cookie
final YokeCookie sessionCookie = request.getCookie(name);
final YokeResponse response = request.response();
int hash = 0;
String unsigned = null;
if (sessionCookie != null) {
// session cookies must be signed
if (sessionCookie.isSigned()) {
unsigned = sessionCookie.getUnsignedValue();
if (unsigned != null) {
hash = crc16(unsigned);
}
}
}