Tabnine Logo
Cookie.getMaxAge
Code IndexAdd Tabnine to your IDE (free)

How to use
getMaxAge
method
in
org.pac4j.core.context.Cookie

Best Java code snippets using org.pac4j.core.context.Cookie.getMaxAge (Showing top 9 results out of 315)

origin: jooby-project/jooby

@Override
public void addResponseCookie(final Cookie cookie) {
 Definition c = new Definition(cookie.getName(), cookie.getValue());
 Optional.ofNullable(cookie.getDomain()).ifPresent(c::domain);
 Optional.ofNullable(cookie.getPath()).ifPresent(c::path);
 c.httpOnly(cookie.isHttpOnly());
 c.maxAge(cookie.getMaxAge());
 c.secure(cookie.isSecure());
 rsp.cookie(c);
}
origin: jooby-project/jooby

@Override public void addResponseCookie(Cookie cookie) {
 org.jooby.Cookie.Definition c = new org.jooby.Cookie.Definition(cookie.getName(),
   cookie.getValue());
 Optional.ofNullable(cookie.getDomain()).ifPresent(c::domain);
 Optional.ofNullable(cookie.getPath()).ifPresent(c::path);
 c.httpOnly(cookie.isHttpOnly());
 c.maxAge(cookie.getMaxAge());
 c.secure(cookie.isSecure());
 rsp.cookie(c);
}
origin: pippo-java/pippo

@Override
public void addResponseCookie(Cookie cookie) {
  getResponse().cookie(cookie.getPath(),
    cookie.getDomain(),
    cookie.getName(),
    cookie.getValue(),
    cookie.getMaxAge(),
    cookie.isSecure()
  );
  javax.servlet.http.Cookie addedCookie = getResponse().getCookie(cookie.getName());
  addedCookie.setHttpOnly(cookie.isHttpOnly());
  addedCookie.setComment(cookie.getComment());
}
origin: org.jooby/jooby-pac4j

@Override
public void addResponseCookie(final Cookie cookie) {
 Definition c = new Definition(cookie.getName(), cookie.getValue());
 Optional.ofNullable(cookie.getDomain()).ifPresent(c::domain);
 Optional.ofNullable(cookie.getPath()).ifPresent(c::path);
 c.httpOnly(cookie.isHttpOnly());
 c.maxAge(cookie.getMaxAge());
 c.secure(cookie.isSecure());
 rsp.cookie(c);
}
origin: io.ratpack/ratpack-pac4j

@Override
public void addResponseCookie(Cookie cookie) {
 final DefaultCookie newCookie = new DefaultCookie(cookie.getName(), cookie.getValue());
 newCookie.setDomain(cookie.getDomain());
 newCookie.setPath(cookie.getPath());
 if (cookie.getMaxAge() >= 0) {
  newCookie.setMaxAge(cookie.getMaxAge());
 }
 newCookie.setSecure(cookie.isSecure());
 newCookie.setHttpOnly(cookie.isHttpOnly());
 response.getCookies().add(newCookie);
}
origin: pac4j/undertow-pac4j

@Override
public void addResponseCookie(final Cookie cookie) {
  final CookieImpl newCookie = new CookieImpl(cookie.getName(), cookie.getValue());
  newCookie.setComment(cookie.getComment());
  newCookie.setDomain(cookie.getDomain());
  newCookie.setPath(cookie.getPath());
  newCookie.setMaxAge(cookie.getMaxAge() < 0 ? null : cookie.getMaxAge());
  newCookie.setSecure(cookie.isSecure());
  newCookie.setHttpOnly(cookie.isHttpOnly());
  exchange.setResponseCookie(newCookie);
}
origin: pac4j/jax-rs-pac4j

@Override
public void addResponseCookie(Cookie cookie) {
  CommonHelper.assertNotNull("cookie", cookie);
  // Note: expiry is not in servlet and is meant to be superseeded by
  // max-age, so we simply make it null
  NewCookie c = new NewCookie(cookie.getName(), cookie.getValue(), cookie.getPath(),
      cookie.getDomain(), cookie.getVersion(), cookie.getComment(), cookie.getMaxAge(), null,
      cookie.isSecure(), cookie.isHttpOnly());
  getAbortBuilder().cookie(c);
  getResponseHolder().addResponseCookie(c);
}
origin: pac4j/play-pac4j

@Override
public void addResponseCookie(final Cookie cookie) {
  final Http.CookieBuilder cookieBuilder =
      Http.Cookie.builder(cookie.getName(), cookie.getValue())
          .withPath(cookie.getPath())
          .withDomain(cookie.getDomain())
          .withSecure(cookie.isSecure())
          .withHttpOnly(cookie.isHttpOnly());
  // in Play, maxAge: Cookie duration in seconds (null for a transient cookie [value by default], 0 or less for one that expires now)
  // in pac4j, maxAge == -1 -> session cookie, 0 -> expires now, > 0, expires in x seconds
  final int maxAge = cookie.getMaxAge();
  if (maxAge != -1) {
    cookieBuilder.withMaxAge(Duration.of(maxAge, ChronoUnit.SECONDS));
  }
  final Http.Cookie responseCookie = cookieBuilder.build();
  response.setCookie(responseCookie);
}
origin: pac4j/play-pac4j

@Override
public void addResponseCookie(final Cookie cookie) {
  final Http.CookieBuilder cookieBuilder =
      Http.Cookie.builder(cookie.getName(), cookie.getValue())
          .withPath(cookie.getPath())
          .withDomain(cookie.getDomain())
          .withSecure(cookie.isSecure())
          .withHttpOnly(cookie.isHttpOnly());
  // in Play, maxAge: Cookie duration in seconds (null for a transient cookie [value by default], 0 or less for one that expires now)
  // in pac4j, maxAge == -1 -> session cookie, 0 -> expires now, > 0, expires in x seconds
  final int maxAge = cookie.getMaxAge();
  if (maxAge != -1) {
    cookieBuilder.withMaxAge(Duration.of(maxAge, ChronoUnit.SECONDS));
  }
  final Http.Cookie responseCookie = cookieBuilder.build();
  response.setCookie(responseCookie);
}
org.pac4j.core.contextCookiegetMaxAge

Popular methods of Cookie

  • <init>
  • getValue
  • getName
  • setDomain
  • setHttpOnly
  • setSecure
  • getDomain
  • getPath
  • isHttpOnly
  • isSecure
  • setPath
  • setMaxAge
  • setPath,
  • setMaxAge,
  • getComment,
  • setComment,
  • setVersion,
  • getVersion

Popular in Java

  • Creating JSON documents from java classes using gson
  • scheduleAtFixedRate (Timer)
  • getSharedPreferences (Context)
  • onRequestPermissionsResult (Fragment)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • ImageIO (javax.imageio)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now