Class SecurityCookieGenerator

java.lang.Object
org.deltava.security.SecurityCookieGenerator

public final class SecurityCookieGenerator extends Object
A class to generate/interpret cookies to store persistent authentication information. Cookie data is defined as uid:userID@pwd:password@addr:IP@expiry:date @x:screenX@y:screenY. There is an additional parameter md5 which is the MD5 signature of the above string encoded in Base64. The password is converted into hex bytes, and the entire string is encrypted using a SecretKeyEncryptor.
Since:
1.0
Version:
10.1
Author:
Luke
  • Method Details

    • init

      public static void init(SecretKeyEncryptor crypt)
      Initialize the security cookie generate with an initialized SecretKeyEncryptor.
      Parameters:
      crypt - the secret key encryptor
    • readCookie

      public static SecurityCookieData readCookie(String cookieText) throws SecurityException
      Parses a supplied security cookie value into its component parts.
      Parameters:
      cookieText - the Security Cookie value
      Returns:
      a SecurityCookieData bean
      Throws:
      SecurityException - if the cookie contains invalid data
    • getCookieData

      public static String getCookieData(SecurityCookieData scData)
      Generates the encrypted cookie.
      Parameters:
      scData - the cookie data
      Returns:
      the encrypted cookie.