diff --git a/extensions/guacamole-auth-radius/src/main/java/org/apache/guacamole/auth/radius/AuthenticationProviderService.java b/extensions/guacamole-auth-radius/src/main/java/org/apache/guacamole/auth/radius/AuthenticationProviderService.java index e4965b2a1..ac937168f 100644 --- a/extensions/guacamole-auth-radius/src/main/java/org/apache/guacamole/auth/radius/AuthenticationProviderService.java +++ b/extensions/guacamole-auth-radius/src/main/java/org/apache/guacamole/auth/radius/AuthenticationProviderService.java @@ -124,9 +124,9 @@ public class AuthenticationProviderService { String radState = radPack.getAttributeValue("State").toString(); logger.debug("RADIUS sent challenge response: {}", replyMsg); logger.debug("RADIUS sent state: {}", radState); - Field radiusResponseField = new RadiusChallengeResponseField(replyMsg, radState); - CredentialsInfo responseCredentials = new CredentialsInfo(Collections.singletonList(radiusResponseField)); - throw new GuacamoleInsufficientCredentialsException("LOGIN.INFO_RADIUS_ADDL_REQUIRED", responseCredentials); + Field radiusResponseField = new RadiusChallengeResponseField(credentials.getUsername(), replyMsg, radState); + CredentialsInfo expectedCredentials = new CredentialsInfo(Collections.singletonList(radiusResponseField)); + throw new GuacamoleInsufficientCredentialsException("LOGIN.INFO_RADIUS_ADDL_REQUIRED", expectedCredentials); } catch(UnknownAttributeException e) { logger.error("Error in talks with RADIUS server."); diff --git a/extensions/guacamole-auth-radius/src/main/java/org/apache/guacamole/auth/radius/form/RadiusChallengeResponseField.java b/extensions/guacamole-auth-radius/src/main/java/org/apache/guacamole/auth/radius/form/RadiusChallengeResponseField.java index 2c7bba613..9c27ecc9f 100644 --- a/extensions/guacamole-auth-radius/src/main/java/org/apache/guacamole/auth/radius/form/RadiusChallengeResponseField.java +++ b/extensions/guacamole-auth-radius/src/main/java/org/apache/guacamole/auth/radius/form/RadiusChallengeResponseField.java @@ -41,6 +41,10 @@ public class RadiusChallengeResponseField extends Field { */ 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. */ @@ -54,15 +58,20 @@ public class RadiusChallengeResponseField extends Field { /** * 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); logger.debug("Initializing the RADIUS challenge/response field: {}", replyMsg); + this.username = username; this.replyMsg = replyMsg; this.radiusState = radiusState; } + public String getUsername() { + return username; + } + public String getRadiusState() { return radiusState; }