diff --git a/extensions/guacamole-auth-cas/pom.xml b/extensions/guacamole-auth-cas/pom.xml
index 33cf45159..851001c8e 100644
--- a/extensions/guacamole-auth-cas/pom.xml
+++ b/extensions/guacamole-auth-cas/pom.xml
@@ -53,85 +53,6 @@
-
-
- com.keithbranton.mojo
- angular-maven-plugin
- 0.3.2
-
-
- generate-resources
-
- html2js
-
-
-
-
- ${basedir}/src/main/resources
- **/*.html
- ${basedir}/src/main/resources/generated/templates-main/templates.js
- app/ext/guac-cas
-
-
-
-
-
- com.samaxes.maven
- minify-maven-plugin
- 1.7.5
-
-
- default-cli
-
- UTF-8
-
- ${basedir}/src/main/resources
- ${project.build.directory}/classes
-
- /
- /
- cas.css
-
-
- license.txt
-
-
-
- **/*.css
-
-
- /
- /
- cas.js
-
-
- license.txt
-
-
-
- **/*.js
-
-
-
-
- **/*.test.js
-
- CLOSURE
-
-
-
- OFF
- OFF
-
-
-
-
- minify
-
-
-
-
-
org.apache.maven.plugins
diff --git a/extensions/guacamole-auth-cas/src/main/java/org/apache/guacamole/auth/cas/AuthenticationProviderService.java b/extensions/guacamole-auth-cas/src/main/java/org/apache/guacamole/auth/cas/AuthenticationProviderService.java
index ceab17479..9f171e8ac 100644
--- a/extensions/guacamole-auth-cas/src/main/java/org/apache/guacamole/auth/cas/AuthenticationProviderService.java
+++ b/extensions/guacamole-auth-cas/src/main/java/org/apache/guacamole/auth/cas/AuthenticationProviderService.java
@@ -33,6 +33,7 @@ import org.apache.guacamole.auth.cas.conf.ConfigurationService;
import org.apache.guacamole.auth.cas.form.CASTicketField;
import org.apache.guacamole.auth.cas.ticket.TicketValidationService;
import org.apache.guacamole.auth.cas.user.CASAuthenticatedUser;
+import org.apache.guacamole.language.TranslatableMessage;
/**
* Service providing convenience functions for the CAS AuthenticationProvider
@@ -99,7 +100,8 @@ public class AuthenticationProviderService {
// to the authorization page via JavaScript)
new CASTicketField(
confService.getAuthorizationEndpoint(),
- confService.getRedirectURI()
+ confService.getRedirectURI(),
+ new TranslatableMessage("LOGIN.INFO_CAS_REDIRECT_PENDING")
)
}))
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 c16f52598..a925dfcc3 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
@@ -21,7 +21,8 @@ package org.apache.guacamole.auth.cas.form;
import java.net.URI;
import javax.ws.rs.core.UriBuilder;
-import org.apache.guacamole.form.Field;
+import org.apache.guacamole.form.RedirectField;
+import org.apache.guacamole.language.TranslatableMessage;
/**
@@ -30,25 +31,18 @@ import org.apache.guacamole.form.Field;
* and then is returned to Guacamole where the ticket field is
* processed.
*/
-public class CASTicketField extends Field {
+public class CASTicketField extends RedirectField {
/**
- * The standard HTTP parameter which will be included within the URL by all
- * CAS services upon successful authentication and redirect.
+ * The parameter that will be present upon successful CAS authentication.
*/
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 URI authorizationURI;
-
/**
* Creates a new CAS "ticket" field which links to the given CAS
* service using the provided client ID. Successful authentication at the
@@ -64,28 +58,21 @@ public class CASTicketField extends Field {
* @param redirectURI
* The URI that the CAS service should redirect to upon successful
* authentication.
+ *
+ * @param redirectMessage
+ * The message that will be displayed for the user while the redirect
+ * is processed. This will be processed through Guacamole's translation
+ * system.
*/
- public CASTicketField(URI authorizationEndpoint, URI redirectURI) {
-
- // Init base field properties
- super(PARAMETER_NAME, "GUAC_CAS_TICKET");
+ public CASTicketField(URI authorizationEndpoint, URI redirectURI,
+ TranslatableMessage redirectMessage) {
- this.authorizationURI = UriBuilder.fromUri(authorizationEndpoint)
+ super(PARAMETER_NAME, UriBuilder.fromUri(authorizationEndpoint)
.path(CAS_LOGIN_URI)
.queryParam("service", redirectURI)
- .build();
+ .build(),
+ redirectMessage);
}
- /**
- * Returns the full URI that this field should link to when a new ticket
- * needs to be obtained from the CAS service.
- *
- * @return
- * The full URI that this field should link to.
- */
- public String getAuthorizationURI() {
- return authorizationURI.toString();
- }
-
}
diff --git a/extensions/guacamole-auth-cas/src/main/resources/casModule.js b/extensions/guacamole-auth-cas/src/main/resources/casModule.js
deleted file mode 100644
index c40e6b26c..000000000
--- a/extensions/guacamole-auth-cas/src/main/resources/casModule.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Module which provides handling for CAS authentication.
- */
-angular.module('guacCAS', [
- 'form'
-]);
-
-// Ensure the CAS module is loaded along with the rest of the app
-angular.module('index').requires.push('guacCAS');
diff --git a/extensions/guacamole-auth-cas/src/main/resources/config/casConfig.js b/extensions/guacamole-auth-cas/src/main/resources/config/casConfig.js
deleted file mode 100644
index 95356f773..000000000
--- a/extensions/guacamole-auth-cas/src/main/resources/config/casConfig.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Config block which registers CAS-specific field types.
- */
-angular.module('guacCAS').config(['formServiceProvider',
- function guacCASConfig(formServiceProvider) {
-
- // Define field for ticket from CAS service
- formServiceProvider.registerFieldType("GUAC_CAS_TICKET", {
- templateUrl : 'app/ext/guac-cas/templates/casTicketField.html',
- controller : 'guacCASController',
- module : 'guacCAS'
- });
-
-}]);
diff --git a/extensions/guacamole-auth-cas/src/main/resources/controllers/casController.js b/extensions/guacamole-auth-cas/src/main/resources/controllers/casController.js
deleted file mode 100644
index 3ef1801ab..000000000
--- a/extensions/guacamole-auth-cas/src/main/resources/controllers/casController.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Controller for the "GUAC_CAS_TICKET" field which simply redirects the user
- * immediately to the authorization URI.
- */
-angular.module('guacCAS').controller('guacCASController', ['$scope',
- function guacCASController($scope) {
-
- // Redirect to authorization URI
- window.location = $scope.field.authorizationURI;
-
-}]);
diff --git a/extensions/guacamole-auth-cas/src/main/resources/templates/casTicketField.html b/extensions/guacamole-auth-cas/src/main/resources/templates/casTicketField.html
deleted file mode 100644
index 55ca4bb4a..000000000
--- a/extensions/guacamole-auth-cas/src/main/resources/templates/casTicketField.html
+++ /dev/null
@@ -1,5 +0,0 @@
-
diff --git a/extensions/guacamole-auth-openid/pom.xml b/extensions/guacamole-auth-openid/pom.xml
index 762adf106..8cc5ab9b4 100644
--- a/extensions/guacamole-auth-openid/pom.xml
+++ b/extensions/guacamole-auth-openid/pom.xml
@@ -53,27 +53,6 @@
-
-
- com.keithbranton.mojo
- angular-maven-plugin
- 0.3.2
-
-
- generate-resources
-
- html2js
-
-
-
-
- ${basedir}/src/main/resources
- **/*.html
- ${basedir}/src/main/resources/generated/templates-main/templates.js
- app/ext/guac-openid
-
-
-
com.samaxes.maven
@@ -88,18 +67,6 @@
${basedir}/src/main/resources${project.build.directory}/classes
- /
- /
- openid.css
-
-
- license.txt
-
-
-
- **/*.css
-
-
//openid.js
diff --git a/extensions/guacamole-auth-openid/src/main/java/org/apache/guacamole/auth/openid/AuthenticationProviderService.java b/extensions/guacamole-auth-openid/src/main/java/org/apache/guacamole/auth/openid/AuthenticationProviderService.java
index 47d99fff6..83343269c 100644
--- a/extensions/guacamole-auth-openid/src/main/java/org/apache/guacamole/auth/openid/AuthenticationProviderService.java
+++ b/extensions/guacamole-auth-openid/src/main/java/org/apache/guacamole/auth/openid/AuthenticationProviderService.java
@@ -30,6 +30,7 @@ import org.apache.guacamole.auth.openid.token.TokenValidationService;
import org.apache.guacamole.auth.openid.user.AuthenticatedUser;
import org.apache.guacamole.GuacamoleException;
import org.apache.guacamole.form.Field;
+import org.apache.guacamole.language.TranslatableMessage;
import org.apache.guacamole.net.auth.Credentials;
import org.apache.guacamole.net.auth.credentials.CredentialsInfo;
import org.apache.guacamole.net.auth.credentials.GuacamoleInvalidCredentialsException;
@@ -121,7 +122,8 @@ public class AuthenticationProviderService {
confService.getScope(),
confService.getClientID(),
confService.getRedirectURI(),
- nonceService.generate(confService.getMaxNonceValidity() * 60000L)
+ nonceService.generate(confService.getMaxNonceValidity() * 60000L),
+ new TranslatableMessage("LOGIN.INFO_OID_PENDING_REDIRECT")
)
}))
diff --git a/extensions/guacamole-auth-openid/src/main/java/org/apache/guacamole/auth/openid/form/TokenField.java b/extensions/guacamole-auth-openid/src/main/java/org/apache/guacamole/auth/openid/form/TokenField.java
index b6ca18bd1..44d90a8fa 100644
--- a/extensions/guacamole-auth-openid/src/main/java/org/apache/guacamole/auth/openid/form/TokenField.java
+++ b/extensions/guacamole-auth-openid/src/main/java/org/apache/guacamole/auth/openid/form/TokenField.java
@@ -21,13 +21,14 @@ package org.apache.guacamole.auth.openid.form;
import java.net.URI;
import javax.ws.rs.core.UriBuilder;
-import org.apache.guacamole.form.Field;
+import org.apache.guacamole.form.RedirectField;
+import org.apache.guacamole.language.TranslatableMessage;
/**
* Field definition which represents the token returned by an OpenID Connect
* service.
*/
-public class TokenField extends Field {
+public class TokenField extends RedirectField {
/**
* The standard HTTP parameter which will be included within the URL by all
@@ -35,11 +36,6 @@ public class TokenField extends Field {
*/
public static final String PARAMETER_NAME = "id_token";
- /**
- * The full URI which the field should link to.
- */
- private final URI authorizationURI;
-
/**
* Creates a new field which requests authentication via OpenID connect.
* Successful authentication at the OpenID Connect service will result in
@@ -68,32 +64,24 @@ public class TokenField extends Field {
* @param nonce
* A random string unique to this request. To defend against replay
* attacks, this value must cease being valid after its first use.
+ *
+ * @param redirectMessage
+ * The message that will be displayed to the user during redirect. This
+ * will be processed through Guacamole's translation system.
*/
public TokenField(URI authorizationEndpoint, String scope,
- String clientID, URI redirectURI, String nonce) {
+ String clientID, URI redirectURI, String nonce,
+ TranslatableMessage redirectMessage) {
- // Init base field properties
- super(PARAMETER_NAME, "GUAC_OPENID_TOKEN");
-
- this.authorizationURI = UriBuilder.fromUri(authorizationEndpoint)
+ super(PARAMETER_NAME, UriBuilder.fromUri(authorizationEndpoint)
.queryParam("scope", scope)
.queryParam("response_type", "id_token")
.queryParam("client_id", clientID)
.queryParam("redirect_uri", redirectURI)
.queryParam("nonce", nonce)
- .build();
+ .build(),
+ redirectMessage);
}
- /**
- * Returns the full URI that this field should link to when a new token
- * needs to be obtained from the OpenID service.
- *
- * @return
- * The full URI that this field should link to.
- */
- public String getAuthorizationURI() {
- return authorizationURI.toString();
- }
-
}
diff --git a/extensions/guacamole-auth-openid/src/main/resources/config/openidConfig.js b/extensions/guacamole-auth-openid/src/main/resources/config/openidConfig.js
deleted file mode 100644
index 5d0b6b22f..000000000
--- a/extensions/guacamole-auth-openid/src/main/resources/config/openidConfig.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Config block which registers openid-specific field types.
- */
-angular.module('guacOpenID').config(['formServiceProvider',
- function guacOpenIDConfig(formServiceProvider) {
-
- // Define field for token from OpenID service
- formServiceProvider.registerFieldType("GUAC_OPENID_TOKEN", {
- templateUrl : 'app/ext/guac-openid/templates/openidTokenField.html',
- controller : 'guacOpenIDController',
- module : 'guacOpenID'
- });
-
-}]);
diff --git a/extensions/guacamole-auth-openid/src/main/resources/guac-manifest.json b/extensions/guacamole-auth-openid/src/main/resources/guac-manifest.json
index c29633ab6..fbf5d665a 100644
--- a/extensions/guacamole-auth-openid/src/main/resources/guac-manifest.json
+++ b/extensions/guacamole-auth-openid/src/main/resources/guac-manifest.json
@@ -18,14 +18,6 @@
"js" : [
"openid.min.js"
- ],
-
- "css" : [
- "openid.min.css"
- ],
-
- "resources" : {
- "templates/openidTokenField.html" : "text/html"
- }
+ ]
}
diff --git a/extensions/guacamole-auth-openid/src/main/resources/openidModule.js b/extensions/guacamole-auth-openid/src/main/resources/openidModule.js
deleted file mode 100644
index e8fce23e2..000000000
--- a/extensions/guacamole-auth-openid/src/main/resources/openidModule.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Module which provides handling for OpenID authentication.
- */
-angular.module('guacOpenID', [
- 'form'
-]);
-
-// Ensure the OpenID module is loaded along with the rest of the app
-angular.module('index').requires.push('guacOpenID');
diff --git a/extensions/guacamole-auth-openid/src/main/resources/styles/openid.css b/extensions/guacamole-auth-openid/src/main/resources/styles/openid.css
deleted file mode 100644
index eab7f935d..000000000
--- a/extensions/guacamole-auth-openid/src/main/resources/styles/openid.css
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-.openid-token-field-container {
- height: 100%;
- width: 100%;
- position: fixed;
- left: 0;
- top: 0;
- display: table;
- background: white;
-}
-
-.openid-token-field {
- width: 100%;
- display: table-cell;
- vertical-align: middle;
- text-align: center;
-}
diff --git a/extensions/guacamole-auth-openid/src/main/resources/templates/openidTokenField.html b/extensions/guacamole-auth-openid/src/main/resources/templates/openidTokenField.html
deleted file mode 100644
index 49f6c6f0a..000000000
--- a/extensions/guacamole-auth-openid/src/main/resources/templates/openidTokenField.html
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
{{ 'LOGIN.INFO_REDIRECT_PENDING' | translate }}
-
-
diff --git a/extensions/guacamole-auth-openid/src/main/resources/transformToken.js b/extensions/guacamole-auth-openid/src/main/resources/transformToken.js
index b65d2fde4..b0c0887a7 100644
--- a/extensions/guacamole-auth-openid/src/main/resources/transformToken.js
+++ b/extensions/guacamole-auth-openid/src/main/resources/transformToken.js
@@ -28,6 +28,7 @@
* parameter in the first position; it may occur after several other parameters
* within the fragment.
*/
+
(function guacOpenIDTransformToken() {
if (/^#(?![?\/])(.*&)?id_token=/.test(location.hash))
location.hash = '/?' + location.hash.substring(1);
diff --git a/extensions/guacamole-auth-openid/src/main/resources/translations/de.json b/extensions/guacamole-auth-openid/src/main/resources/translations/de.json
index decd5b1fb..cad78677f 100644
--- a/extensions/guacamole-auth-openid/src/main/resources/translations/de.json
+++ b/extensions/guacamole-auth-openid/src/main/resources/translations/de.json
@@ -1,12 +1,7 @@
{
- "DATA_SOURCE_OPENID" : {
- "NAME" : "OpenID SSO Backend"
- },
-
"LOGIN" : {
- "FIELD_HEADER_ID_TOKEN" : "",
- "INFO_REDIRECT_PENDING" : "Bitte warten, Sie werden zum Identitätsprovider weitergeleitet..."
+ "INFO_OID_REDIRECT_PENDING" : "Bitte warten, Sie werden zum Identitätsprovider weitergeleitet..."
}
}
diff --git a/extensions/guacamole-auth-openid/src/main/resources/translations/en.json b/extensions/guacamole-auth-openid/src/main/resources/translations/en.json
index 6bc52410e..d88c24a47 100644
--- a/extensions/guacamole-auth-openid/src/main/resources/translations/en.json
+++ b/extensions/guacamole-auth-openid/src/main/resources/translations/en.json
@@ -6,7 +6,7 @@
"LOGIN" : {
"FIELD_HEADER_ID_TOKEN" : "",
- "INFO_REDIRECT_PENDING" : "Please wait, redirecting to identity provider..."
+ "INFO_OID_REDIRECT_PENDING" : "Please wait, redirecting to identity provider..."
}
}
diff --git a/extensions/guacamole-auth-openid/src/main/resources/translations/ja.json b/extensions/guacamole-auth-openid/src/main/resources/translations/ja.json
index 9a5b518f6..d089ad573 100644
--- a/extensions/guacamole-auth-openid/src/main/resources/translations/ja.json
+++ b/extensions/guacamole-auth-openid/src/main/resources/translations/ja.json
@@ -1,7 +1,7 @@
{
"LOGIN" : {
- "INFO_REDIRECT_PENDING" : "IDプロバイダへリダイレクトしています。"
+ "INFO_OID_REDIRECT_PENDING" : "IDプロバイダへリダイレクトしています。"
}
}
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/form/Field.java b/guacamole-ext/src/main/java/org/apache/guacamole/form/Field.java
index d35facdfe..d583f6f78 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/form/Field.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/form/Field.java
@@ -45,51 +45,51 @@ public class Field {
/**
* A text field, accepting arbitrary values.
*/
- public static String TEXT = "TEXT";
+ public static final String TEXT = "TEXT";
/**
* An email address field. This field type generally behaves
* identically to arbitrary text fields, but has semantic differences.
*/
- public static String EMAIL = "EMAIL";
+ public static final String EMAIL = "EMAIL";
/**
* A username field. This field type generally behaves identically to
* arbitrary text fields, but has semantic differences.
*/
- public static String USERNAME = "USERNAME";
+ public static final String USERNAME = "USERNAME";
/**
* A password field, whose value is sensitive and must be hidden.
*/
- public static String PASSWORD = "PASSWORD";
+ public static final String PASSWORD = "PASSWORD";
/**
* A numeric field, whose value must contain only digits.
*/
- public static String NUMERIC = "NUMERIC";
+ public static final String NUMERIC = "NUMERIC";
/**
* A boolean field, whose value is either blank or "true".
*/
- public static String BOOLEAN = "BOOLEAN";
+ public static final String BOOLEAN = "BOOLEAN";
/**
* An enumerated field, whose legal values are fully enumerated by a
* provided, finite list.
*/
- public static String ENUM = "ENUM";
+ public static final String ENUM = "ENUM";
/**
* A text field that can span more than one line.
*/
- public static String MULTILINE = "MULTILINE";
+ public static final String MULTILINE = "MULTILINE";
/**
* A time zone field whose legal values are only valid time zone IDs,
* as dictated by Java within TimeZone.getAvailableIDs().
*/
- public static String TIMEZONE = "TIMEZONE";
+ public static final String TIMEZONE = "TIMEZONE";
/**
* Field type which allows selection of languages. The languages
@@ -97,31 +97,37 @@ public class Field {
* application. Legal values are valid language IDs, as dictated by
* the filenames of Guacamole's available translations.
*/
- public static String LANGUAGE = "LANGUAGE";
+ public static final String LANGUAGE = "LANGUAGE";
/**
* A date field whose legal values conform to the pattern "YYYY-MM-DD",
* zero-padded.
*/
- public static String DATE = "DATE";
+ public static final String DATE = "DATE";
/**
* A time field whose legal values conform to the pattern "HH:MM:SS",
* zero-padded, 24-hour.
*/
- public static String TIME = "TIME";
+ public static final String TIME = "TIME";
/**
* An HTTP query parameter which is expected to be embedded in the URL
* given to a user.
*/
- public static String QUERY_PARAMETER = "QUERY_PARAMETER";
+ public static final String QUERY_PARAMETER = "QUERY_PARAMETER";
/**
* A color scheme accepted by the Guacamole server terminal emulator
* and protocols which leverage it.
*/
- public static String TERMINAL_COLOR_SCHEME = "TERMINAL_COLOR_SCHEME";
+ public static final String TERMINAL_COLOR_SCHEME = "TERMINAL_COLOR_SCHEME";
+
+ /**
+ * A redirect field whose value is an encoded URL to which the user
+ * will be redirected.
+ */
+ public static final String REDIRECT = "REDIRECT";
}
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/form/RedirectField.java b/guacamole-ext/src/main/java/org/apache/guacamole/form/RedirectField.java
new file mode 100644
index 000000000..6fcc43585
--- /dev/null
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/form/RedirectField.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.guacamole.form;
+
+import java.net.URI;
+import org.apache.guacamole.language.Translatable;
+import org.apache.guacamole.language.TranslatableMessage;
+
+/**
+ * A Guacamole field that redirects a user to another page.
+ */
+public class RedirectField extends Field implements Translatable {
+
+ /**
+ * The URL to which the user should be redirected. The URL should be
+ * encoded
+ */
+ private final URI redirectUrl;
+
+ /**
+ * The translatable message that should be displayed for the user while the
+ * browser redirects.
+ */
+ private final TranslatableMessage redirectMessage;
+
+ /**
+ * Creates a new field which facilitates redirection of the user
+ * to another page.
+ *
+ * @param name
+ * The name of this field.
+ *
+ * @param redirectUrl
+ * The URL to which the user should be redirected.
+ *
+ * @param redirectMessage
+ * The translatable message that should be displayed for the user while
+ * the browser redirects.
+ */
+ public RedirectField(String name, URI redirectUrl,
+ TranslatableMessage redirectMessage) {
+
+ // Init base field properties
+ super(name, Field.Type.REDIRECT);
+
+ // Store the URL to which the user will be redirected
+ this.redirectUrl = redirectUrl;
+
+ // Store the message that will be displayed for the user during redirect
+ this.redirectMessage = redirectMessage;
+
+ }
+
+ /**
+ * Returns the URL to which the user should be redirected.
+ *
+ * @return
+ * The URL to which the user should be redirected.
+ */
+ public String getRedirectUrl() {
+ return redirectUrl.toString();
+ }
+
+ @Override
+ public TranslatableMessage getTranslatableMessage() {
+ return redirectMessage;
+ }
+
+}
diff --git a/extensions/guacamole-auth-openid/src/main/resources/controllers/openidController.js b/guacamole/src/main/webapp/app/form/controllers/redirectFieldController.js
similarity index 70%
rename from extensions/guacamole-auth-openid/src/main/resources/controllers/openidController.js
rename to guacamole/src/main/webapp/app/form/controllers/redirectFieldController.js
index a1fad885c..3ec9326c7 100644
--- a/extensions/guacamole-auth-openid/src/main/resources/controllers/openidController.js
+++ b/guacamole/src/main/webapp/app/form/controllers/redirectFieldController.js
@@ -18,13 +18,15 @@
*/
/**
- * Controller for the "GUAC_OPENID_TOKEN" field which simply redirects the user
- * immediately to the authorization URI.
+ * Controller for the redirect field, which redirects the user to the provided
+ * URL.
*/
-angular.module('guacOpenID').controller('guacOpenIDController', ['$scope',
- function guacOpenIDController($scope) {
+angular.module('form').controller('redirectFieldController', ['$scope','$window',
+ function redirectFieldController($scope,$window) {
- // Redirect to authorization URI
- window.location = $scope.field.authorizationURI;
+ /**
+ * Redirect the user to the provided URL.
+ */
+ $window.location.href = $scope.field.redirectUrl;
}]);
diff --git a/guacamole/src/main/webapp/app/form/services/formService.js b/guacamole/src/main/webapp/app/form/services/formService.js
index 1df49dc2a..0e9155c09 100644
--- a/guacamole/src/main/webapp/app/form/services/formService.js
+++ b/guacamole/src/main/webapp/app/form/services/formService.js
@@ -192,6 +192,19 @@ angular.module('form').provider('formService', function formServiceProvider() {
module : 'form',
controller : 'terminalColorSchemeFieldController',
templateUrl : 'app/form/templates/terminalColorSchemeField.html'
+ },
+
+ /**
+ * Field type that supports redirecting the client browser to another
+ * URL.
+ *
+ * @see {@link Field.Type.REDIRECT}
+ * @type FieldType
+ */
+ 'REDIRECT' : {
+ module : 'form',
+ controller : 'redirectFieldController',
+ templateUrl : 'app/form/templates/redirectField.html'
}
};
diff --git a/extensions/guacamole-auth-cas/src/main/resources/styles/cas.css b/guacamole/src/main/webapp/app/form/styles/redirect-field.css
similarity index 95%
rename from extensions/guacamole-auth-cas/src/main/resources/styles/cas.css
rename to guacamole/src/main/webapp/app/form/styles/redirect-field.css
index 6c775d232..8df06c66e 100644
--- a/extensions/guacamole-auth-cas/src/main/resources/styles/cas.css
+++ b/guacamole/src/main/webapp/app/form/styles/redirect-field.css
@@ -17,7 +17,7 @@
* under the License.
*/
-.cas-ticket-field-container {
+.redirect-field-container {
height: 100%;
width: 100%;
position: fixed;
@@ -27,7 +27,7 @@
background: white;
}
-.cas-ticket-field {
+.redirect-field {
width: 100%;
display: table-cell;
vertical-align: middle;
diff --git a/guacamole/src/main/webapp/app/form/templates/redirectField.html b/guacamole/src/main/webapp/app/form/templates/redirectField.html
new file mode 100644
index 000000000..2dffa634a
--- /dev/null
+++ b/guacamole/src/main/webapp/app/form/templates/redirectField.html
@@ -0,0 +1,8 @@
+