/** * Discard a cookie on the given path with no domain and not that's secure. * * @param name The name of the cookie to discard, must not be null * @param path The path of the cookie to discard, may be null */ public Result discardingCookie(String name, String path) { return discardingCookie(name, path, null, false); }
/** * Discard a cookie on the given path with no domain and not that's secure. * * @param name The name of the cookie to discard, must not be null * @param path The path of the cookie to discard, may be null */ public Result discardingCookie(String name, String path) { return discardingCookie(name, path, null, false); }
/** * Discard a cookie on the default path ("/") with no domain and that's not secure. * * @param name The name of the cookie to discard, must not be null */ public Result discardingCookie(String name) { return discardingCookie(name, "/", null, false); }
/** * Discard a cookie on the given path with no domain and not that's secure. * * @param name The name of the cookie to discard, must not be null * @param path The path of the cookie to discard, may be null */ public Result discardingCookie(String name, String path) { return discardingCookie(name, path, null, false); }
/** * Discard a cookie on the default path ("/") with no domain and that's not secure. * * @param name The name of the cookie to discard, must not be null */ public Result discardingCookie(String name) { return discardingCookie(name, "/", null, false); }
/** * Discard a cookie on the given path and domain that's not secure. * * @param name The name of the cookie to discard, must not be null * @param path The path of the cookie te discard, may be null * @param domain The domain of the cookie to discard, may be null */ public Result discardingCookie(String name, String path, String domain) { return discardingCookie(name, path, domain, false); }
/** * Discard a cookie on the default path ("/") with no domain and that's not secure. * * @param name The name of the cookie to discard, must not be null */ public Result discardingCookie(String name) { return discardingCookie(name, "/", null, false); }
/** * Discard a cookie on the given path and domain that's not secure. * * @param name The name of the cookie to discard, must not be null * @param path The path of the cookie te discard, may be null * @param domain The domain of the cookie to discard, may be null */ public Result discardingCookie(String name, String path, String domain) { return discardingCookie(name, path, domain, false); }
/** * Discard a cookie on the given path and domain that's not secure. * * @param name The name of the cookie to discard, must not be null * @param path The path of the cookie te discard, may be null * @param domain The domain of the cookie to discard, may be null */ public Result discardingCookie(String name, String path, String domain) { return discardingCookie(name, path, domain, false); }
private CompletionStage<Result> handleTokenError(Http.Request req, RequestHeader taggedRequest, String msg) { CSRFErrorHandler handler = configurator.apply(this.configuration); return handler.handle(taggedRequest.asJava(), msg).thenApply(result -> { if (CSRF.getToken(taggedRequest).isEmpty()) { if (config.cookieName().isDefined()) { Option<String> domain = sessionConfiguration.domain(); return result.discardingCookie(config.cookieName().get(), sessionConfiguration.path(), domain.isDefined() ? domain.get() : null, config.secureCookie()); } return result.removingFromSession(req, config.tokenName()); } return result; }); } }
private CompletionStage<Result> handleTokenError(Http.Request req, RequestHeader taggedRequest, String msg) { CSRFErrorHandler handler = configurator.apply(this.configuration); return handler.handle(taggedRequest.asJava(), msg).thenApply(result -> { if (CSRF.getToken(taggedRequest).isEmpty()) { if (config.cookieName().isDefined()) { Option<String> domain = sessionConfiguration.domain(); return result.discardingCookie(config.cookieName().get(), sessionConfiguration.path(), domain.isDefined() ? domain.get() : null, config.secureCookie()); } return result.removingFromSession(req, config.tokenName()); } return result; }); } }