Repository: guacamole-client Updated Branches: refs/heads/master 312e0bb1e -> 4a9560358
GUACAMOLE-457: include CAS login URI when requesting auth ticket Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/201f07ab Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/201f07ab Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/201f07ab Branch: refs/heads/master Commit: 201f07abfdbe9d425368861e0e14638ff0bcfccb Parents: 312e0bb Author: Carl Harris <cehar...@vt.edu> Authored: Thu Dec 7 17:51:41 2017 -0500 Committer: Carl Harris <cehar...@vt.edu> Committed: Thu Dec 7 17:51:41 2017 -0500 ---------------------------------------------------------------------- .../guacamole/auth/cas/form/CASTicketField.java | 23 ++++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/201f07ab/extensions/guacamole-auth-cas/src/main/java/org/apache/guacamole/auth/cas/form/CASTicketField.java ---------------------------------------------------------------------- diff --git a/extensions/guacamole-auth-cas/src/main/java/org/apache/guacamole/auth/cas/form/CASTicketField.java b/extensions/guacamole-auth-cas/src/main/java/org/apache/guacamole/auth/cas/form/CASTicketField.java index 2fb96b0..eb0f68e 100644 --- a/extensions/guacamole-auth-cas/src/main/java/org/apache/guacamole/auth/cas/form/CASTicketField.java +++ b/extensions/guacamole-auth-cas/src/main/java/org/apache/guacamole/auth/cas/form/CASTicketField.java @@ -41,6 +41,12 @@ public class CASTicketField extends Field { 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. */ private final String authorizationURI; @@ -57,11 +63,6 @@ public class CASTicketField extends Field { * The full URL of the endpoint accepting CAS authentication * 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 * The URI that the CAS service should redirect to upon successful * authentication. @@ -73,8 +74,16 @@ public class CASTicketField extends Field { // Build authorization URI from given values try { - this.authorizationURI = authorizationEndpoint - + "?service=" + URLEncoder.encode(redirectURI, "UTF-8"); + final StringBuilder sb = new StringBuilder(); + 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