mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-10 23:21:21 +00:00
GUAC-800: Migrate to JSON for protocol descriptions. Use full Forms instead of simply Fields for protocol parameters (allow sections).
This commit is contained in:
@@ -24,7 +24,7 @@ package org.glyptodon.guacamole.net.basic.rest;
|
||||
|
||||
import java.util.Collection;
|
||||
import javax.ws.rs.core.Response;
|
||||
import org.glyptodon.guacamole.form.Parameter;
|
||||
import org.glyptodon.guacamole.form.Field;
|
||||
|
||||
/**
|
||||
* Describes an error that occurred within a REST endpoint.
|
||||
@@ -40,9 +40,9 @@ public class APIError {
|
||||
private final String message;
|
||||
|
||||
/**
|
||||
* All expected request parameters, if any.
|
||||
* All expected request parameters, if any, as a collection of fields.
|
||||
*/
|
||||
private final Collection<Parameter> expected;
|
||||
private final Collection<Field> expected;
|
||||
|
||||
/**
|
||||
* The type of error that occurred.
|
||||
@@ -140,9 +140,9 @@ public class APIError {
|
||||
*
|
||||
* @param expected
|
||||
* All parameters expected in the original request, or now required as
|
||||
* a result of the original request.
|
||||
* a result of the original request, as a collection of fields.
|
||||
*/
|
||||
public APIError(Type type, String message, Collection<Parameter> expected) {
|
||||
public APIError(Type type, String message, Collection<Field> expected) {
|
||||
this.type = type;
|
||||
this.message = message;
|
||||
this.expected = expected;
|
||||
@@ -159,12 +159,13 @@ public class APIError {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an object which describes the required credentials.
|
||||
* Returns a collection of all required parameters, where each parameter is
|
||||
* represented by a field.
|
||||
*
|
||||
* @return
|
||||
* An object which describes the required credentials.
|
||||
* A collection of all required parameters.
|
||||
*/
|
||||
public Collection<Parameter> getExpected() {
|
||||
public Collection<Field> getExpected() {
|
||||
return expected;
|
||||
}
|
||||
|
||||
|
@@ -25,7 +25,7 @@ package org.glyptodon.guacamole.net.basic.rest;
|
||||
import java.util.Collection;
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import javax.ws.rs.core.Response;
|
||||
import org.glyptodon.guacamole.form.Parameter;
|
||||
import org.glyptodon.guacamole.form.Field;
|
||||
|
||||
/**
|
||||
* An exception that will result in the given error error information being
|
||||
@@ -76,9 +76,9 @@ public class APIException extends WebApplicationException {
|
||||
*
|
||||
* @param expected
|
||||
* All parameters expected in the original request, or now required as
|
||||
* a result of the original request.
|
||||
* a result of the original request, as a collection of fields.
|
||||
*/
|
||||
public APIException(APIError.Type type, String message, Collection<Parameter> expected) {
|
||||
public APIException(APIError.Type type, String message, Collection<Field> expected) {
|
||||
this(new APIError(type, message, expected));
|
||||
}
|
||||
|
||||
|
@@ -22,14 +22,12 @@
|
||||
|
||||
package org.glyptodon.guacamole.net.basic.rest;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.glyptodon.guacamole.GuacamoleClientException;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.GuacamoleResourceNotFoundException;
|
||||
import org.glyptodon.guacamole.GuacamoleSecurityException;
|
||||
import org.glyptodon.guacamole.net.auth.credentials.CredentialsInfo;
|
||||
import org.glyptodon.guacamole.net.auth.credentials.GuacamoleInsufficientCredentialsException;
|
||||
import org.glyptodon.guacamole.net.auth.credentials.GuacamoleInvalidCredentialsException;
|
||||
import org.slf4j.Logger;
|
||||
@@ -65,7 +63,7 @@ public class AuthProviderRESTExceptionWrapper implements MethodInterceptor {
|
||||
throw new APIException(
|
||||
APIError.Type.INSUFFICIENT_CREDENTIALS,
|
||||
message,
|
||||
e.getCredentialsInfo().getParameters()
|
||||
e.getCredentialsInfo().getFields()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -80,7 +78,7 @@ public class AuthProviderRESTExceptionWrapper implements MethodInterceptor {
|
||||
throw new APIException(
|
||||
APIError.Type.INVALID_CREDENTIALS,
|
||||
message,
|
||||
e.getCredentialsInfo().getParameters()
|
||||
e.getCredentialsInfo().getFields()
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -34,7 +34,7 @@ import javax.ws.rs.core.MediaType;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.environment.Environment;
|
||||
import org.glyptodon.guacamole.environment.LocalEnvironment;
|
||||
import org.glyptodon.guacamole.form.Parameter;
|
||||
import org.glyptodon.guacamole.form.Field;
|
||||
import org.glyptodon.guacamole.net.auth.UserContext;
|
||||
import org.glyptodon.guacamole.net.basic.rest.AuthProviderRESTExposure;
|
||||
import org.glyptodon.guacamole.net.basic.rest.auth.AuthenticationService;
|
||||
@@ -65,8 +65,8 @@ public class SchemaRESTService {
|
||||
* performing the operation.
|
||||
*
|
||||
* @return
|
||||
* A collection of form parameters which describe the possible
|
||||
* attributes of a user object.
|
||||
* A collection of form fields which describe the possible attributes
|
||||
* of a user object.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs while retrieving the possible attributes.
|
||||
@@ -74,7 +74,7 @@ public class SchemaRESTService {
|
||||
@GET
|
||||
@Path("/users/attributes")
|
||||
@AuthProviderRESTExposure
|
||||
public Collection<Parameter> getUserAttributes(@QueryParam("token") String authToken) throws GuacamoleException {
|
||||
public Collection<Field> getUserAttributes(@QueryParam("token") String authToken) throws GuacamoleException {
|
||||
|
||||
// Retrieve all possible user attributes
|
||||
UserContext userContext = authenticationService.getUserContext(authToken);
|
||||
@@ -90,8 +90,8 @@ public class SchemaRESTService {
|
||||
* performing the operation.
|
||||
*
|
||||
* @return
|
||||
* A collection of form parameters which describe the possible
|
||||
* attributes of a connection object.
|
||||
* A collection of form fields which describe the possible attributes
|
||||
* of a connection object.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs while retrieving the possible attributes.
|
||||
@@ -99,7 +99,7 @@ public class SchemaRESTService {
|
||||
@GET
|
||||
@Path("/connections/attributes")
|
||||
@AuthProviderRESTExposure
|
||||
public Collection<Parameter> getConnectionAttributes(@QueryParam("token") String authToken) throws GuacamoleException {
|
||||
public Collection<Field> getConnectionAttributes(@QueryParam("token") String authToken) throws GuacamoleException {
|
||||
|
||||
// Retrieve all possible connection attributes
|
||||
UserContext userContext = authenticationService.getUserContext(authToken);
|
||||
@@ -115,8 +115,8 @@ public class SchemaRESTService {
|
||||
* performing the operation.
|
||||
*
|
||||
* @return
|
||||
* A collection of form parameters which describe the possible
|
||||
* attributes of a connection group object.
|
||||
* A collection of form fields which describe the possible attributes
|
||||
* of a connection group object.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs while retrieving the possible attributes.
|
||||
@@ -124,7 +124,7 @@ public class SchemaRESTService {
|
||||
@GET
|
||||
@Path("/connectionGroups/attributes")
|
||||
@AuthProviderRESTExposure
|
||||
public Collection<Parameter> getConnectionGroupAttributes(@QueryParam("token") String authToken) throws GuacamoleException {
|
||||
public Collection<Field> getConnectionGroupAttributes(@QueryParam("token") String authToken) throws GuacamoleException {
|
||||
|
||||
// Retrieve all possible connection group attributes
|
||||
UserContext userContext = authenticationService.getUserContext(authToken);
|
||||
|
Reference in New Issue
Block a user