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

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

Best Java code snippets using org.pac4j.core.context.Cookie.getValue (Showing top 15 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: apache/knox

@Override
public Object get(WebContext context, String key) {
  final Cookie cookie = ContextHelper.getCookie(context, PAC4J_SESSION_PREFIX + key);
  Object value = null;
  if (cookie != null) {
    value = uncompressDecryptBase64(cookie.getValue());
  }
  logger.debug("Get from session: {} = {}", key, value);
  return value;
}
origin: org.apache.knox/gateway-provider-security-pac4j

public Object get(WebContext context, String key) {
  final Cookie cookie = ContextHelper.getCookie(context, PAC4J_SESSION_PREFIX + key);
  Object value = null;
  if (cookie != null) {
    value = uncompressDecryptBase64(cookie.getValue());
  }
  logger.debug("Get from session: {} = {}", key, value);
  return value;
}
origin: org.pac4j/pac4j-http

@Override
public TokenCredentials extract(final WebContext context) {
  final Collection<Cookie> col = context.getRequestCookies();
  for (final Cookie c : col) {
    if (c.getName().equals(this.cookieName)) {
      return new TokenCredentials(c.getValue());
    }
  }
  return null;
}
origin: org.pac4j/vertx-pac4j

@Override
public void addResponseCookie(Cookie cookie) {
  routingContext.addCookie(io.vertx.ext.web.Cookie.cookie(cookie.getName(), cookie.getValue()));
}
origin: pac4j/vertx-pac4j

@Override
public void addResponseCookie(Cookie cookie) {
  routingContext.addCookie(io.vertx.ext.web.Cookie.cookie(cookie.getName(), cookie.getValue()));
}
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: org.pac4j/pac4j-http

  @Test
  public void testAuthentication() {
    final CookieClient client = new CookieClient(USERNAME, new SimpleTestTokenAuthenticator());
    final MockWebContext context = MockWebContext.create();

    final Cookie c = new Cookie(USERNAME, Base64.getEncoder().encodeToString(getClass().getName().getBytes(StandardCharsets.UTF_8)));
    context.getRequestCookies().add(c);
    final TokenCredentials credentials = client.getCredentials(context);
    final CommonProfile profile = client.getUserProfile(credentials, context);
    assertEquals(c.getValue(), profile.getId());
  }
}
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/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/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/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.contextCookiegetValue

Popular methods of Cookie

  • <init>
  • getName
  • setDomain
  • setHttpOnly
  • setSecure
  • getDomain
  • getMaxAge
  • 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)
  • From CI to AI: The AI layer in your organization
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