org.keycloak.services.util

## Class CookieHelper

- java.lang.Object
- - org.keycloak.services.util.CookieHelper

-     public class CookieHelper
      extends Object

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `LEGACY_COOKIE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CookieHelper()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `addCookie(String name, String value, String path, String domain, String comment, int maxAge, boolean secure, boolean httpOnly)` Set a response cookie avoiding SameSite parameter
    `static void` | `addCookie(String name, String value, String path, String domain, String comment, int maxAge, boolean secure, boolean httpOnly, ServerCookie.SameSiteAttributeValue sameSite)` Set a response cookie.
    `static javax.ws.rs.core.Cookie` | `getCookie(Map<String,javax.ws.rs.core.Cookie> cookies, String name)`
    `static Set<String>` | `getCookieValue(String name)`
    `static Set<String>` | `parseCookie(String header, String name)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### LEGACY_COOKIE

          public static final String LEGACY_COOKIE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### CookieHelper

          public CookieHelper()

  - ### Method Detail

    - #### addCookie

          public static void addCookie(String name,
                                       String value,
                                       String path,
                                       String domain,
                                       String comment,
                                       int maxAge,
                                       boolean secure,
                                       boolean httpOnly,
                                       ServerCookie.SameSiteAttributeValue sameSite)

      Set a response cookie. This solely exists because JAX-RS 1.1 does not support setting HttpOnly cookies
      Parameters:
        `name` -
        `value` -
        `path` -
        `domain` -
        `comment` -
        `maxAge` -
        `secure` -
        `httpOnly` -
        `sameSite` -

    - #### addCookie

          public static void addCookie(String name,
                                       String value,
                                       String path,
                                       String domain,
                                       String comment,
                                       int maxAge,
                                       boolean secure,
                                       boolean httpOnly)

      Set a response cookie avoiding SameSite parameter
      Parameters:
        `name` -
        `value` -
        `path` -
        `domain` -
        `comment` -
        `maxAge` -
        `secure` -
        `httpOnly` -

    - #### getCookieValue

          public static Set<String> getCookieValue(String name)

    - #### parseCookie

          public static Set<String> parseCookie(String header,
                                                String name)

    - #### getCookie

          public static javax.ws.rs.core.Cookie getCookie(Map<String,javax.ws.rs.core.Cookie> cookies,
                                                          String name)

Copyright © 2020 JBoss by Red Hat. All rights reserved.