GUACAMOLE-457: include CAS login URI when requesting auth ticket

This commit is contained in:
Carl Harris
2017-12-07 17:51:41 -05:00
parent 312e0bb1e3
commit 201f07abfd

View File

@@ -40,6 +40,12 @@ public class CASTicketField extends Field {
*/ */
public static final String PARAMETER_NAME = "ticket"; public static final String PARAMETER_NAME = "ticket";
/**
* The standard URI name for the CAS login resource.
*/
private static final String CAS_LOGIN_URI = "login";
/** /**
* The full URI which the field should link to. * The full URI which the field should link to.
*/ */
@@ -57,11 +63,6 @@ public class CASTicketField extends Field {
* The full URL of the endpoint accepting CAS authentication * The full URL of the endpoint accepting CAS authentication
* requests. * requests.
* *
* @param clientID
* The ID of the CAS client. This is normally determined ahead of
* time by the CAS service through some manual credential request
* procedure.
*
* @param redirectURI * @param redirectURI
* The URI that the CAS service should redirect to upon successful * The URI that the CAS service should redirect to upon successful
* authentication. * authentication.
@@ -73,8 +74,16 @@ public class CASTicketField extends Field {
// Build authorization URI from given values // Build authorization URI from given values
try { try {
this.authorizationURI = authorizationEndpoint final StringBuilder sb = new StringBuilder();
+ "?service=" + URLEncoder.encode(redirectURI, "UTF-8"); sb.append(authorizationEndpoint);
// user might configure the endpoint with a trailing slash
if (sb.charAt(sb.length() - 1) != '/') {
sb.append('/');
}
sb.append(CAS_LOGIN_URI);
sb.append("?service=");
sb.append(URLEncoder.encode(redirectURI, "UTF-8"));
this.authorizationURI = sb.toString();
} }
// Java is required to provide UTF-8 support // Java is required to provide UTF-8 support