You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by vn...@apache.org on 2017/09/27 02:18:15 UTC

[23/29] incubator-guacamole-client git commit: GUACAMOLE-210: Move OpenID configuration property definitions into ConfigurationService.

GUACAMOLE-210: Move OpenID configuration property definitions into ConfigurationService.

Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/82c6048d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/82c6048d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/82c6048d

Branch: refs/heads/master
Commit: 82c6048d504965da90b719fa948a9ee5d99edcbd
Parents: d04d612
Author: Michael Jumper <mj...@apache.org>
Authored: Tue Feb 21 12:45:37 2017 -0800
Committer: Michael Jumper <mj...@apache.org>
Committed: Mon Sep 25 13:06:44 2017 -0700

----------------------------------------------------------------------
 .../auth/openid/conf/ConfigurationService.java  |  85 +++++++++++++--
 .../openid/conf/OpenIDGuacamoleProperties.java  | 108 -------------------
 2 files changed, 79 insertions(+), 114 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/82c6048d/extensions/guacamole-auth-openid/src/main/java/org/apache/guacamole/auth/openid/conf/ConfigurationService.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-openid/src/main/java/org/apache/guacamole/auth/openid/conf/ConfigurationService.java b/extensions/guacamole-auth-openid/src/main/java/org/apache/guacamole/auth/openid/conf/ConfigurationService.java
index 650cf47..6f7e44b 100644
--- a/extensions/guacamole-auth-openid/src/main/java/org/apache/guacamole/auth/openid/conf/ConfigurationService.java
+++ b/extensions/guacamole-auth-openid/src/main/java/org/apache/guacamole/auth/openid/conf/ConfigurationService.java
@@ -22,6 +22,7 @@ package org.apache.guacamole.auth.openid.conf;
 import com.google.inject.Inject;
 import org.apache.guacamole.GuacamoleException;
 import org.apache.guacamole.environment.Environment;
+import org.apache.guacamole.properties.StringGuacamoleProperty;
 
 /**
  * Service for retrieving configuration information regarding the OpenID
@@ -30,6 +31,78 @@ import org.apache.guacamole.environment.Environment;
 public class ConfigurationService {
 
     /**
+     * The authorization endpoint (URI) of the OpenID service.
+     */
+    private static final StringGuacamoleProperty OPENID_AUTHORIZATION_ENDPOINT =
+            new StringGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "openid-authorization-endpoint"; }
+
+    };
+
+    /**
+     * The endpoint (URI) of the JWKS service which defines how received ID
+     * tokens (JWTs) shall be validated.
+     */
+    private static final StringGuacamoleProperty OPENID_JWKS_ENDPOINT =
+            new StringGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "openid-jwks-endpoint"; }
+
+    };
+
+    /**
+     * The issuer to expect for all received ID tokens.
+     */
+    private static final StringGuacamoleProperty OPENID_ISSUER =
+            new StringGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "openid-issuer"; }
+
+    };
+
+    /**
+     * The claim type which contains the authenticated user's username within
+     * any valid JWT.
+     */
+    private static final StringGuacamoleProperty OPENID_USERNAME_CLAIM_TYPE =
+            new StringGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "openid-username-claim-type"; }
+
+    };
+
+    /**
+     * OpenID client ID which should be submitted to the OpenID service when
+     * necessary. This value is typically provided by the OpenID service when
+     * OpenID credentials are generated for your application.
+     */
+    private static final StringGuacamoleProperty OPENID_CLIENT_ID =
+            new StringGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "openid-client-id"; }
+
+    };
+
+    /**
+     * The URI that the OpenID service should redirect to after the
+     * authentication process is complete. This must be the full URL that a
+     * user would enter into their browser to access Guacamole.
+     */
+    private static final StringGuacamoleProperty OPENID_REDIRECT_URI =
+            new StringGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "openid-redirect-uri"; }
+
+    };
+
+    /**
      * The Guacamole server environment.
      */
     @Inject
@@ -48,7 +121,7 @@ public class ConfigurationService {
      *     endpoint property is missing.
      */
     public String getAuthorizationEndpoint() throws GuacamoleException {
-        return environment.getRequiredProperty(OpenIDGuacamoleProperties.OPENID_AUTHORIZATION_ENDPOINT);
+        return environment.getRequiredProperty(OPENID_AUTHORIZATION_ENDPOINT);
     }
 
     /**
@@ -66,7 +139,7 @@ public class ConfigurationService {
      *     property is missing.
      */
     public String getClientID() throws GuacamoleException {
-        return environment.getRequiredProperty(OpenIDGuacamoleProperties.OPENID_CLIENT_ID);
+        return environment.getRequiredProperty(OPENID_CLIENT_ID);
     }
 
     /**
@@ -84,7 +157,7 @@ public class ConfigurationService {
      *     property is missing.
      */
     public String getRedirectURI() throws GuacamoleException {
-        return environment.getRequiredProperty(OpenIDGuacamoleProperties.OPENID_REDIRECT_URI);
+        return environment.getRequiredProperty(OPENID_REDIRECT_URI);
     }
 
     /**
@@ -100,7 +173,7 @@ public class ConfigurationService {
      *     is missing.
      */
     public String getIssuer() throws GuacamoleException {
-        return environment.getRequiredProperty(OpenIDGuacamoleProperties.OPENID_ISSUER);
+        return environment.getRequiredProperty(OPENID_ISSUER);
     }
 
     /**
@@ -118,7 +191,7 @@ public class ConfigurationService {
      *     property is missing.
      */
     public String getJWKSEndpoint() throws GuacamoleException {
-        return environment.getRequiredProperty(OpenIDGuacamoleProperties.OPENID_JWKS_ENDPOINT);
+        return environment.getRequiredProperty(OPENID_JWKS_ENDPOINT);
     }
 
     /**
@@ -134,7 +207,7 @@ public class ConfigurationService {
      *     type property is missing.
      */
     public String getUsernameClaimType() throws GuacamoleException {
-        return environment.getRequiredProperty(OpenIDGuacamoleProperties.OPENID_USERNAME_CLAIM_TYPE);
+        return environment.getRequiredProperty(OPENID_USERNAME_CLAIM_TYPE);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/82c6048d/extensions/guacamole-auth-openid/src/main/java/org/apache/guacamole/auth/openid/conf/OpenIDGuacamoleProperties.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-openid/src/main/java/org/apache/guacamole/auth/openid/conf/OpenIDGuacamoleProperties.java b/extensions/guacamole-auth-openid/src/main/java/org/apache/guacamole/auth/openid/conf/OpenIDGuacamoleProperties.java
deleted file mode 100644
index 2049cca..0000000
--- a/extensions/guacamole-auth-openid/src/main/java/org/apache/guacamole/auth/openid/conf/OpenIDGuacamoleProperties.java
+++ /dev/null
@@ -1,108 +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.
- */
-
-package org.apache.guacamole.auth.openid.conf;
-
-import org.apache.guacamole.properties.StringGuacamoleProperty;
-
-/**
- * Provides properties required for use of the OpenID authentication provider.
- * These properties will be read from guacamole.properties when the OpenID
- * authentication provider is used.
- */
-public class OpenIDGuacamoleProperties {
-
-    /**
-     * This class should not be instantiated.
-     */
-    private OpenIDGuacamoleProperties() {}
-
-    /**
-     * The authorization endpoint (URI) of the OpenID service.
-     */
-    public static final StringGuacamoleProperty OPENID_AUTHORIZATION_ENDPOINT =
-            new StringGuacamoleProperty() {
-
-        @Override
-        public String getName() { return "openid-authorization-endpoint"; }
-
-    };
-
-    /**
-     * The endpoint (URI) of the JWKS service which defines how received ID
-     * tokens (JWTs) shall be validated.
-     */
-    public static final StringGuacamoleProperty OPENID_JWKS_ENDPOINT =
-            new StringGuacamoleProperty() {
-
-        @Override
-        public String getName() { return "openid-jwks-endpoint"; }
-
-    };
-
-    /**
-     * The issuer to expect for all received ID tokens.
-     */
-    public static final StringGuacamoleProperty OPENID_ISSUER =
-            new StringGuacamoleProperty() {
-
-        @Override
-        public String getName() { return "openid-issuer"; }
-
-    };
-
-    /**
-     * The claim type which contains the authenticated user's username within
-     * any valid JWT.
-     */
-    public static final StringGuacamoleProperty OPENID_USERNAME_CLAIM_TYPE =
-            new StringGuacamoleProperty() {
-
-        @Override
-        public String getName() { return "openid-username-claim-type"; }
-
-    };
-
-    /**
-     * OpenID client ID which should be submitted to the OpenID service when
-     * necessary. This value is typically provided by the OpenID service when
-     * OpenID credentials are generated for your application.
-     */
-    public static final StringGuacamoleProperty OPENID_CLIENT_ID =
-            new StringGuacamoleProperty() {
-
-        @Override
-        public String getName() { return "openid-client-id"; }
-
-    };
-
-    /**
-     * The URI that the OpenID service should redirect to after the
-     * authentication process is complete. This must be the full URL that a
-     * user would enter into their browser to access Guacamole.
-     */
-    public static final StringGuacamoleProperty OPENID_REDIRECT_URI =
-            new StringGuacamoleProperty() {
-
-        @Override
-        public String getName() { return "openid-redirect-uri"; }
-
-    };
-
-}