@appsensorlike/appsensorlike
Version:
A port of OWASP AppSensor reference implementation
79 lines (78 loc) • 3.59 kB
TypeScript
import { IEquals } from "../../core.js";
/**
* This interface is to be fulfilled by implementations that load a configuration
* file and provide an object representation of it.
*
* The current implementation only consists of an XML configuration that utilizes a
* standardized XSD schema. However, there is nothing in the interface requiring the
* XML implementation. Most standard users will likely stick to the standard implementation.
*
* TODO: may update this interface is we move to something other than "reading"
* the config, ie. supporting configs from data stores/cloud, etc.
*/
interface ClientConfigurationReader {
/**
* Read content using default locations of:
*
* XML: /appsensor-client-config.xml
* XSD: /appsensor_client_config_2.0.xsd
*
* @return populated configuration object
* @throws ConfigurationException
*/
read(): ClientConfiguration | null;
/**
*
* @param configurationLocation specify configuration location (ie. file location of XML file)
* @param validatorLocation specify validator location (ie. file location of XSD file)
* @return populated configuration object
* @throws ConfigurationException
*/
read(configurationLocation: string, validatorLocation: string | null, reload: boolean): ClientConfiguration | null;
}
/**
* Represents a connection to a server from a {@link ClientApplication}.
*/
declare class ServerConnection implements IEquals {
static DEFAULT_HEADER_NAME: string;
/** type of server connection: rest/soap */
private type;
/** The url to connect to */
private url;
/** The client application identifier header name, optionally overridden */
private clientApplicationIdentificationHeaderName?;
/** The client application identifier header value */
private clientApplicationIdentificationHeaderValue;
/** The port to connect to - optional and used only in certain protocols (ie. thrift) */
private port?;
/** The socket timeout for the connection (in milliseconds) - optional and used only in certain protocols (ie. thrift) */
private socketTimeout?;
getType(): string;
setType(type: string): ServerConnection;
getUrl(): string;
setUrl(url: string): ServerConnection;
getClientApplicationIdentificationHeaderName(): string | undefined;
getClientApplicationIdentificationHeaderNameOrDefault(): string;
setClientApplicationIdentificationHeaderName(clientApplicationIdentificationHeaderName: string): ServerConnection;
getClientApplicationIdentificationHeaderValue(): string;
setClientApplicationIdentificationHeaderValue(clientApplicationIdentificationHeaderValue: string): ServerConnection;
getPort(): number | undefined;
setPort(port: number): ServerConnection;
getSocketTimeout(): number | undefined;
setSocketTimeout(socketTimeout: number): ServerConnection;
equals(obj: Object | null): boolean;
}
/**
* Represents the configuration for client-side components.
*/
declare class ClientConfiguration implements IEquals {
private configurationFile?;
/** Server connection with configuration info for rest/soap connections */
private serverConnection;
getConfigurationFile(): string | undefined;
setConfigurationFile(configurationFile: string): ClientConfiguration;
getServerConnection(): ServerConnection | null;
setServerConnection(serverConnection: ServerConnection): ClientConfiguration;
equals(obj: Object): boolean;
}
export { ClientConfiguration, ServerConnection, ClientConfigurationReader };