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>
<groupId>org.apache.guacamole</groupId>
<artifactId>guacamole-auth-http</artifactId>
<artifactId>guacamole-auth-header</artifactId>
<packaging>jar</packaging>
<version>0.9.11-incubating</version>
<name>guacamole-auth-http</name>
<name>guacamole-auth-header</name>
<url>http://guacamole.incubator.apache.org/</url>
<properties>

View File

@@ -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);
}

View File

@@ -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"
);
}

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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() {

View File

@@ -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;

View File

@@ -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"
]
}

View File

@@ -50,7 +50,7 @@
<!-- Authentication extensions -->
<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-ldap</module>
<module>extensions/guacamole-auth-noauth</module>