Config

Config

Type: Object

Parameters
allowedMethods ([String]? = ['GET','POST','OPTIONS','PUT','DELETE']) List of allowed HTTP methods, separated by comas.
appendMetaData (Boolean? = true) If true, collected metadata will be appended to response.
apiUrl (String) URL of the API instance to call.
authPatterns ([Object]) Set authentication plugin to be used with specific routes.
Name Description
authPatterns.path String Regex string to match 1 or more routes.
authPatterns.plugin Class Auth plugin, must extend AuthHandler interface from udes-auth-plugins.
authPatterns.sessionUrl String? URL for getting session id.
authPatterns.targetService String? Custom target service. If none specified the target service in CAS config will be used.
cookies (Object?) Cookie configuration.
Name Description
cookies.maxAge Number? (default 14400000) Time to live (TTL) for the cookie in ms.
cookies.httpOnly Boolean? (default true) HttpOnly flag
cookies.name String? (default udes-node-orchestrator) Cookie name.
cookies.path String? (default /) Path to store cookie.
cookies.secret String? (default S3CR3T) Encryption key for cookie.
cookies.secure Boolean? (default true) Whether to encrypt cookie or not.
customHeaders ([Object]? = []) Retrieve data from custom headers.
Name Description
customHeaders.header String? The custom header to retrieve.
customHeaders.property String?? The property name to give to data. Defaults to header if not defined.
database (Object) Couchbase configuration.
Name Description
database.cacheBucketName String Cache bucket name.
database.cacheBucketPwd String Cache bucket password.
database.couchbaseCluster [String] List of Couchbase cluster URLs.
database.sessionBucketName String Session bucket name.
database.sessionBucketPwd String Session bucket password.
debug (Boolean = false) True to return debug data.
enableAuth (Boolean? = true) Whether to enable CAS authentication or not.
enableCORS (Boolean? = true) Whether to enable CORS or not.
errorFormatter (Class??) Class extending the ResponseFormatter interface. Format data on error.
log (Object?) Logger configuration.
Name Description
log.logLevel ("trace" | "info" | "debug" | "warn" | "error" | "silent")? (default error) Log level.
log.name String? (default udes-node-orchestrator) Logger name.
log.prettyPrint Boolean? (default true) Whether to print pretty or raw.
log.showCredentialsAsClearText Boolean? (default false) If true credentials will be displayed as clear text in logs.
loginPath (String) Url to login page.
nocasPwd (String? = nocas) CAS default password when enableAuth is false.
nocasUser (String? = nocas) CAS default username when enableAuth is false.
port (Number?) Port number for server to listen on. One of socket or port is required.
responseFormatter (Class??) Class extending the ResponseFormatter interface. Format response data.
socket (String?) Relative path to socket for server to listen on. One of socket or port is required.

CasConfig

CasConfig

Type: Object

Parameters
debug (Boolean? = false) Whether to activate CAS debugging or not.
fromAjax (Object?) CAS from AJAX configuration.
Name Description
fromAjax.header String? (default x-client-ajax) Default response header for AJAX responses.
fromAjax.status Number? (default 401) Default status code for AJAX responses.
gateway (Boolean? = false) Send all validation requests through the CAS gateway feature.
ignore ([String]? = []) Ignore CAS validation on these routes.
logLevel (String? = 'silent') Log level used by connect-cas middleware
match ([String]? = []) Filter url for CAS authentication
paths (Object?) CAS path configuration.
Name Description
paths.login String? (default /login) CAS login path.
paths.logout String? (default /logout) CAS logout path.
paths.proxy String? (default /proxy) Path to obtain proxy ticket.
paths.proxyCallback String? (default /proxyCallback) Path to call once proxy ticket is obtained.
paths.serviceValidate String? (default /proxyValidate) Path to validate TGT.
paths.validate String? (default /validate) Validation path.
redirect (Boolean? = false) Whether to automatically redirect or not.
renew (Boolean? = false) Whether to renew CAS authentication by default or not.
serverPath (String) URL to CAS server.
servicePrefix (String) URL of the orchestrator endpoint.
slo (Boolean? = false) single sign logout feature
targetService (String) URI to CAS service.

AuthHandler

Interface for handling various types of authentication.

new AuthHandler()

Orchestrator

Orchestrator server. Handles routes and HTTP traffic.

new Orchestrator(config: Config, routes: Array<Object>?)
Parameters
config (Config) Configuration file for server instance.
routes (Array<Object>?) The server's endpoints.
Name Description
routes[].method ("DELETE" | "GET" | "POST" | "PUT") The HTTP method of the route.
routes[].url String The path from the base url.
routes[].fn Function the function to be called when route is accessed.
Throws
  • Error: If config argument is null.
Instance Members
setRoutes

ResponseFormatter

Interface for formatting HTTP response data.

new ResponseFormatter()

ResponseHelper

Handles response standardisation as well as http responses and requests.

new ResponseHelper(req: Object, res: Object, config: Config)
Parameters
config (Config) Orchestrator configuration.
Throws
  • Error: If req , res or config argument is null.
Instance Members
fetch
getFile
getQueryParameters
getRequestParameters
handleError
handleResponse

Utils

new Utils()
Static Members
base64Decode(str)
base64Encode(str)
buildUrl(url, queryParams, encode)
getHeaders(type, options = {})
getUid()