Package org.dcache.xrootd.util
Class UserNameUtils
- java.lang.Object
-
- org.dcache.xrootd.util.UserNameUtils
-
public class UserNameUtils extends java.lang.ObjectIt is possible to confuse the OpaqueStringParser by introducing Posix Non-Compliant UserNames. This utility guards against parser failure.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringXROOTD_MAGIC_NAME
-
Constructor Summary
Constructors Constructor Description UserNameUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringcheckAllUsernamesValid(java.lang.String string)Finds all segments/groups of the string which could potentially be usernames (bounded by '=' and '@'), and checks each for validity.static java.lang.StringcheckUsernameValid(java.lang.String username)Checks for POSIX compliance.
-
-
-
Field Detail
-
XROOTD_MAGIC_NAME
public static final java.lang.String XROOTD_MAGIC_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
checkUsernameValid
public static java.lang.String checkUsernameValid(java.lang.String username)
Checks for POSIX compliance. Rejectsnullnames but accepts zero-length names. If the name equals "????" it returns "_anon_"; if the name is otherwise invalid, it throws an exception; else it returns the name unchanged.- Parameters:
username- to validate.- Returns:
- "_anon_" if "????", or the valid name.
- Throws:
XrootdException- if the name is invalid.
-
checkAllUsernamesValid
public static java.lang.String checkAllUsernamesValid(java.lang.String string)
Finds all segments/groups of the string which could potentially be usernames (bounded by '=' and '@'), and checks each for validity. If the Xrootd Unknown marker is found ('????') it is replaced by ('_anon_'). If an invalid name is found in the string, the check fails. Otherwise, the valid names are left as they are.- Parameters:
string- original string to validate.- Returns:
- string with "magic" substitutions, if any.
- Throws:
XrootdException- if any name found in the string is invalid.
-
-