mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-11-04 11:03:21 +00:00 
			
		
		
		
	Merge 1.2.0 changes back to master.
This commit is contained in:
		@@ -53,85 +53,6 @@
 | 
			
		||||
                </configuration>
 | 
			
		||||
            </plugin>
 | 
			
		||||
 | 
			
		||||
            <!-- Pre-cache Angular templates with maven-angular-plugin -->
 | 
			
		||||
            <plugin>
 | 
			
		||||
                <groupId>com.keithbranton.mojo</groupId>
 | 
			
		||||
                <artifactId>angular-maven-plugin</artifactId>
 | 
			
		||||
                <version>0.3.2</version>
 | 
			
		||||
                <executions>
 | 
			
		||||
                    <execution>
 | 
			
		||||
                        <phase>generate-resources</phase>
 | 
			
		||||
                        <goals>
 | 
			
		||||
                            <goal>html2js</goal>
 | 
			
		||||
                        </goals>
 | 
			
		||||
                    </execution>
 | 
			
		||||
                </executions>
 | 
			
		||||
                <configuration>
 | 
			
		||||
                    <sourceDir>${basedir}/src/main/resources</sourceDir>
 | 
			
		||||
                    <include>**/*.html</include>
 | 
			
		||||
                    <target>${basedir}/src/main/resources/generated/templates-main/templates.js</target>
 | 
			
		||||
                    <prefix>app/ext/guac-cas</prefix>
 | 
			
		||||
                </configuration>
 | 
			
		||||
            </plugin>
 | 
			
		||||
 | 
			
		||||
            <!-- JS/CSS Minification Plugin -->
 | 
			
		||||
            <plugin>
 | 
			
		||||
                <groupId>com.samaxes.maven</groupId>
 | 
			
		||||
                <artifactId>minify-maven-plugin</artifactId>
 | 
			
		||||
                <version>1.7.5</version>
 | 
			
		||||
                <executions>
 | 
			
		||||
                    <execution>
 | 
			
		||||
                        <id>default-cli</id>
 | 
			
		||||
                        <configuration>
 | 
			
		||||
                            <charset>UTF-8</charset>
 | 
			
		||||
 | 
			
		||||
                            <webappSourceDir>${basedir}/src/main/resources</webappSourceDir>
 | 
			
		||||
                            <webappTargetDir>${project.build.directory}/classes</webappTargetDir>
 | 
			
		||||
 | 
			
		||||
                            <cssSourceDir>/</cssSourceDir>
 | 
			
		||||
                            <cssTargetDir>/</cssTargetDir>
 | 
			
		||||
                            <cssFinalFile>cas.css</cssFinalFile>
 | 
			
		||||
 | 
			
		||||
                            <cssSourceFiles>
 | 
			
		||||
                                <cssSourceFile>license.txt</cssSourceFile>
 | 
			
		||||
                            </cssSourceFiles>
 | 
			
		||||
 | 
			
		||||
                            <cssSourceIncludes>
 | 
			
		||||
                                <cssSourceInclude>**/*.css</cssSourceInclude>
 | 
			
		||||
                            </cssSourceIncludes>
 | 
			
		||||
 | 
			
		||||
                            <jsSourceDir>/</jsSourceDir>
 | 
			
		||||
                            <jsTargetDir>/</jsTargetDir>
 | 
			
		||||
                            <jsFinalFile>cas.js</jsFinalFile>
 | 
			
		||||
 | 
			
		||||
                            <jsSourceFiles>
 | 
			
		||||
                                <jsSourceFile>license.txt</jsSourceFile>
 | 
			
		||||
                            </jsSourceFiles>
 | 
			
		||||
 | 
			
		||||
                            <jsSourceIncludes>
 | 
			
		||||
                                <jsSourceInclude>**/*.js</jsSourceInclude>
 | 
			
		||||
                            </jsSourceIncludes>
 | 
			
		||||
 | 
			
		||||
                            <!-- Do not minify and include tests -->
 | 
			
		||||
                            <jsSourceExcludes>
 | 
			
		||||
                                <jsSourceExclude>**/*.test.js</jsSourceExclude>
 | 
			
		||||
                            </jsSourceExcludes>
 | 
			
		||||
                            <jsEngine>CLOSURE</jsEngine>
 | 
			
		||||
 | 
			
		||||
                            <!-- Disable warnings for JSDoc annotations -->
 | 
			
		||||
                            <closureWarningLevels>
 | 
			
		||||
                                <misplacedTypeAnnotation>OFF</misplacedTypeAnnotation>
 | 
			
		||||
                                <nonStandardJsDocs>OFF</nonStandardJsDocs>
 | 
			
		||||
                            </closureWarningLevels>
 | 
			
		||||
 | 
			
		||||
                        </configuration>
 | 
			
		||||
                        <goals>
 | 
			
		||||
                            <goal>minify</goal>
 | 
			
		||||
                        </goals>
 | 
			
		||||
                    </execution>
 | 
			
		||||
                </executions>
 | 
			
		||||
            </plugin>
 | 
			
		||||
 | 
			
		||||
            <!-- Copy dependencies prior to packaging -->
 | 
			
		||||
            <plugin>
 | 
			
		||||
                <groupId>org.apache.maven.plugins</groupId>
 | 
			
		||||
 
 | 
			
		||||
@@ -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")
 | 
			
		||||
                )
 | 
			
		||||
 | 
			
		||||
            }))
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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');
 | 
			
		||||
@@ -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'
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
}]);
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
}]);
 | 
			
		||||
@@ -1,5 +0,0 @@
 | 
			
		||||
<div class="cas-ticket-field-container">
 | 
			
		||||
    <div class="cas-ticket-field">
 | 
			
		||||
        <p>{{ 'LOGIN.INFO_CAS_REDIRECT_PENDING' | translate }}</p>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
@@ -53,27 +53,6 @@
 | 
			
		||||
                </configuration>
 | 
			
		||||
            </plugin>
 | 
			
		||||
 | 
			
		||||
            <!-- Pre-cache Angular templates with maven-angular-plugin -->
 | 
			
		||||
            <plugin>
 | 
			
		||||
                <groupId>com.keithbranton.mojo</groupId>
 | 
			
		||||
                <artifactId>angular-maven-plugin</artifactId>
 | 
			
		||||
                <version>0.3.2</version>
 | 
			
		||||
                <executions>
 | 
			
		||||
                    <execution>
 | 
			
		||||
                        <phase>generate-resources</phase>
 | 
			
		||||
                        <goals>
 | 
			
		||||
                            <goal>html2js</goal>
 | 
			
		||||
                        </goals>
 | 
			
		||||
                    </execution>
 | 
			
		||||
                </executions>
 | 
			
		||||
                <configuration>
 | 
			
		||||
                    <sourceDir>${basedir}/src/main/resources</sourceDir>
 | 
			
		||||
                    <include>**/*.html</include>
 | 
			
		||||
                    <target>${basedir}/src/main/resources/generated/templates-main/templates.js</target>
 | 
			
		||||
                    <prefix>app/ext/guac-openid</prefix>
 | 
			
		||||
                </configuration>
 | 
			
		||||
            </plugin>
 | 
			
		||||
 | 
			
		||||
            <!-- JS/CSS Minification Plugin -->
 | 
			
		||||
            <plugin>
 | 
			
		||||
                <groupId>com.samaxes.maven</groupId>
 | 
			
		||||
@@ -88,18 +67,6 @@
 | 
			
		||||
                            <webappSourceDir>${basedir}/src/main/resources</webappSourceDir>
 | 
			
		||||
                            <webappTargetDir>${project.build.directory}/classes</webappTargetDir>
 | 
			
		||||
 | 
			
		||||
                            <cssSourceDir>/</cssSourceDir>
 | 
			
		||||
                            <cssTargetDir>/</cssTargetDir>
 | 
			
		||||
                            <cssFinalFile>openid.css</cssFinalFile>
 | 
			
		||||
 | 
			
		||||
                            <cssSourceFiles>
 | 
			
		||||
                                <cssSourceFile>license.txt</cssSourceFile>
 | 
			
		||||
                            </cssSourceFiles>
 | 
			
		||||
 | 
			
		||||
                            <cssSourceIncludes>
 | 
			
		||||
                                <cssSourceInclude>**/*.css</cssSourceInclude>
 | 
			
		||||
                            </cssSourceIncludes>
 | 
			
		||||
 | 
			
		||||
                            <jsSourceDir>/</jsSourceDir>
 | 
			
		||||
                            <jsTargetDir>/</jsTargetDir>
 | 
			
		||||
                            <jsFinalFile>openid.js</jsFinalFile>
 | 
			
		||||
 
 | 
			
		||||
@@ -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")
 | 
			
		||||
                )
 | 
			
		||||
 | 
			
		||||
            }))
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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'
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
}]);
 | 
			
		||||
@@ -18,14 +18,6 @@
 | 
			
		||||
 | 
			
		||||
    "js" : [
 | 
			
		||||
        "openid.min.js"
 | 
			
		||||
    ],
 | 
			
		||||
 | 
			
		||||
    "css" : [
 | 
			
		||||
        "openid.min.css"
 | 
			
		||||
    ],
 | 
			
		||||
 | 
			
		||||
    "resources" : {
 | 
			
		||||
        "templates/openidTokenField.html" : "text/html"
 | 
			
		||||
    }
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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');
 | 
			
		||||
@@ -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;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,5 +0,0 @@
 | 
			
		||||
<div class="openid-token-field-container">
 | 
			
		||||
    <div class="openid-token-field">
 | 
			
		||||
        <p>{{ 'LOGIN.INFO_REDIRECT_PENDING' | translate }}</p>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -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..."
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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..."
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    "LOGIN" : {
 | 
			
		||||
        "INFO_REDIRECT_PENDING" : "IDプロバイダへリダイレクトしています。"
 | 
			
		||||
        "INFO_OID_REDIRECT_PENDING" : "IDプロバイダへリダイレクトしています。"
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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";
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
}]);
 | 
			
		||||
@@ -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'
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    };
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
@@ -0,0 +1,8 @@
 | 
			
		||||
<div class="redirect-field-container">
 | 
			
		||||
    <div class="redirect-field">
 | 
			
		||||
        <p ng-show="field.translatableMessage"
 | 
			
		||||
           translate="{{field.translatableMessage.key}}"
 | 
			
		||||
           translate-values="{{field.translatableMessage.variables}}">
 | 
			
		||||
        </p>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
		Reference in New Issue
	
	Block a user