GUACAMOLE-197: Fix a couple of style issues and add the username variable to the RadiusChallengeResponseField class. Fixes build error.

This commit is contained in:
Nick Couchman
2017-02-06 11:57:25 -05:00
committed by Nick Couchman
parent d8f6422e28
commit f7dda23b05
2 changed files with 7 additions and 5 deletions

View File

@@ -122,17 +122,18 @@ public class AuthenticationProviderService {
try { try {
String replyMsg = radPack.getAttributeValue("Reply-Message").toString(); String replyMsg = radPack.getAttributeValue("Reply-Message").toString();
String radState = radPack.getAttributeValue("State").toString(); String radState = radPack.getAttributeValue("State").toString();
logger.debug("RADIUS sent challenge response: {}", replyMsg); logger.debug("RADIUS sent challenge: {}", replyMsg);
logger.debug("RADIUS sent state: {}", radState); logger.debug("RADIUS sent state: {}", radState);
Field radiusResponseField = new RadiusChallengeResponseField(credentials.getUsername(), replyMsg, radState); Field radiusResponseField = new RadiusChallengeResponseField(credentials.getUsername(), replyMsg, radState);
CredentialsInfo expectedCredentials = new CredentialsInfo(Collections.singletonList(radiusResponseField)); CredentialsInfo expectedCredentials = new CredentialsInfo(Collections.singletonList(radiusResponseField));
throw new GuacamoleInsufficientCredentialsException("LOGIN.INFO_RADIUS_ADDL_REQUIRED", expectedCredentials); throw new GuacamoleInsufficientCredentialsException("LOGIN.INFO_RADIUS_ADDL_REQUIRED", expectedCredentials);
} }
catch(UnknownAttributeException e) { catch(UnknownAttributeException e) {
logger.error("Error in talks with RADIUS server."); logger.error("Error in talks with RADIUS server.");
logger.debug("RADIUS challenged by didn't provide right attributes."); logger.debug("RADIUS challenged by didn't provide right attributes.");
throw new GuacamoleInvalidCredentialsException("Authentication error.", CredentialsInfo.USERNAME_PASSWORD); return null;
} // throw new GuacamoleInvalidCredentialsException("Authentication error.", CredentialsInfo.USERNAME_PASSWORD);
}
} }
// If we receive AccessAccept, authentication has succeeded // If we receive AccessAccept, authentication has succeeded

View File

@@ -44,6 +44,7 @@ public class RadiusChallengeResponseField extends Field {
/** /**
* The username used for the RADIUS authentication attempt. * The username used for the RADIUS authentication attempt.
*/ */
private final String username;
/** /**
* The state of the connection passed by the previous RADIUS attempt. * The state of the connection passed by the previous RADIUS attempt.