mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 09:03:21 +00:00 
			
		
		
		
	GUACAMOLE-289: Add getResource() functions to UserContext and AuthenticationProvider, allowing extensions to expose arbitrary REST resources/services.
This commit is contained in:
		| @@ -40,6 +40,26 @@ public interface AuthenticationProvider { | ||||
|      */ | ||||
|     String getIdentifier(); | ||||
|  | ||||
|     /** | ||||
|      * Returns an arbitrary REST resource. The REST resource returned must be | ||||
|      * properly annotated with JSR-311 annotations, and may serve as the root | ||||
|      * resource for any number of extension-specific REST resources which are | ||||
|      * unrelated to an authenticated user's session. The returned resource is | ||||
|      * ultimately exposed at ".../api/ext/IDENTIFIER/", where IDENTIFIER is the | ||||
|      * identifier of the AuthenticationProvider. | ||||
|      * | ||||
|      * REST resources which ARE related to an authenticated user's session | ||||
|      * should instead be returned from UserContext.getResource(). | ||||
|      * | ||||
|      * @return | ||||
|      *     An arbitrary REST resource, annotated with JSR-311 annotations, or | ||||
|      *     null if no such resource is defined. | ||||
|      * | ||||
|      * @throws GuacamoleException | ||||
|      *     If the REST resource cannot be returned due to an error. | ||||
|      */ | ||||
|     Object getResource() throws GuacamoleException; | ||||
|  | ||||
|     /** | ||||
|      * Returns an AuthenticatedUser representing the user authenticated by the | ||||
|      * given credentials, if any. | ||||
|   | ||||
| @@ -38,6 +38,26 @@ public interface UserContext { | ||||
|      */ | ||||
|     User self(); | ||||
|  | ||||
|     /** | ||||
|      * Returns an arbitrary REST resource. The REST resource returned must be | ||||
|      * properly annotated with JSR-311 annotations, and may serve as the root | ||||
|      * resource for any number of extension-specific REST resources related to | ||||
|      * an authenticated user's session. The returned resource is ultimately | ||||
|      * exposed at ".../api/session/data/IDENTIFIER/ext/", where IDENTIFIER is | ||||
|      * the identifier of the AuthenticationProvider. | ||||
|      * | ||||
|      * REST resources which are NOT related to an authenticated user's session | ||||
|      * should instead be returned from AuthenticationProvider.getResource(). | ||||
|      * | ||||
|      * @return | ||||
|      *     An arbitrary REST resource, annotated with JSR-311 annotations, or | ||||
|      *     null if no such resource is defined. | ||||
|      * | ||||
|      * @throws GuacamoleException | ||||
|      *     If the REST resource cannot be returned due to an error. | ||||
|      */ | ||||
|     Object getResource() throws GuacamoleException; | ||||
|  | ||||
|     /** | ||||
|      * Returns the AuthenticationProvider which created this UserContext, which | ||||
|      * may not be the same AuthenticationProvider that authenticated the user | ||||
|   | ||||
| @@ -203,6 +203,11 @@ public abstract class SimpleAuthenticationProvider | ||||
|  | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public Object getResource() throws GuacamoleException { | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public AuthenticatedUser authenticateUser(final Credentials credentials) | ||||
|             throws GuacamoleException { | ||||
|   | ||||
| @@ -163,6 +163,11 @@ public class SimpleUserContext implements UserContext { | ||||
|         return self; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public Object getResource() throws GuacamoleException { | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public AuthenticationProvider getAuthenticationProvider() { | ||||
|         return authProvider; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user