GUACAMOLE-195: Rename extension to guacamole-auth-header to more accurately reflect nature of the authentication.

This commit is contained in:
Nick Couchman
2017-02-03 08:00:47 -05:00
parent 3d6239d3aa
commit 96fb8a9c6b
18 changed files with 37 additions and 35 deletions

View File

@@ -24,10 +24,10 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.apache.guacamole</groupId> <groupId>org.apache.guacamole</groupId>
<artifactId>guacamole-auth-http</artifactId> <artifactId>guacamole-auth-header</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>0.9.11-incubating</version> <version>0.9.11-incubating</version>
<name>guacamole-auth-http</name> <name>guacamole-auth-header</name>
<url>http://guacamole.incubator.apache.org/</url> <url>http://guacamole.incubator.apache.org/</url>
<properties> <properties>

View File

@@ -17,7 +17,7 @@
* under the License. * under the License.
*/ */
package org.apache.guacamole.auth.http; package org.apache.guacamole.auth.header;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.google.inject.Provider; 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;
import org.apache.guacamole.net.auth.credentials.CredentialsInfo; import org.apache.guacamole.net.auth.credentials.CredentialsInfo;
import org.apache.guacamole.net.auth.credentials.GuacamoleInvalidCredentialsException; 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; import java.security.Principal;
/** /**
* Service providing convenience functions for the HTTP AuthenticationProvider * Service providing convenience functions for the HTTP Header
* implementation. * AuthenticationProvider implementation.
* *
* @author Nick Couchman * @author Nick Couchman
*/ */
@@ -69,8 +69,10 @@ public class AuthenticationProviderService {
// Pull HTTP header from request if present // Pull HTTP header from request if present
HttpServletRequest request = credentials.getRequest(); HttpServletRequest request = credentials.getRequest();
if (request != null) { if(request != null) {
// Try getRemoteUser(), first
String username = request.getRemoteUser(); String username = request.getRemoteUser();
// Check if that worked, if not, try the configured header.
if(username == null) if(username == null)
username = request.getHeader(confService.getHttpAuthHeader()); 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); throw new GuacamoleInvalidCredentialsException("Invalid login.", CredentialsInfo.USERNAME_PASSWORD);
} }

View File

@@ -17,7 +17,7 @@
* under the License. * under the License.
*/ */
package org.apache.guacamole.auth.http; package org.apache.guacamole.auth.header;
import com.google.inject.Inject; import com.google.inject.Inject;
import org.apache.guacamole.GuacamoleException; import org.apache.guacamole.GuacamoleException;
@@ -51,7 +51,7 @@ public class ConfigurationService {
*/ */
public String getHttpAuthHeader() throws GuacamoleException { public String getHttpAuthHeader() throws GuacamoleException {
return environment.getProperty( return environment.getProperty(
HTTPGuacamoleProperties.HTTP_AUTH_HEADER, HTTPHeaderGuacamoleProperties.HTTP_AUTH_HEADER,
"REMOTE_USER" "REMOTE_USER"
); );
} }

View File

@@ -17,7 +17,7 @@
* under the License. * under the License.
*/ */
package org.apache.guacamole.auth.http; package org.apache.guacamole.auth.header;
import com.google.inject.Guice; import com.google.inject.Guice;
import com.google.inject.Injector; import com.google.inject.Injector;
@@ -35,7 +35,7 @@ import org.apache.guacamole.net.auth.UserContext;
* *
* @author Nick Couchman * @author Nick Couchman
*/ */
public class HTTPAuthenticationProvider implements AuthenticationProvider { public class HTTPHeaderAuthenticationProvider implements AuthenticationProvider {
/** /**
* Injector which will manage the object graph of this authentication * Injector which will manage the object graph of this authentication
@@ -44,25 +44,25 @@ public class HTTPAuthenticationProvider implements AuthenticationProvider {
private final Injector injector; private final Injector injector;
/** /**
* Creates a new HTTPAuthenticationProvider that authenticates users * Creates a new HTTPHeaderAuthenticationProvider that authenticates users
* using HTTP headers. * using HTTP headers.
* *
* @throws GuacamoleException * @throws GuacamoleException
* If a required property is missing, or an error occurs while parsing * If a required property is missing, or an error occurs while parsing
* a property. * a property.
*/ */
public HTTPAuthenticationProvider() throws GuacamoleException { public HTTPHeaderAuthenticationProvider() throws GuacamoleException {
// Set up Guice injector. // Set up Guice injector.
injector = Guice.createInjector( injector = Guice.createInjector(
new HTTPAuthenticationProviderModule(this) new HTTPHeaderAuthenticationProviderModule(this)
); );
} }
@Override @Override
public String getIdentifier() { public String getIdentifier() {
return "http"; return "header";
} }
@Override @Override

View File

@@ -17,7 +17,7 @@
* under the License. * under the License.
*/ */
package org.apache.guacamole.auth.http; package org.apache.guacamole.auth.header;
import com.google.inject.AbstractModule; import com.google.inject.AbstractModule;
import org.apache.guacamole.GuacamoleException; import org.apache.guacamole.GuacamoleException;
@@ -26,11 +26,11 @@ import org.apache.guacamole.environment.LocalEnvironment;
import org.apache.guacamole.net.auth.AuthenticationProvider; 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 * @author Michael Jumper
*/ */
public class HTTPAuthenticationProviderModule extends AbstractModule { public class HTTPHeaderAuthenticationProviderModule extends AbstractModule {
/** /**
* Guacamole server environment. * Guacamole server environment.
@@ -38,14 +38,14 @@ public class HTTPAuthenticationProviderModule extends AbstractModule {
private final Environment environment; 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. * module has configured injection.
*/ */
private final AuthenticationProvider authProvider; private final AuthenticationProvider authProvider;
/** /**
* Creates a new HTTP authentication provider module which configures * Creates a new HTTP header authentication provider module which configures
* injection for the HTTPAuthenticationProvider. * injection for the HTTPHeaderAuthenticationProvider.
* *
* @param authProvider * @param authProvider
* The AuthenticationProvider for which injection is being configured. * 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 * If an error occurs while retrieving the Guacamole server
* environment. * environment.
*/ */
public HTTPAuthenticationProviderModule(AuthenticationProvider authProvider) public HTTPHeaderAuthenticationProviderModule(AuthenticationProvider authProvider)
throws GuacamoleException { throws GuacamoleException {
// Get local environment // Get local environment
@@ -72,7 +72,7 @@ public class HTTPAuthenticationProviderModule extends AbstractModule {
bind(AuthenticationProvider.class).toInstance(authProvider); bind(AuthenticationProvider.class).toInstance(authProvider);
bind(Environment.class).toInstance(environment); bind(Environment.class).toInstance(environment);
// Bind HTTP-specific classes // Bind HTTPHeader-specific classes
bind(ConfigurationService.class); bind(ConfigurationService.class);
} }

View File

@@ -17,28 +17,28 @@
* under the License. * 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.IntegerGuacamoleProperty;
import org.apache.guacamole.properties.StringGuacamoleProperty; import org.apache.guacamole.properties.StringGuacamoleProperty;
/** /**
* Provides properties required for use of the HTTP authentication provider. * Provides properties required for use of the HTTP header
* These properties will be read from guacamole.properties when the HTTP * authentication provider. These properties will be read from
* authentication provider is used. * guacamole.properties when the HTTP authentication provider is used.
* *
* @author Nick Couchman * @author Nick Couchman
*/ */
public class HTTPGuacamoleProperties { public class HTTPHeaderGuacamoleProperties {
/** /**
* This class should not be instantiated. * 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() { public static final StringGuacamoleProperty HTTP_AUTH_HEADER = new StringGuacamoleProperty() {

View File

@@ -17,7 +17,7 @@
* under the License. * under the License.
*/ */
package org.apache.guacamole.auth.http.user; package org.apache.guacamole.auth.header.user;
import com.google.inject.Inject; import com.google.inject.Inject;
import org.apache.guacamole.net.auth.AbstractAuthenticatedUser; import org.apache.guacamole.net.auth.AbstractAuthenticatedUser;

View File

@@ -3,10 +3,10 @@
"guacamoleVersion" : "0.9.11-incubating", "guacamoleVersion" : "0.9.11-incubating",
"name" : "HTTP Header Authentication Extension", "name" : "HTTP Header Authentication Extension",
"namespace" : "guac-http", "namespace" : "guac-header",
"authProviders" : [ "authProviders" : [
"org.apache.guacamole.auth.http.HTTPAuthenticationProvider" "org.apache.guacamole.auth.header.HTTPHeaderAuthenticationProvider"
] ]
} }

View File

@@ -50,7 +50,7 @@
<!-- Authentication extensions --> <!-- Authentication extensions -->
<module>extensions/guacamole-auth-duo</module> <module>extensions/guacamole-auth-duo</module>
<module>extensions/guacamole-auth-http</module> <module>extensions/guacamole-auth-header</module>
<module>extensions/guacamole-auth-jdbc</module> <module>extensions/guacamole-auth-jdbc</module>
<module>extensions/guacamole-auth-ldap</module> <module>extensions/guacamole-auth-ldap</module>
<module>extensions/guacamole-auth-noauth</module> <module>extensions/guacamole-auth-noauth</module>