Use truly generic HTTP-based credentials object, rename project to guacamole-auth (truly, this is a basic framework for extending Guacamole, a single webapp, NOT part of guacamole-common, which is the basis of the Guacamole webapp and potentially others).

This commit is contained in:
Michael Jumper
2012-03-22 22:44:02 -07:00
parent 451a09873d
commit 697c4601da
3 changed files with 43 additions and 8 deletions

View File

@@ -43,13 +43,11 @@ import net.sourceforge.guacamole.protocol.GuacamoleConfiguration;
/**
* Provides means of retrieving a set of named GuacamoleConfigurations for a
* given arbitrary credentials object.
* given Credentials object.
*
* @author Michael Jumper
* @param <CredentialType> The type to use as credentials for determining which
* configurations are authorized.
*/
public interface AuthenticationProvider<CredentialType> {
public interface AuthenticationProvider {
/**
* Given an arbitrary credentials object, returns a Map containing all
@@ -64,7 +62,7 @@ public interface AuthenticationProvider<CredentialType> {
* configurations.
*/
public Map<String, GuacamoleConfiguration>
getAuthorizedConfigurations(CredentialType credentials)
getAuthorizedConfigurations(Credentials credentials)
throws GuacamoleException;
}

View File

@@ -1,5 +1,8 @@
package net.sourceforge.guacamole.net.auth;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -43,7 +46,7 @@ package net.sourceforge.guacamole.net.auth;
*
* @author Michael Jumper
*/
public class UsernamePassword {
public class Credentials {
/**
* An arbitrary username.
@@ -55,6 +58,16 @@ public class UsernamePassword {
*/
private String password;
/**
* The HttpServletRequest carrying additional credentials, if any.
*/
private HttpServletRequest request;
/**
* The HttpSession carrying additional credentials, if any.
*/
private HttpSession session;
/**
* Returns the password associated with this username/password pair.
* @return The password associated with this username/password pair, or
@@ -91,4 +104,20 @@ public class UsernamePassword {
this.username = username;
}
public HttpServletRequest getRequest() {
return request;
}
public void setRequest(HttpServletRequest request) {
this.request = request;
}
public HttpSession getSession() {
return session;
}
public void setSession(HttpSession session) {
this.session = session;
}
}