From 187903563b3b9dd0a9721a5dafe5a4a58cb268c0 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sun, 27 Aug 2017 22:36:06 -0700 Subject: [PATCH] GUACAMOLE-210: Add redirect message. Refactor to use minification and pre-cached templates. --- extensions/guacamole-auth-openid/.gitignore | 3 + extensions/guacamole-auth-openid/pom.xml | 80 +++++++++++++++++++ .../resources/{ => config}/openidConfig.js | 5 +- .../{ => controllers}/openidController.js | 0 .../src/main/resources/guac-manifest.json | 18 ++++- .../src/main/resources/license.txt | 18 +++++ .../src/main/resources/styles/openid.css | 35 ++++++++ .../resources/templates/openidTokenField.html | 5 ++ .../src/main/resources/translations/en.json | 12 +++ 9 files changed, 170 insertions(+), 6 deletions(-) create mode 100644 extensions/guacamole-auth-openid/.gitignore rename extensions/guacamole-auth-openid/src/main/resources/{ => config}/openidConfig.js (91%) rename extensions/guacamole-auth-openid/src/main/resources/{ => controllers}/openidController.js (100%) create mode 100644 extensions/guacamole-auth-openid/src/main/resources/license.txt create mode 100644 extensions/guacamole-auth-openid/src/main/resources/styles/openid.css create mode 100644 extensions/guacamole-auth-openid/src/main/resources/templates/openidTokenField.html create mode 100644 extensions/guacamole-auth-openid/src/main/resources/translations/en.json diff --git a/extensions/guacamole-auth-openid/.gitignore b/extensions/guacamole-auth-openid/.gitignore new file mode 100644 index 000000000..30eb48707 --- /dev/null +++ b/extensions/guacamole-auth-openid/.gitignore @@ -0,0 +1,3 @@ +*~ +target/ +src/main/resources/generated/ diff --git a/extensions/guacamole-auth-openid/pom.xml b/extensions/guacamole-auth-openid/pom.xml index 14aea2b04..4076998f1 100644 --- a/extensions/guacamole-auth-openid/pom.xml +++ b/extensions/guacamole-auth-openid/pom.xml @@ -53,6 +53,85 @@ + + + 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 + minify-maven-plugin + 1.7.5 + + + default-cli + + UTF-8 + + ${basedir}/src/main/resources + ${project.build.directory}/classes + + / + / + openid.css + + + license.txt + + + + **/*.css + + + / + / + openid.js + + + license.txt + + + + **/*.js + + + + + **/*.test.js + + CLOSURE + + + + OFF + OFF + + + + + minify + + + + + org.apache.maven.plugins @@ -105,6 +184,7 @@ **/*.json src/licenses/**/* + src/main/resources/templates/*.html diff --git a/extensions/guacamole-auth-openid/src/main/resources/openidConfig.js b/extensions/guacamole-auth-openid/src/main/resources/config/openidConfig.js similarity index 91% rename from extensions/guacamole-auth-openid/src/main/resources/openidConfig.js rename to extensions/guacamole-auth-openid/src/main/resources/config/openidConfig.js index cf4c81e5d..12bc0dabb 100644 --- a/extensions/guacamole-auth-openid/src/main/resources/openidConfig.js +++ b/extensions/guacamole-auth-openid/src/main/resources/config/openidConfig.js @@ -25,8 +25,9 @@ angular.module('guacOpenID').config(['formServiceProvider', // Define field for token from OpenID service formServiceProvider.registerFieldType("GUAC_OPENID_TOKEN", { - controller : 'guacOpenIDController', - module : 'guacOpenID' + templateUrl : 'app/ext/guac-openid/templates/openidTokenField.html', + controller : 'guacOpenIDController', + module : 'guacOpenID' }); }]); diff --git a/extensions/guacamole-auth-openid/src/main/resources/openidController.js b/extensions/guacamole-auth-openid/src/main/resources/controllers/openidController.js similarity index 100% rename from extensions/guacamole-auth-openid/src/main/resources/openidController.js rename to extensions/guacamole-auth-openid/src/main/resources/controllers/openidController.js 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 c8d626f48..e71c140fa 100644 --- a/extensions/guacamole-auth-openid/src/main/resources/guac-manifest.json +++ b/extensions/guacamole-auth-openid/src/main/resources/guac-manifest.json @@ -9,10 +9,20 @@ "org.apache.guacamole.auth.openid.OpenIDAuthenticationProvider" ], + "translations" : [ + "translations/en.json" + ], + "js" : [ - "openidModule.js", - "openidController.js", - "openidConfig.js" - ] + "openid.min.js" + ], + + "css" : [ + "openid.min.css" + ], + + "resources" : { + "templates/openidTokenField.html" : "text/html" + } } diff --git a/extensions/guacamole-auth-openid/src/main/resources/license.txt b/extensions/guacamole-auth-openid/src/main/resources/license.txt new file mode 100644 index 000000000..042f3ce1f --- /dev/null +++ b/extensions/guacamole-auth-openid/src/main/resources/license.txt @@ -0,0 +1,18 @@ +/* + * 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. + */ diff --git a/extensions/guacamole-auth-openid/src/main/resources/styles/openid.css b/extensions/guacamole-auth-openid/src/main/resources/styles/openid.css new file mode 100644 index 000000000..eab7f935d --- /dev/null +++ b/extensions/guacamole-auth-openid/src/main/resources/styles/openid.css @@ -0,0 +1,35 @@ +/* + * 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 new file mode 100644 index 000000000..49f6c6f0a --- /dev/null +++ b/extensions/guacamole-auth-openid/src/main/resources/templates/openidTokenField.html @@ -0,0 +1,5 @@ +
+
+

{{ 'LOGIN.INFO_REDIRECT_PENDING' | translate }}

+
+
diff --git a/extensions/guacamole-auth-openid/src/main/resources/translations/en.json b/extensions/guacamole-auth-openid/src/main/resources/translations/en.json new file mode 100644 index 000000000..6bc52410e --- /dev/null +++ b/extensions/guacamole-auth-openid/src/main/resources/translations/en.json @@ -0,0 +1,12 @@ +{ + + "DATA_SOURCE_OPENID" : { + "NAME" : "OpenID SSO Backend" + }, + + "LOGIN" : { + "FIELD_HEADER_ID_TOKEN" : "", + "INFO_REDIRECT_PENDING" : "Please wait, redirecting to identity provider..." + } + +}