Package ninja.utils
Class CookieDataCodec
- java.lang.Object
-
- ninja.utils.CookieDataCodec
-
public class CookieDataCodec extends Object
CookieDataCodec and CookieDataCodecTest are imported from Play Framework. Enables us to use the same sessions as Play Framework if the secret is the same. Also really important because we want to make sure that our client side session mechanism is widely used and stable. We don't want to reinvent the wheel of securely encoding / decoding and signing cookie data. All praise goes to Play Framework and their awesome work.
-
-
Constructor Summary
Constructors Constructor Description CookieDataCodec()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
decode(Map<String,String> map, String data)
static String
encode(Map<String,String> map)
static boolean
safeEquals(String a, String b)
Constant time for same length String comparison, to prevent timing attacks
-
-
-
Method Detail
-
decode
public static void decode(Map<String,String> map, String data) throws UnsupportedEncodingException
- Parameters:
map
- the map to decode data into.data
- the data to decode.- Throws:
UnsupportedEncodingException
-
encode
public static String encode(Map<String,String> map) throws UnsupportedEncodingException
- Parameters:
map
- the data to encode.- Returns:
- the encoded data.
- Throws:
UnsupportedEncodingException
-
-