GUACAMOLE-197: Change credentials variable to expectedCredentials for consistency; add username to the response field.

This commit is contained in:
Nick Couchman
2017-02-06 09:03:56 -05:00
committed by Nick Couchman
parent 2175c21ff5
commit d8f6422e28
2 changed files with 13 additions and 4 deletions

View File

@@ -124,9 +124,9 @@ public class AuthenticationProviderService {
String radState = radPack.getAttributeValue("State").toString(); String radState = radPack.getAttributeValue("State").toString();
logger.debug("RADIUS sent challenge response: {}", replyMsg); logger.debug("RADIUS sent challenge response: {}", replyMsg);
logger.debug("RADIUS sent state: {}", radState); logger.debug("RADIUS sent state: {}", radState);
Field radiusResponseField = new RadiusChallengeResponseField(replyMsg, radState); Field radiusResponseField = new RadiusChallengeResponseField(credentials.getUsername(), replyMsg, radState);
CredentialsInfo responseCredentials = new CredentialsInfo(Collections.singletonList(radiusResponseField)); CredentialsInfo expectedCredentials = new CredentialsInfo(Collections.singletonList(radiusResponseField));
throw new GuacamoleInsufficientCredentialsException("LOGIN.INFO_RADIUS_ADDL_REQUIRED", responseCredentials); 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.");

View File

@@ -41,6 +41,10 @@ public class RadiusChallengeResponseField extends Field {
*/ */
private static final String RADIUS_FIELD_TYPE = "GUAC_RADIUS_CHALLENGE_RESPONSE"; private static final String RADIUS_FIELD_TYPE = "GUAC_RADIUS_CHALLENGE_RESPONSE";
/**
* The username used for the RADIUS authentication attempt.
*/
/** /**
* The state of the connection passed by the previous RADIUS attempt. * The state of the connection passed by the previous RADIUS attempt.
*/ */
@@ -54,15 +58,20 @@ public class RadiusChallengeResponseField extends Field {
/** /**
* Initialize the field with the reply message and the state. * Initialize the field with the reply message and the state.
*/ */
public RadiusChallengeResponseField(String replyMsg, String radiusState) { public RadiusChallengeResponseField(String username, String replyMsg, String radiusState) {
super(RADIUS_FIELD_NAME, RADIUS_FIELD_TYPE); super(RADIUS_FIELD_NAME, RADIUS_FIELD_TYPE);
logger.debug("Initializing the RADIUS challenge/response field: {}", replyMsg); logger.debug("Initializing the RADIUS challenge/response field: {}", replyMsg);
this.username = username;
this.replyMsg = replyMsg; this.replyMsg = replyMsg;
this.radiusState = radiusState; this.radiusState = radiusState;
} }
public String getUsername() {
return username;
}
public String getRadiusState() { public String getRadiusState() {
return radiusState; return radiusState;
} }