GUACAMOLE-300: conform to guac-style style guidelines

https://guacamole.apache.org/guac-style/
This commit is contained in:
Magnus Lewis-Smith
2019-10-23 12:28:16 +01:00
parent 450af91be9
commit 41fec2793d
5 changed files with 22 additions and 13 deletions

View File

@@ -384,7 +384,8 @@ public class ConfigurationService {
* @throws GuacamoleException * @throws GuacamoleException
* If guacamole.properties cannot be parsed. * If guacamole.properties cannot be parsed.
*/ */
public MemberAttributeType getMemberAttributeType() throws GuacamoleException { public MemberAttributeType getMemberAttributeType()
throws GuacamoleException {
return environment.getProperty( return environment.getProperty(
LDAPGuacamoleProperties.LDAP_MEMBER_ATTRIBUTE_TYPE, LDAPGuacamoleProperties.LDAP_MEMBER_ATTRIBUTE_TYPE,
MemberAttributeType.DN MemberAttributeType.DN

View File

@@ -259,7 +259,8 @@ public class LDAPGuacamoleProperties {
/** /**
* Specify the type of data contained in 'ldap-member-attribute' * Specify the type of data contained in 'ldap-member-attribute'
*/ */
public static final MemberAttributeTypeProperty LDAP_MEMBER_ATTRIBUTE_TYPE = new MemberAttributeTypeProperty() { public static final MemberAttributeTypeProperty LDAP_MEMBER_ATTRIBUTE_TYPE =
new MemberAttributeTypeProperty() {
@Override @Override
public String getName() { return "ldap-member-attribute-type"; } public String getName() { return "ldap-member-attribute-type"; }

View File

@@ -20,7 +20,8 @@
package org.apache.guacamole.auth.ldap.conf; package org.apache.guacamole.auth.ldap.conf;
/** /**
* All possible means of describing membership within LDAP group directory records. * All possible means of describing membership within
* LDAP group directory records.
*/ */
public enum MemberAttributeType { public enum MemberAttributeType {
/** /**

View File

@@ -28,10 +28,12 @@ import org.apache.guacamole.properties.GuacamoleProperty;
* strings "dn" or "uid" are mapped to their values as a MemberAttributeType * strings "dn" or "uid" are mapped to their values as a MemberAttributeType
* enum. Anything else results in a parse error. * enum. Anything else results in a parse error.
*/ */
public abstract class MemberAttributeTypeProperty implements GuacamoleProperty<MemberAttributeType> { public abstract class MemberAttributeTypeProperty
implements GuacamoleProperty<MemberAttributeType> {
@Override @Override
public MemberAttributeType parseValue(String value) throws GuacamoleException { public MemberAttributeType parseValue(String value)
throws GuacamoleException {
// If no value provided, return null. // If no value provided, return null.
if (value == null) if (value == null)
@@ -46,7 +48,8 @@ public abstract class MemberAttributeTypeProperty implements GuacamoleProperty<M
return MemberAttributeType.UID; return MemberAttributeType.UID;
// The provided value is not legal // The provided value is not legal
throw new GuacamoleServerException("Member attribute type must be one of \"dn\" or \"uid\"."); throw new GuacamoleServerException("Member attribute type must be "
+ "one of \"dn\" or \"uid\".");
} }

View File

@@ -188,19 +188,22 @@ public class UserGroupService {
confService.getUserSearchFilter(), confService.getUserSearchFilter(),
0); 0);
// ... there can surely only be one // ... there can surely only be one
if (userEntries.size() != 1) { if (userEntries.size() != 1)
logger.warn("user DN \"{}\" does not return unique value and will be ignored", logger.warn("user DN \"{}\" does not return unique value "
userDN.toString()); + "and will be ignored", userDN.toString());
} else { else {
// determine unique identifier for user // determine unique identifier for user
Entry userEntry = userEntries.get(0); Entry userEntry = userEntries.get(0);
Collection<String> userAttributes = confService.getUsernameAttributes(); Collection<String> userAttributes = confService.getUsernameAttributes();
try { try {
userIDorDN = queryService.getIdentifier(userEntry, userAttributes); userIDorDN = queryService.getIdentifier(userEntry,
userAttributes);
} }
catch (LdapInvalidAttributeValueException e) { catch (LdapInvalidAttributeValueException e) {
logger.error("User group missing identifier: {}", e.getMessage()); logger.error("User group missing identifier: {}",
logger.debug("LDAP exception while getting group identifier.", e); e.getMessage());
logger.debug("LDAP exception while getting "
+ "group identifier.", e);
} }
} }
} }