GUACAMOLE-524: Fixed up code style and comments

Also added Override tag in AbstractAuthenticatedUser on getAttributes
and setAttributes.
This commit is contained in:
Jared Frees
2018-06-12 16:21:52 -04:00
parent 36bbdce7b1
commit 4791adaa46
5 changed files with 8 additions and 20 deletions

View File

@@ -197,7 +197,8 @@ public class AuthenticationProviderService {
/**
* Returns an AuthenticatedUser representing the user authenticated by the
* given credentials. Also adds custom LDAP attributes to credentials object.
* given credentials. Also adds custom LDAP attributes to the
* AuthenticatedUser.
*
* @param credentials
* The credentials to use for authentication.
@@ -233,7 +234,7 @@ public class AuthenticationProviderService {
AuthenticatedUser authenticatedUser = authenticatedUserProvider.get();
authenticatedUser.init(credentials);
//set attributes
// Set attributes
String username = credentials.getUsername();
Map<String, String> attrs = getLDAPAttributes(ldapConnection, username);
authenticatedUser.setAttributes(attrs);
@@ -293,9 +294,7 @@ public class AuthenticationProviderService {
// Add each attribute into Map
for (Object attrObj : attrSet) {
LDAPAttribute attr = (LDAPAttribute)attrObj;
String attrName = attr.getName();
String attrValue = attr.getStringValue();
attrMap.put(attrName, attrValue);
attrMap.put(attr.getName(), attr.getStringValue());
}
}
catch (LDAPException e) {

View File

@@ -348,8 +348,7 @@ public class ConfigurationService {
* Returns names for custom LDAP user attributes.
*
* @return
* LDAP user attributes as defined in the guacamole.properties file
* as ldap-user-attributes: ''
* Custom LDAP user attributes as configured in guacamole.properties.
*
* @throws GuacamoleException
* If guacamole.properties cannot be parsed.

View File

@@ -61,24 +61,11 @@ public class AuthenticatedUser extends AbstractAuthenticatedUser {
setIdentifier(credentials.getUsername());
}
/**
* Get a map of attributes associated with this AuthenticatedUser.
*
* @return
* The Map of arbitrary attributes associated with this
* AuthenticatedUser object.
*/
@Override
public Map<String, String> getAttributes() {
return attributes;
}
/**
* Sets a map of attributes associated with this AuthenticatedUser.
*
* @param attributes
* A map of attribute key/value pairs to add to this AuthenticatedUser.
*/
@Override
public void setAttributes(Map<String, String> attributes) {
this.attributes = attributes;

View File

@@ -42,10 +42,12 @@ public abstract class AbstractAuthenticatedUser extends AbstractIdentifiable
// Nothing to invalidate
}
@Override
public Map<String, String> getAttributes() {
return Collections.<String, String>emptyMap();
}
@Override
public void setAttributes(Map<String, String> attributes) {
//do nothing
}

View File

@@ -25,6 +25,7 @@ import java.util.Map;
import java.util.Set;
import org.apache.guacamole.net.auth.AuthenticatedUser;
import org.apache.guacamole.net.auth.Credentials;
/**
* Utility class which provides access to standardized token names, as well as
* facilities for generating those tokens from common objects.