Class UserCredentials
- java.lang.Object
-
- org.apache.guacamole.net.auth.credentials.CredentialsInfo
-
- org.apache.guacamole.net.auth.credentials.UserCredentials
-
public class UserCredentials extends CredentialsInfo
A fully-valid set of credentials and associated values. Each instance of this object should describe a full set of parameter name/value pairs which can be used to authenticate successfully, even if that success depends on factors not described by this object.
-
-
Field Summary
-
Fields inherited from class org.apache.guacamole.net.auth.credentials.CredentialsInfo
EMPTY, PASSWORD, USERNAME, USERNAME_PASSWORD
-
-
Constructor Summary
Constructors Constructor Description UserCredentials(Collection<Field> fields)
Creates a new UserCredentials object which requires the given fields but does not yet have any defined values.UserCredentials(Collection<Field> fields, Map<String,String> values)
Creates a new UserCredentials object which requires the given fields and values.UserCredentials(CredentialsInfo info)
Creates a new UserCredentials object which requires fields described by the given CredentialsInfo but does not yet have any defined values.UserCredentials(CredentialsInfo info, Map<String,String> values)
Creates a new UserCredentials object which requires fields described by the given CredentialsInfo.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getValue(String name)
Returns the value defined by this UserCrendentials object for the field having the given name.String
getValue(Field field)
Returns the value defined by this UserCrendentials object for the given field.Map<String,String>
getValues()
Returns a map of field names to values which backs this UserCredentials object.String
removeValue(String name)
Removes (undefines) the value of the field having the given name, returning its previous value.String
removeValue(Field field)
Removes (undefines) the value of the given field returning its previous value.String
setValue(String name, String value)
Sets the value of the field having the given name.String
setValue(Field field, String value)
Sets the value of the given field.void
setValues(Map<String,String> values)
Replaces the map backing this UserCredentials object with the given map.-
Methods inherited from class org.apache.guacamole.net.auth.credentials.CredentialsInfo
getFields
-
-
-
-
Constructor Detail
-
UserCredentials
public UserCredentials(Collection<Field> fields, Map<String,String> values)
Creates a new UserCredentials object which requires the given fields and values.- Parameters:
fields
- The fields to require.values
- The values required for each field, as a map of field name to correct value.
-
UserCredentials
public UserCredentials(CredentialsInfo info, Map<String,String> values)
Creates a new UserCredentials object which requires fields described by the given CredentialsInfo. The value required for each field in the CredentialsInfo is defined in the given Map.- Parameters:
info
- The CredentialsInfo object describing the fields to require.values
- The values required for each field, as a map of field name to correct value.
-
UserCredentials
public UserCredentials(CredentialsInfo info)
Creates a new UserCredentials object which requires fields described by the given CredentialsInfo but does not yet have any defined values.- Parameters:
info
- The CredentialsInfo object describing the fields to require.
-
UserCredentials
public UserCredentials(Collection<Field> fields)
Creates a new UserCredentials object which requires the given fields but does not yet have any defined values.- Parameters:
fields
- The fields to require.
-
-
Method Detail
-
getValues
public Map<String,String> getValues()
Returns a map of field names to values which backs this UserCredentials object. Modifications to the returned map will directly affect the associated name/value pairs.- Returns:
- A map of field names to their corresponding values which backs this UserCredentials object.
-
setValues
public void setValues(Map<String,String> values)
Replaces the map backing this UserCredentials object with the given map. All field name/value pairs described by the original map are replaced by the name/value pairs in the given map.- Parameters:
values
- The map of field names to their corresponding values which should be used to back this UserCredentials object.
-
getValue
public String getValue(String name)
Returns the value defined by this UserCrendentials object for the field having the given name.- Parameters:
name
- The name of the field whose value should be returned.- Returns:
- The value of the field having the given name, or null if no value is defined for that field.
-
getValue
public String getValue(Field field)
Returns the value defined by this UserCrendentials object for the given field.- Parameters:
field
- The field whose value should be returned.- Returns:
- The value of the given field, or null if no value is defined for that field.
-
setValue
public String setValue(String name, String value)
Sets the value of the field having the given name. Any existing value for that field is replaced.- Parameters:
name
- The name of the field whose value should be assigned.value
- The value to assign to the field having the given name.- Returns:
- The previous value of the field, or null if the value of the field was not previously defined.
-
setValue
public String setValue(Field field, String value)
Sets the value of the given field. Any existing value for that field is replaced.- Parameters:
field
- The field whose value should be assigned.value
- The value to assign to the given field.- Returns:
- The previous value of the field, or null if the value of the field was not previously defined.
-
removeValue
public String removeValue(String name)
Removes (undefines) the value of the field having the given name, returning its previous value. If the field value was not defined, this function has no effect, and null is returned.- Parameters:
name
- The name of the field whose value should be removed.- Returns:
- The previous value of the field, or null if the value of the field was not previously defined.
-
removeValue
public String removeValue(Field field)
Removes (undefines) the value of the given field returning its previous value. If the field value was not defined, this function has no effect, and null is returned.- Parameters:
field
- The field whose value should be removed.- Returns:
- The previous value of the field, or null if the value of the field was not previously defined.
-
-