From 96fb8a9c6b7b58b48d9c828b91be10f79fcd7ac8 Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Fri, 3 Feb 2017 08:00:47 -0500 Subject: [PATCH] GUACAMOLE-195: Rename extension to guacamole-auth-header to more accurately reflect nature of the authentication. --- .../.gitignore | 0 .../pom.xml | 4 ++-- .../src/licenses/DISCLAIMER | 0 .../src/licenses/LICENSE | 0 .../src/licenses/NOTICE | 0 .../src/licenses/bundled/README | 0 .../src/licenses/bundled/aopalliance-1.0/LICENSE | 0 .../src/licenses/bundled/guice-3.0/COPYING | 0 .../bundled/javax.inject-1/LICENSE-2.0.txt | 0 .../src/main/assembly/dist.xml | 0 .../header}/AuthenticationProviderService.java | 14 ++++++++------ .../auth/header}/ConfigurationService.java | 4 ++-- .../HTTPHeaderAuthenticationProvider.java} | 12 ++++++------ .../HTTPHeaderAuthenticationProviderModule.java} | 16 ++++++++-------- .../header/HTTPHeaderGuacamoleProperties.java} | 14 +++++++------- .../auth/header}/user/AuthenticatedUser.java | 2 +- .../src/main/resources/guac-manifest.json | 4 ++-- pom.xml | 2 +- 18 files changed, 37 insertions(+), 35 deletions(-) rename extensions/{guacamole-auth-http => guacamole-auth-header}/.gitignore (100%) rename extensions/{guacamole-auth-http => guacamole-auth-header}/pom.xml (98%) rename extensions/{guacamole-auth-http => guacamole-auth-header}/src/licenses/DISCLAIMER (100%) rename extensions/{guacamole-auth-http => guacamole-auth-header}/src/licenses/LICENSE (100%) rename extensions/{guacamole-auth-http => guacamole-auth-header}/src/licenses/NOTICE (100%) rename extensions/{guacamole-auth-http => guacamole-auth-header}/src/licenses/bundled/README (100%) rename extensions/{guacamole-auth-http => guacamole-auth-header}/src/licenses/bundled/aopalliance-1.0/LICENSE (100%) rename extensions/{guacamole-auth-http => guacamole-auth-header}/src/licenses/bundled/guice-3.0/COPYING (100%) rename extensions/{guacamole-auth-http => guacamole-auth-header}/src/licenses/bundled/javax.inject-1/LICENSE-2.0.txt (100%) rename extensions/{guacamole-auth-http => guacamole-auth-header}/src/main/assembly/dist.xml (100%) rename extensions/{guacamole-auth-http/src/main/java/org/apache/guacamole/auth/http => guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header}/AuthenticationProviderService.java (86%) rename extensions/{guacamole-auth-http/src/main/java/org/apache/guacamole/auth/http => guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header}/ConfigurationService.java (94%) rename extensions/{guacamole-auth-http/src/main/java/org/apache/guacamole/auth/http/HTTPAuthenticationProvider.java => guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header/HTTPHeaderAuthenticationProvider.java} (89%) rename extensions/{guacamole-auth-http/src/main/java/org/apache/guacamole/auth/http/HTTPAuthenticationProviderModule.java => guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header/HTTPHeaderAuthenticationProviderModule.java} (79%) rename extensions/{guacamole-auth-http/src/main/java/org/apache/guacamole/auth/http/HTTPGuacamoleProperties.java => guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header/HTTPHeaderGuacamoleProperties.java} (76%) rename extensions/{guacamole-auth-http/src/main/java/org/apache/guacamole/auth/http => guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header}/user/AuthenticatedUser.java (97%) rename extensions/{guacamole-auth-http => guacamole-auth-header}/src/main/resources/guac-manifest.json (56%) diff --git a/extensions/guacamole-auth-http/.gitignore b/extensions/guacamole-auth-header/.gitignore similarity index 100% rename from extensions/guacamole-auth-http/.gitignore rename to extensions/guacamole-auth-header/.gitignore diff --git a/extensions/guacamole-auth-http/pom.xml b/extensions/guacamole-auth-header/pom.xml similarity index 98% rename from extensions/guacamole-auth-http/pom.xml rename to extensions/guacamole-auth-header/pom.xml index 146a39c1c..a3f777c6c 100644 --- a/extensions/guacamole-auth-http/pom.xml +++ b/extensions/guacamole-auth-header/pom.xml @@ -24,10 +24,10 @@ 4.0.0 org.apache.guacamole - guacamole-auth-http + guacamole-auth-header jar 0.9.11-incubating - guacamole-auth-http + guacamole-auth-header http://guacamole.incubator.apache.org/ diff --git a/extensions/guacamole-auth-http/src/licenses/DISCLAIMER b/extensions/guacamole-auth-header/src/licenses/DISCLAIMER similarity index 100% rename from extensions/guacamole-auth-http/src/licenses/DISCLAIMER rename to extensions/guacamole-auth-header/src/licenses/DISCLAIMER diff --git a/extensions/guacamole-auth-http/src/licenses/LICENSE b/extensions/guacamole-auth-header/src/licenses/LICENSE similarity index 100% rename from extensions/guacamole-auth-http/src/licenses/LICENSE rename to extensions/guacamole-auth-header/src/licenses/LICENSE diff --git a/extensions/guacamole-auth-http/src/licenses/NOTICE b/extensions/guacamole-auth-header/src/licenses/NOTICE similarity index 100% rename from extensions/guacamole-auth-http/src/licenses/NOTICE rename to extensions/guacamole-auth-header/src/licenses/NOTICE diff --git a/extensions/guacamole-auth-http/src/licenses/bundled/README b/extensions/guacamole-auth-header/src/licenses/bundled/README similarity index 100% rename from extensions/guacamole-auth-http/src/licenses/bundled/README rename to extensions/guacamole-auth-header/src/licenses/bundled/README diff --git a/extensions/guacamole-auth-http/src/licenses/bundled/aopalliance-1.0/LICENSE b/extensions/guacamole-auth-header/src/licenses/bundled/aopalliance-1.0/LICENSE similarity index 100% rename from extensions/guacamole-auth-http/src/licenses/bundled/aopalliance-1.0/LICENSE rename to extensions/guacamole-auth-header/src/licenses/bundled/aopalliance-1.0/LICENSE diff --git a/extensions/guacamole-auth-http/src/licenses/bundled/guice-3.0/COPYING b/extensions/guacamole-auth-header/src/licenses/bundled/guice-3.0/COPYING similarity index 100% rename from extensions/guacamole-auth-http/src/licenses/bundled/guice-3.0/COPYING rename to extensions/guacamole-auth-header/src/licenses/bundled/guice-3.0/COPYING diff --git a/extensions/guacamole-auth-http/src/licenses/bundled/javax.inject-1/LICENSE-2.0.txt b/extensions/guacamole-auth-header/src/licenses/bundled/javax.inject-1/LICENSE-2.0.txt similarity index 100% rename from extensions/guacamole-auth-http/src/licenses/bundled/javax.inject-1/LICENSE-2.0.txt rename to extensions/guacamole-auth-header/src/licenses/bundled/javax.inject-1/LICENSE-2.0.txt diff --git a/extensions/guacamole-auth-http/src/main/assembly/dist.xml b/extensions/guacamole-auth-header/src/main/assembly/dist.xml similarity index 100% rename from extensions/guacamole-auth-http/src/main/assembly/dist.xml rename to extensions/guacamole-auth-header/src/main/assembly/dist.xml diff --git a/extensions/guacamole-auth-http/src/main/java/org/apache/guacamole/auth/http/AuthenticationProviderService.java b/extensions/guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header/AuthenticationProviderService.java similarity index 86% rename from extensions/guacamole-auth-http/src/main/java/org/apache/guacamole/auth/http/AuthenticationProviderService.java rename to extensions/guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header/AuthenticationProviderService.java index 6aa98dcbf..2625efd81 100644 --- a/extensions/guacamole-auth-http/src/main/java/org/apache/guacamole/auth/http/AuthenticationProviderService.java +++ b/extensions/guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header/AuthenticationProviderService.java @@ -17,7 +17,7 @@ * under the License. */ -package org.apache.guacamole.auth.http; +package org.apache.guacamole.auth.header; import com.google.inject.Inject; import com.google.inject.Provider; @@ -26,12 +26,12 @@ import org.apache.guacamole.GuacamoleException; import org.apache.guacamole.net.auth.Credentials; import org.apache.guacamole.net.auth.credentials.CredentialsInfo; import org.apache.guacamole.net.auth.credentials.GuacamoleInvalidCredentialsException; -import org.apache.guacamole.auth.http.user.AuthenticatedUser; +import org.apache.guacamole.auth.header.user.AuthenticatedUser; import java.security.Principal; /** - * Service providing convenience functions for the HTTP AuthenticationProvider - * implementation. + * Service providing convenience functions for the HTTP Header + * AuthenticationProvider implementation. * * @author Nick Couchman */ @@ -69,8 +69,10 @@ public class AuthenticationProviderService { // Pull HTTP header from request if present HttpServletRequest request = credentials.getRequest(); - if (request != null) { + if(request != null) { + // Try getRemoteUser(), first String username = request.getRemoteUser(); + // Check if that worked, if not, try the configured header. if(username == null) username = request.getHeader(confService.getHttpAuthHeader()); @@ -81,7 +83,7 @@ public class AuthenticationProviderService { } } - // Request HTTP authentication + // Authentication not provided via header, yet, so we request it. throw new GuacamoleInvalidCredentialsException("Invalid login.", CredentialsInfo.USERNAME_PASSWORD); } diff --git a/extensions/guacamole-auth-http/src/main/java/org/apache/guacamole/auth/http/ConfigurationService.java b/extensions/guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header/ConfigurationService.java similarity index 94% rename from extensions/guacamole-auth-http/src/main/java/org/apache/guacamole/auth/http/ConfigurationService.java rename to extensions/guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header/ConfigurationService.java index 59416a98d..7d483b0ba 100644 --- a/extensions/guacamole-auth-http/src/main/java/org/apache/guacamole/auth/http/ConfigurationService.java +++ b/extensions/guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header/ConfigurationService.java @@ -17,7 +17,7 @@ * under the License. */ -package org.apache.guacamole.auth.http; +package org.apache.guacamole.auth.header; import com.google.inject.Inject; import org.apache.guacamole.GuacamoleException; @@ -51,7 +51,7 @@ public class ConfigurationService { */ public String getHttpAuthHeader() throws GuacamoleException { return environment.getProperty( - HTTPGuacamoleProperties.HTTP_AUTH_HEADER, + HTTPHeaderGuacamoleProperties.HTTP_AUTH_HEADER, "REMOTE_USER" ); } diff --git a/extensions/guacamole-auth-http/src/main/java/org/apache/guacamole/auth/http/HTTPAuthenticationProvider.java b/extensions/guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header/HTTPHeaderAuthenticationProvider.java similarity index 89% rename from extensions/guacamole-auth-http/src/main/java/org/apache/guacamole/auth/http/HTTPAuthenticationProvider.java rename to extensions/guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header/HTTPHeaderAuthenticationProvider.java index 505f1c5af..9c0957115 100644 --- a/extensions/guacamole-auth-http/src/main/java/org/apache/guacamole/auth/http/HTTPAuthenticationProvider.java +++ b/extensions/guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header/HTTPHeaderAuthenticationProvider.java @@ -17,7 +17,7 @@ * under the License. */ -package org.apache.guacamole.auth.http; +package org.apache.guacamole.auth.header; import com.google.inject.Guice; import com.google.inject.Injector; @@ -35,7 +35,7 @@ import org.apache.guacamole.net.auth.UserContext; * * @author Nick Couchman */ -public class HTTPAuthenticationProvider implements AuthenticationProvider { +public class HTTPHeaderAuthenticationProvider implements AuthenticationProvider { /** * Injector which will manage the object graph of this authentication @@ -44,25 +44,25 @@ public class HTTPAuthenticationProvider implements AuthenticationProvider { private final Injector injector; /** - * Creates a new HTTPAuthenticationProvider that authenticates users + * Creates a new HTTPHeaderAuthenticationProvider that authenticates users * using HTTP headers. * * @throws GuacamoleException * If a required property is missing, or an error occurs while parsing * a property. */ - public HTTPAuthenticationProvider() throws GuacamoleException { + public HTTPHeaderAuthenticationProvider() throws GuacamoleException { // Set up Guice injector. injector = Guice.createInjector( - new HTTPAuthenticationProviderModule(this) + new HTTPHeaderAuthenticationProviderModule(this) ); } @Override public String getIdentifier() { - return "http"; + return "header"; } @Override diff --git a/extensions/guacamole-auth-http/src/main/java/org/apache/guacamole/auth/http/HTTPAuthenticationProviderModule.java b/extensions/guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header/HTTPHeaderAuthenticationProviderModule.java similarity index 79% rename from extensions/guacamole-auth-http/src/main/java/org/apache/guacamole/auth/http/HTTPAuthenticationProviderModule.java rename to extensions/guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header/HTTPHeaderAuthenticationProviderModule.java index 515598c59..099e04c24 100644 --- a/extensions/guacamole-auth-http/src/main/java/org/apache/guacamole/auth/http/HTTPAuthenticationProviderModule.java +++ b/extensions/guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header/HTTPHeaderAuthenticationProviderModule.java @@ -17,7 +17,7 @@ * under the License. */ -package org.apache.guacamole.auth.http; +package org.apache.guacamole.auth.header; import com.google.inject.AbstractModule; import org.apache.guacamole.GuacamoleException; @@ -26,11 +26,11 @@ import org.apache.guacamole.environment.LocalEnvironment; import org.apache.guacamole.net.auth.AuthenticationProvider; /** - * Guice module which configures HTTP-specific injections. + * Guice module which configures HTTP header-specific injections. * * @author Michael Jumper */ -public class HTTPAuthenticationProviderModule extends AbstractModule { +public class HTTPHeaderAuthenticationProviderModule extends AbstractModule { /** * Guacamole server environment. @@ -38,14 +38,14 @@ public class HTTPAuthenticationProviderModule extends AbstractModule { private final Environment environment; /** - * A reference to the HTTPAuthenticationProvider on behalf of which this + * A reference to the HTTPHeaderAuthenticationProvider on behalf of which this * module has configured injection. */ private final AuthenticationProvider authProvider; /** - * Creates a new HTTP authentication provider module which configures - * injection for the HTTPAuthenticationProvider. + * Creates a new HTTP header authentication provider module which configures + * injection for the HTTPHeaderAuthenticationProvider. * * @param authProvider * The AuthenticationProvider for which injection is being configured. @@ -54,7 +54,7 @@ public class HTTPAuthenticationProviderModule extends AbstractModule { * If an error occurs while retrieving the Guacamole server * environment. */ - public HTTPAuthenticationProviderModule(AuthenticationProvider authProvider) + public HTTPHeaderAuthenticationProviderModule(AuthenticationProvider authProvider) throws GuacamoleException { // Get local environment @@ -72,7 +72,7 @@ public class HTTPAuthenticationProviderModule extends AbstractModule { bind(AuthenticationProvider.class).toInstance(authProvider); bind(Environment.class).toInstance(environment); - // Bind HTTP-specific classes + // Bind HTTPHeader-specific classes bind(ConfigurationService.class); } diff --git a/extensions/guacamole-auth-http/src/main/java/org/apache/guacamole/auth/http/HTTPGuacamoleProperties.java b/extensions/guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header/HTTPHeaderGuacamoleProperties.java similarity index 76% rename from extensions/guacamole-auth-http/src/main/java/org/apache/guacamole/auth/http/HTTPGuacamoleProperties.java rename to extensions/guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header/HTTPHeaderGuacamoleProperties.java index e038343cc..e31bbabcf 100644 --- a/extensions/guacamole-auth-http/src/main/java/org/apache/guacamole/auth/http/HTTPGuacamoleProperties.java +++ b/extensions/guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header/HTTPHeaderGuacamoleProperties.java @@ -17,28 +17,28 @@ * under the License. */ -package org.apache.guacamole.auth.http; +package org.apache.guacamole.auth.header; import org.apache.guacamole.properties.IntegerGuacamoleProperty; import org.apache.guacamole.properties.StringGuacamoleProperty; /** - * Provides properties required for use of the HTTP authentication provider. - * These properties will be read from guacamole.properties when the HTTP - * authentication provider is used. + * Provides properties required for use of the HTTP header + * authentication provider. These properties will be read from + * guacamole.properties when the HTTP authentication provider is used. * * @author Nick Couchman */ -public class HTTPGuacamoleProperties { +public class HTTPHeaderGuacamoleProperties { /** * This class should not be instantiated. */ - private HTTPGuacamoleProperties() {} + private HTTPHeaderGuacamoleProperties() {} /** - * The header used for HTTP authentication. + * The header used for HTTP header authentication. */ public static final StringGuacamoleProperty HTTP_AUTH_HEADER = new StringGuacamoleProperty() { diff --git a/extensions/guacamole-auth-http/src/main/java/org/apache/guacamole/auth/http/user/AuthenticatedUser.java b/extensions/guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header/user/AuthenticatedUser.java similarity index 97% rename from extensions/guacamole-auth-http/src/main/java/org/apache/guacamole/auth/http/user/AuthenticatedUser.java rename to extensions/guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header/user/AuthenticatedUser.java index 52a226e82..0acff9721 100644 --- a/extensions/guacamole-auth-http/src/main/java/org/apache/guacamole/auth/http/user/AuthenticatedUser.java +++ b/extensions/guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header/user/AuthenticatedUser.java @@ -17,7 +17,7 @@ * under the License. */ -package org.apache.guacamole.auth.http.user; +package org.apache.guacamole.auth.header.user; import com.google.inject.Inject; import org.apache.guacamole.net.auth.AbstractAuthenticatedUser; diff --git a/extensions/guacamole-auth-http/src/main/resources/guac-manifest.json b/extensions/guacamole-auth-header/src/main/resources/guac-manifest.json similarity index 56% rename from extensions/guacamole-auth-http/src/main/resources/guac-manifest.json rename to extensions/guacamole-auth-header/src/main/resources/guac-manifest.json index 0432dc325..d7294e7eb 100644 --- a/extensions/guacamole-auth-http/src/main/resources/guac-manifest.json +++ b/extensions/guacamole-auth-header/src/main/resources/guac-manifest.json @@ -3,10 +3,10 @@ "guacamoleVersion" : "0.9.11-incubating", "name" : "HTTP Header Authentication Extension", - "namespace" : "guac-http", + "namespace" : "guac-header", "authProviders" : [ - "org.apache.guacamole.auth.http.HTTPAuthenticationProvider" + "org.apache.guacamole.auth.header.HTTPHeaderAuthenticationProvider" ] } diff --git a/pom.xml b/pom.xml index 555535ff7..1f11b1719 100644 --- a/pom.xml +++ b/pom.xml @@ -50,7 +50,7 @@ extensions/guacamole-auth-duo - extensions/guacamole-auth-http + extensions/guacamole-auth-header extensions/guacamole-auth-jdbc extensions/guacamole-auth-ldap extensions/guacamole-auth-noauth