Api asyrconnapp

This library gives access to functions used to generate connected applications, JWT tokens and urls.

These functions will be delivered in version 11.1 and higher.

Func GET_TOKEN

This function allows the generatation of a JWT token corresponding to a connected application that has been configured in the Administration Reference Connected Application administration page.

It works on a function called either in Classic mode or in native version 7 mode, and returns a status code returned by the Syracuse javascript code runner.

The parameters are described below:

CodeType and dimensionContents
CLIENTIDValue CharThe client id of the connected application.
PARAMSValue ClbFilea string containing a newline separated list of key/value pair key1: value1\nkey2: value2. (YAML like syntax). Typical keys are: auth, site, ....
RESHEADVariable ClbfileThe response header returned by Syracuse javascript code runner.
RESBODYVariable ClbfileThe response body returned by Syracuse javascript code runner. Here it is the JWT token.

Comments

Params format

The params sent to Syracuse must be in YAML format. It can be sent as data by using the following code:
CODECODE CODEyaml
auth: 
  - auth1
  - auth2
  - auth3
site: SITE1

Example

CODECODE CODEsh
# Generate a token
# The connected application must have been generated and corresponds in this example to the client ID "e2955cf32ff244d2ad4038c4e2484022"
# it returns a JWT token like `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL3gzLXdlYi1zZXJ2ZXIiLCJzdWIiOiJ3ZWItbG9naW4iLCJpYXQiOjE0NjkxMTcwNTEsImV4cCI6MTQ2OTExNzE3MSwianRpIjoiMjk5NWU1ZmVjZmIyNDRhYWI5NTdhNTZkODlkYzI5NWUifQ.d1WYNzpowUw5CkUl-7rq1s-Bq8Be2RR_0RKJYq6uVXI
`

Funprog GEN_TOKEN(RESHEAD, RESBODY)
Variable Clbfile RESHEAD()
Variable Clbfile RESBODY()

Local ClbFile YAML(1) : YAML = "auth:\n  - test1\n  - test2\nsite: SITE1"

Call GET_TOKEN("e2955cf32ff244d2ad4038c4e2484022", YAML, RESHEAD, RESBODY) From ASYRCONNAPP
infbox "Token:"-RESBODY # will display your the generated token

End

Func FORMAT_URL

This function allows the retrieval of a formatted url with a generated JWT token corresponding to a connected application that has been configured in the Administration Reference Connected Application administration page.

It works on a function called either in Classic mode or in native version 7 mode, and returns a status code return by the Syracuse javascript code runner.

The parameters are described below:

CodeType and dimensionContents
CLIENTIDValue CharThe client id of the connected application.
PATHValue Chara string containing the resource sub path to compute for the built url
PARAMSValue ClbFilea string containing a newline separated list of key/value pair key1: value1\nkey2: value2. (YAML like syntax). Typical keys are: auth, site, ....
RESHEADVariable ClbfileThe response header returned by Syracuse javascript code runner.
RESBODYVariable ClbfileThe response body returned by Syracuse javascript code runner. Here it is the JWT token.

Comments

Params format

The params sent to Syracuse must be in YAML format. It can be sent as data by using the following code:
CODECODE CODEyaml
auth: 
  - auth1
  - auth2
  - auth3
site: SITE1

Example

CODECODE CODEsh
# Format url with a generated token
# The connected application must have been generated and corresponds in this example to the client ID "e2955cf32ff244d2ad4038c4e2484022"
# it returns a formatted url like `http://connectedappserver:port/path/to/resource?token=HHHHH.PPPPP.SSSSS`

Funprog GEN_URL(RESHEAD, RESBODY)
Variable Clbfile RESHEAD()
Variable Clbfile RESBODY()

Local ClbFile YAML(1) : YAML = "auth:\n  - test1\n  - test2\nsite: SITE1"

Call FORMAT_URL("e2955cf32ff244d2ad4038c4e2484022", "/path/to/resource", YAML, RESHEAD, RESBODY) From ASYRCONNAPP
Infbox "Url:"-RESBODY # will display the formatted url with generated token

End