Class SecurityCookieGenerator
java.lang.Object
org.deltava.security.SecurityCookieGenerator
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 Summary
Modifier and TypeMethodDescriptionstatic String
getCookieData
(SecurityCookieData scData) Generates the encrypted cookie.static void
init
(SecretKeyEncryptor crypt) Initialize the security cookie generate with an initialized SecretKeyEncryptor.static SecurityCookieData
readCookie
(String cookieText) Parses a supplied security cookie value into its component parts.
-
Method Details
-
init
Initialize the security cookie generate with an initialized SecretKeyEncryptor.- Parameters:
crypt
- the secret key encryptor
-
readCookie
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
Generates the encrypted cookie.- Parameters:
scData
- the cookie data- Returns:
- the encrypted cookie.
-