Package org.apache.commons.vfs2.util
Class UserAuthenticatorUtils
java.lang.Object
org.apache.commons.vfs2.util.UserAuthenticatorUtils
Helps with authentication.
-
Method Summary
Modifier and TypeMethodDescriptionstatic UserAuthenticationData
authenticate
(FileSystemOptions options, UserAuthenticationData.Type[] authenticatorTypes) Authenticates if there is an authenticator, else returns null.static UserAuthenticationData
authenticate
(UserAuthenticator auth, UserAuthenticationData.Type[] authenticatorTypes) Authenticates if there is an authenticator, else returns null.static void
cleanup
(UserAuthenticationData authData) Cleans up the data in the UerAuthenticationData (null-safe).static char[]
getData
(UserAuthenticationData data, UserAuthenticationData.Type type, char[] overriddenValue) Gets data of given type from the UserAuthenticationData or null if there is no data or data of this type available.static char[]
Converts a string to a char array (null-safe).static String
toString
(char[] data) Converts the given data to a string (null-safe).
-
Method Details
-
authenticate
public static UserAuthenticationData authenticate(FileSystemOptions options, UserAuthenticationData.Type[] authenticatorTypes) Authenticates if there is an authenticator, else returns null.- Parameters:
options
- The FileSystemOptions.authenticatorTypes
- An array of types describing the data to be retrieved.- Returns:
- A UserAuthenticationData object containing the data requested.
-
authenticate
public static UserAuthenticationData authenticate(UserAuthenticator auth, UserAuthenticationData.Type[] authenticatorTypes) Authenticates if there is an authenticator, else returns null.- Parameters:
auth
- The UserAuthenticator.authenticatorTypes
- An array of types describing the data to be retrieved.- Returns:
- A UserAuthenticationData object containing the data requested.
-
cleanup
Cleans up the data in the UerAuthenticationData (null-safe).- Parameters:
authData
- The UserAuthenticationDAta.
-
getData
public static char[] getData(UserAuthenticationData data, UserAuthenticationData.Type type, char[] overriddenValue) Gets data of given type from the UserAuthenticationData or null if there is no data or data of this type available.- Parameters:
data
- The UserAuthenticationData.type
- The type of the element to retrieve.overriddenValue
- The default value.- Returns:
- The data of the given type as a character array or null if the data is not available.
-
toChar
Converts a string to a char array (null-safe).- Parameters:
string
- The String to convert.- Returns:
- The character array.
-
toString
Converts the given data to a string (null-safe).- Parameters:
data
- A character array containing the data to convert to a String.- Returns:
- The String.
-