Package org.glassfish.common.util
Class InputValidationUtil
- java.lang.Object
-
- org.glassfish.common.util.InputValidationUtil
-
public class InputValidationUtil extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringCR_ENCODED_STRING_LOWERstatic StringCR_ENCODED_STRING_UPPERstatic StringCRLF_ENCODED_STRING_LOWERstatic StringCRLF_ENCODED_STRING_UPPERstatic StringCRLF_STRING
-
Constructor Summary
Constructors Constructor Description InputValidationUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetSafeCookieHeaderValue(String headerValue)Return Cookie Http Header Value after suitable validationstatic StringgetSafeHeaderName(String headerName)Return Http Header Name after suitable validationstatic StringgetSafeHeaderValue(String headerValue)Return Http Header Value after suitable validationstatic StringremoveLinearWhiteSpaces(String input)Remove unwanted white spaces in the URL.static booleanvalidateStringforCRLF(String input)Validate the String for Header Injection Attack.
-
-
-
Field Detail
-
CRLF_ENCODED_STRING_LOWER
public static final String CRLF_ENCODED_STRING_LOWER
- See Also:
- Constant Field Values
-
CRLF_ENCODED_STRING_UPPER
public static final String CRLF_ENCODED_STRING_UPPER
- See Also:
- Constant Field Values
-
CR_ENCODED_STRING_LOWER
public static final String CR_ENCODED_STRING_LOWER
- See Also:
- Constant Field Values
-
CR_ENCODED_STRING_UPPER
public static final String CR_ENCODED_STRING_UPPER
- See Also:
- Constant Field Values
-
CRLF_STRING
public static final String CRLF_STRING
- See Also:
- Constant Field Values
-
-
Method Detail
-
validateStringforCRLF
public static boolean validateStringforCRLF(String input)
Validate the String for Header Injection Attack.- Parameters:
input- String to be validate- Returns:
- boolean
-
removeLinearWhiteSpaces
public static String removeLinearWhiteSpaces(String input)
Remove unwanted white spaces in the URL.- Parameters:
input- String to be stripped with whitespaces- Returns:
- String
-
getSafeHeaderName
public static String getSafeHeaderName(String headerName) throws Exception
Return Http Header Name after suitable validation- Parameters:
headerName- Header Name which should be validated before being set- Returns:
- String Header Name sanitized for CRLF attack
- Throws:
Exception
-
getSafeHeaderValue
public static String getSafeHeaderValue(String headerValue) throws Exception
Return Http Header Value after suitable validation- Parameters:
headerValue- Header Value which should be validated before being set- Returns:
- String Header Value sanitized for CRLF attack
- Throws:
Exception
-
getSafeCookieHeaderValue
public static String getSafeCookieHeaderValue(String headerValue) throws Exception
Return Cookie Http Header Value after suitable validation- Parameters:
headerValue- Header Value which should be validated before being set- Returns:
- String Header Value sanitized for CRLF attack
- Throws:
Exception
-
-