GUACAMOLE-524: Rename LDAP-specific AuthenticatedUser / UserContext to not conflict with guacamole-ext classes.

This commit is contained in:
Michael Jumper
2018-10-04 10:31:23 -07:00
parent 1210d5624c
commit 7a3f51be71
3 changed files with 12 additions and 11 deletions

View File

@@ -30,11 +30,12 @@ import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.guacamole.auth.ldap.user.AuthenticatedUser; import org.apache.guacamole.auth.ldap.user.LDAPAuthenticatedUser;
import org.apache.guacamole.auth.ldap.user.UserContext; import org.apache.guacamole.auth.ldap.user.LDAPUserContext;
import org.apache.guacamole.GuacamoleException; import org.apache.guacamole.GuacamoleException;
import org.apache.guacamole.GuacamoleServerException; import org.apache.guacamole.GuacamoleServerException;
import org.apache.guacamole.auth.ldap.user.UserService; import org.apache.guacamole.auth.ldap.user.UserService;
import org.apache.guacamole.net.auth.AuthenticatedUser;
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;
@@ -74,13 +75,13 @@ public class AuthenticationProviderService {
* Provider for AuthenticatedUser objects. * Provider for AuthenticatedUser objects.
*/ */
@Inject @Inject
private Provider<AuthenticatedUser> authenticatedUserProvider; private Provider<LDAPAuthenticatedUser> authenticatedUserProvider;
/** /**
* Provider for UserContext objects. * Provider for UserContext objects.
*/ */
@Inject @Inject
private Provider<UserContext> userContextProvider; private Provider<LDAPUserContext> userContextProvider;
/** /**
* Determines the DN which corresponds to the user having the given * Determines the DN which corresponds to the user having the given
@@ -211,7 +212,7 @@ public class AuthenticationProviderService {
* If an error occurs while authenticating the user, or if access is * If an error occurs while authenticating the user, or if access is
* denied. * denied.
*/ */
public AuthenticatedUser authenticateUser(Credentials credentials) public LDAPAuthenticatedUser authenticateUser(Credentials credentials)
throws GuacamoleException { throws GuacamoleException {
// Attempt bind // Attempt bind
@@ -231,7 +232,7 @@ public class AuthenticationProviderService {
try { try {
// Return AuthenticatedUser if bind succeeds // Return AuthenticatedUser if bind succeeds
AuthenticatedUser authenticatedUser = authenticatedUserProvider.get(); LDAPAuthenticatedUser authenticatedUser = authenticatedUserProvider.get();
authenticatedUser.init(credentials, getLDAPAttributes(ldapConnection, credentials.getUsername())); authenticatedUser.init(credentials, getLDAPAttributes(ldapConnection, credentials.getUsername()));
return authenticatedUser; return authenticatedUser;
@@ -318,7 +319,7 @@ public class AuthenticationProviderService {
* @throws GuacamoleException * @throws GuacamoleException
* If the UserContext cannot be created due to an error. * If the UserContext cannot be created due to an error.
*/ */
public UserContext getUserContext(org.apache.guacamole.net.auth.AuthenticatedUser authenticatedUser) public LDAPUserContext getUserContext(AuthenticatedUser authenticatedUser)
throws GuacamoleException { throws GuacamoleException {
// Bind using credentials associated with AuthenticatedUser // Bind using credentials associated with AuthenticatedUser
@@ -330,7 +331,7 @@ public class AuthenticationProviderService {
try { try {
// Build user context by querying LDAP // Build user context by querying LDAP
UserContext userContext = userContextProvider.get(); LDAPUserContext userContext = userContextProvider.get();
userContext.init(authenticatedUser, ldapConnection); userContext.init(authenticatedUser, ldapConnection);
return userContext; return userContext;

View File

@@ -29,7 +29,7 @@ import org.apache.guacamole.net.auth.Credentials;
* An LDAP-specific implementation of AuthenticatedUser, associating a * An LDAP-specific implementation of AuthenticatedUser, associating a
* particular set of credentials with the LDAP authentication provider. * particular set of credentials with the LDAP authentication provider.
*/ */
public class AuthenticatedUser extends AbstractAuthenticatedUser { public class LDAPAuthenticatedUser extends AbstractAuthenticatedUser {
/** /**
* Reference to the authentication provider associated with this * Reference to the authentication provider associated with this

View File

@@ -42,12 +42,12 @@ import org.slf4j.LoggerFactory;
* An LDAP-specific implementation of UserContext which queries all Guacamole * An LDAP-specific implementation of UserContext which queries all Guacamole
* connections and users from the LDAP directory. * connections and users from the LDAP directory.
*/ */
public class UserContext extends AbstractUserContext { public class LDAPUserContext extends AbstractUserContext {
/** /**
* Logger for this class. * Logger for this class.
*/ */
private final Logger logger = LoggerFactory.getLogger(UserContext.class); private final Logger logger = LoggerFactory.getLogger(LDAPUserContext.class);
/** /**
* Service for retrieving Guacamole connections from the LDAP server. * Service for retrieving Guacamole connections from the LDAP server.