Class UserNameUtils


  • public class UserNameUtils
    extends java.lang.Object
    It 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.String XROOTD_MAGIC_NAME  
    • Constructor Summary

      Constructors 
      Constructor Description
      UserNameUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      static java.lang.String checkUsernameValid​(java.lang.String username)
      Checks for POSIX compliance.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • XROOTD_MAGIC_NAME

        public static final java.lang.String XROOTD_MAGIC_NAME
        See Also:
        Constant Field Values
    • Constructor Detail

      • UserNameUtils

        public UserNameUtils()
    • Method Detail

      • checkUsernameValid

        public static java.lang.String checkUsernameValid​(java.lang.String username)
        Checks for POSIX compliance. Rejects null names 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.